[GHC] #2915: Arity is smaller than need be

GHC ghc-devs at haskell.org
Fri Feb 14 17:09:56 UTC 2014


#2915: Arity is smaller than need be
--------------------------------------------+------------------------------
        Reporter:  simonpj                  |            Owner:  simonpj
            Type:  bug                      |           Status:  infoneeded
        Priority:  lowest                   |        Milestone:  7.6.2
       Component:  Compiler                 |          Version:  6.10.1
      Resolution:                           |         Keywords:
Operating System:  Unknown/Multiple         |     Architecture:
 Type of failure:  Runtime performance bug  |  Unknown/Multiple
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------

Comment (by simonpj):

 If we eta-expand to:
 {{{
 h x = let f = \y -> case x of { True -> t1 y; False -> t2 y }
           in (f,f)
 }}}
 then we'd do the `case x` each time we call `f`, rather than once.  But in
 exchange we get better code for `f`. Worth a try perhaps.

 Notice that we do such things between lambdas:
 {{{
 h x = let g = \y -> case x of { True -> \v->e1; False -> \v->e2 } in ...
 }}}
 here we do (already) eta-expand g to
 {{{
 h x = let g = \y v -> case x of { True -> e1; False -> e2 } in ...
 }}}
 This seems inconsistent with not doing so in for `f`.

 Simon

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


More information about the ghc-tickets mailing list