[GHC] #15802: Inlining of constant fails when both cross-module and recursive

GHC ghc-devs at haskell.org
Thu Oct 25 08:25:51 UTC 2018


#15802: Inlining of constant fails when both cross-module and recursive
-------------------------------------+-------------------------------------
        Reporter:  j6carey           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.1
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Runtime           |  (amd64)
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 This is because SpecConstr doesn't work across modules.

 See https://phabricator.haskell.org/D3566 and #10346

 However, your intuition that if you apply a function to a constantly known
 value then it should reduce is misguided. SpecConstr only works in a
 narrow set of circumstances and the inliner will never inline recursive
 functions.

 If you want to guarantee performance then the only way that I know is to
 use (typed) template haskell

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


More information about the ghc-tickets mailing list