Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,391
    • Issues 4,391
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 375
    • Merge Requests 375
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #2552

Closed
Open
Opened Aug 28, 2008 by Rauli@trac-Rauli

SCC annotation behavior differs between toplevel and non-toplevel

I'm not sure if this is a bug, but using ghc -prof -auto-all and manual SCC annotations for non-toplevel functions produces very different results from moving the same function to toplevel:

fib n = nfib' n
  where
    nfib' n = {-# SCC "nfib'" #-} nfib n -- %time: 0 (both individual and inherited)
      where
        nfib n = if n < 2 then 1 else nfib (n-1) + nfib (n-2)

fib n = nfib' n
nfib' n = nfib n -- %time: 100 (both individual and inherited)
  where
    nfib n = if n < 2 then 1 else nfib (n-1) + nfib (n-2)

This happens with both -O0 and -O2, even when these functions are not exported. Adding a NOINLINE for nfib' doesn't change anything.

Computing the correct inherited time for the SCC would be useful to pinpoint the cost centres inside a more complex function. Currently one needs to move them to toplevel to get the same effect. Given that the toplevel route works, it's also counterintuitive that manual SCC annotations don't.

Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
7.4.1
Milestone
7.4.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#2552