[GHC] #14564: CAF isn't floated

GHC ghc-devs at haskell.org
Fri Dec 8 10:06:03 UTC 2017


#14564: CAF isn't floated
-------------------------------------+-------------------------------------
        Reporter:  neil.mayhew       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  FloatOut
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:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * keywords:   => FloatOut


Comment:

 I can think of various ways to improve this

 * Make the ad-hoc special handling for case-expressions fire only if
   * The destination level is no top-level (then no extra thunk is created
 after all)
   * The scrutinee is lifted (so a separate decision can really be taken
 for the scrutinee

 --------------
 I note also another problem with `Note [Case MFEs]`. Consider
 {{{
 g y = h y (case (f 3) of
               Nothing -> True
               Just x -> expensive s)
 }}}
 If we don't float the whole case-expression, we can float `(f 3)` instead.
 But we won't float `expensive x`; so it will be computed for each call of
 `g`.  Not very clever.

 Maybe we should just kill off the special case, and put up with a couple
 of nofib regressions.

 This needs a bit of careful performance comparison. Any volunteers?  I can
 advise.

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


More information about the ghc-tickets mailing list