-fprof-auto-top adds SCCs to INLINE instance methods
Summary
According to the User's Guide, the GHC flag -fprof-auto-top
automatically adds SCC annotations "for all top-level bindings not marked INLINE", but it actually adds SCCs to INLINE instance methods.
Steps to reproduce
Here is a small example that reproduces the behavior: fprof-auto-top.hs
module Main where
data D = D
class C a where
shouldn'tSCC :: a -> ()
instance C D where
shouldn'tSCC D = ()
{-# INLINE shouldn'tSCC #-}
hasSCC :: D -> ()
hasSCC D = ()
hasn'tSCC :: D -> ()
hasn'tSCC D = ()
{-# INLINE hasn'tSCC #-}
main :: IO ()
main = do
print (hasSCC D)
print (hasn'tSCC D)
print (shouldn'tSCC D)
Compile and run the program with profiling:
ghc --make -prof -fprof-auto-top fprof-auto-top.hs
./fprof-auto-top +RTS -p
The profile fprof-auto-top.prof contains entries for hasSCC
(expected) and shouldn'tSCC
(unexpected); there is (correctly) no entry for hasn'tSCC
.
I also compiled with -ddump-simpl
to see that shouldn'tSCC
unexpectedly has an scctick
: fprof-auto-top.dump-simpl
Expected behavior
I expect that only hasSCC
defined above will have an automatic SCC annotation. As it stands, there is apparently no way to inhibit instance methods from getting SCC annotations when using -fprof-auto-top
.
Environment
- GHC version used: The Glorious Glasgow Haskell Compilation System, version 8.6.5
Optional:
- Operating System: NixOS 19.09, Linux 4.14.157
- System Architecture: x86_64-linux