[GHC] #7596: Opportunity to improve CSE

GHC cvs-ghc at haskell.org
Wed Jan 16 17:30:13 CET 2013


#7596: Opportunity to improve CSE
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  7.6.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
 In `nofib/spectral/mandel2`, the function `check_perim` calls
 `point_colour` on various arguments.  After inlining `point_colour` there
 is the opportunity to CSE among the sub-expressions the inlinings create.

 In GHC 7.6, the join point didn't have a "one-shot" flag, so the full
 laziness pass floated these sub-expressions out, and they got CSEd.

 As part of Ilya's new demand analyser changes, we get the "one-shot" flag
 right, so don't MFE those sub-expressions, so they aren't CSEd.  As a
 result, allocation on `mandel2` increases slightly (4.2%).

 The solution is, I think, to do something a bit like like `CorePrep`
 before CSE.  At the moment if we have
 {{{
 case f (I# y) of { (a,b) ->
 case g (I# y) of { (p,q) -> ... }}
 }}}
 we stuipdly don't CSE that `(I# y)` even though it is manifestly sharable.
 Somehow we should.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7596>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list