[GHC] #14865: GHC Defeats Manual Worker Wrapper with Unboxed Sum

GHC ghc-devs at haskell.org
Tue Feb 27 22:33:45 UTC 2018


#14865: GHC Defeats Manual Worker Wrapper with Unboxed Sum
-------------------------------------+-------------------------------------
        Reporter:  andrewthad        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:  UnboxedSums
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 simonpj):

 This is a classic difficulty. Given, say
 {{{
 f x = g (...x...)
 }}}
 perhaps we could split `f` into two parts
 {{{
 f x = g (f' x)
 f' x = ...x...
 }}}
 and then perhaps we can inline the (now small) `f`, perhaps to good
 effect.

 This is what you want to do here: you want
 {{{
 findByte !off !len !w !arr = boxMaybeInt (go off)
 }}}
 to be inlined at every call site.  It's be simple to arrange, by
 giving `len`, `w` and `arr` as extra arguments to `go`.

 But GHC just isn't clever enough to do that, unless you tell it
 to do so by hand, with an INLINE pragma.

 I don't really know how to fix this.  But it's a good example.

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


More information about the ghc-tickets mailing list