[GHC] #2552: SCC annotation behavior differs between toplevel and
non-toplevel
GHC
trac at galois.com
Thu Aug 28 10:54:12 EDT 2008
#2552: SCC annotation behavior differs between toplevel and non-toplevel
------------------------------+---------------------------------------------
Reporter: Rauli | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.8.2 | Severity: normal
Keywords: scc profiling | Testcase:
Architecture: x86 | Os: Linux
------------------------------+---------------------------------------------
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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2552>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list