No automatic SCC annotations for functions marked INLINABLE
Judging from .prof files and the -xc and -prof callstacks, GHC adds no automatic SCC annotations for functions marked INLINABLE
. The user's guide only mentions INLINE
: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html, not INLINABLE
. Is it a bug in documentation or implementation? In my case I managed to work around by using -fexpose-all-unfoldings
instead of the tons of INLINABLE
I was using before, but in general case, adding all the SCC annotations by hand seems prohibitive. e.g., in code that needs a lot of INLINABLE
to enable specialization.
Since -fexpose-all-unfoldings
does not inhibit profiling and compiling with no optimization doesn't help recover it, the culprit is probably not the actual inlining or specialization, but rather handling of the INLINABLE
pragma itself.
Edit: Ufortunately, the workaround by using -fexpose-all-unfoldings
turns out to be not acceptable for me, see #12963 (closed). I'm also no longer sure about the last paragraph.
Edit: -fexpose-all-unfoldings
plus -fspecialise-aggressively
is a perfect workaround. I wish somebody told me earlier. Compared to 600 INLINABLE
and -fexpose-all-unfoldings
, the compilation time is unchanged (10min) and the program seems a bit faster (not a scientific benchmark). Profiling works fine with this setup and I don't need to write INLINABLE
any more (nor add SCC
by hand).