[GHC] #14815: -XStrict prevents code inlining.

GHC ghc-devs at haskell.org
Sat Mar 3 09:38:03 UTC 2018


#14815: -XStrict prevents code inlining.
-------------------------------------+-------------------------------------
        Reporter:  danilo2           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      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:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 So the bug here is not related with inlining. In general, any flag that
 effects generated Core (or analysis passes like the demand analysis) can
 effect inlining decisions. In particular, -XStrict can lead to more case
 expressions to evaluate intermediate results eagerly, which may cause
 larger code, which effects inlining decisions. Also, because some part of
 inlining decisions are done in the use site we'd also need to see the code
 that uses your `primitive` function.

 That being said, the bug here is that `-XStrict` shouldn't have any effect
 on generated Core because you only have one binding (`a` in your
 `primitive` function), and that has a laziness annotation.
 [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html
 #strict-by-default-pattern-bindings GHC user manual on -XStrict] says that
 adding `~` in front of bindings gives us the regular lazy behavior. So
 really there's nothing `-XStrict` can do in this module.

 However the desugared code really changes with `-XStrict` in GHC 8.2.2,
 and that's the bug. I just tested with HEAD and 8.4 RC1 and this is fixed
 in both versions so you just have to update GHC when 8.4 released.

 (I don't know if there will be another 8.2 release, if so maybe we can
 include the fix in that version)

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


More information about the ghc-tickets mailing list