[GHC] #12990: Partially applied constructors with unpacked fields simplified badly

GHC ghc-devs at haskell.org
Wed Dec 21 03:08:45 UTC 2016


#12990: Partially applied constructors with unpacked fields simplified badly
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:  Inlining
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Replying to [comment:3 simonpj]:
 > In `MkId` line 511 we have
 > {{{
 >              wrap_unf = mkInlineUnfolding (Just wrap_arity) wrap_rhs
 > }}}
 > The `Just wrap_arity` is what prevents GHC inlining the wrapper until it
 is saturated.  Change it to `Nothing` to allow a partially-applied wrapper
 to inline.
 >
 > Worth a try.  I doubt it'd have any bad effects.

 There's a comment right above that I don't know enough about GHC to
 interpret:

 > The Cpr info can be important inside INLINE rhss, where the
 > wrapper constructor isn't inlined.
 > And the argument strictness can be important too; we
 > may not inline a constructor when it is partially applied.
 > For example:
 > {{{#!hs
 > data W = C !Int !Int !Int
 > ...(let w = C x in ...(w p q)...)...
 > }}}
 > we want to see that w is strict in its two arguments

 Does this point to a reason not to inline partially-applied wrappers? If
 not, does it point to some additional change that should be made in
 parallel? Or does it become obsolete with this change?

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


More information about the ghc-tickets mailing list