[GHC] #12962: No automatic SCC annotations for functions marked INLINABLE

GHC ghc-devs at haskell.org
Mon Dec 12 13:11:53 UTC 2016


#12962: No automatic SCC annotations for functions marked INLINABLE
-------------------------------------+-------------------------------------
        Reporter:  MikolajKonarski   |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Profiling         |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by osa1):

 * cc: osa1 (added)


Comment:

 I'm not sure if this is intentional. `compiler/deSugar/Coverage.hs` is
 responsible for adding ticks. It's using `BasicTypes.isAnyInlinePragma`
 for deciding whether to add a tick or not, and that function returns true
 for both `INLINE` and `INLINABLE`. But if you look at the note `inline
 sccs`:

 {{{#!haskell
 -- Note [inline sccs]
 --
 -- It should be reasonable to add ticks to INLINE functions; however
 -- currently this tickles a bug later on because the SCCfinal pass
 -- does not look inside unfoldings to find CostCentres.  It would be
 -- difficult to fix that, because SCCfinal currently works on STG and
 -- not Core (and since it also generates CostCentres for CAFs,
 -- changing this would be difficult too).
 --
 -- Another reason not to add ticks to INLINE functions is that this
 -- sometimes handy for avoiding adding a tick to a particular function
 -- (see #6131)
 --
 -- So for now we do not add any ticks to INLINE functions at all.
 }}}

 it doesn't mention `INLINABLE`. #6131 also doesn't mention `INLINABLE`,
 maybe it didn't exist at the time.

 I think it might make sense to add cost centres to `INLINABLE` functions
 as they may not be inlined. Somewhat related ticket: #10766 (semantics of
 `INLINE` and `INLINABLE` are not clear).

 I also looked at the git history. The commit that added the note also
 added `isAnyInlinePragma` calls, and that functions had same semantics as
 today. So maybe it's intentional and we should update the documentation.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12962#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list