[GHC] #2940: Do CSE after CorePrep

GHC ghc-devs at haskell.org
Mon Nov 30 17:38:49 UTC 2015


#2940: Do CSE after CorePrep
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  simonpj
            Type:  bug               |               Status:  new
        Priority:  lowest            |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  6.10.1
      Resolution:                    |             Keywords:
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 simonpj):

 See [wiki:MoreCSE].

 I'm inclined to think that it'd be better to do CSE ''earlier'' not
 ''later''.

 The main idea (on the [wiki:MoreCSE] page) is this:
  * Make float-out more aggressive by (a) let-binding every sub-expression,
 and (b) floating let-bindings out even if they don't escape a lambda.  So
 in your first example
 {{{
 g x = (x + 1, x + 1)
 }}}
  we'd get
 {{{
 g x = let v1 = x+1 in
       let v2 = x+2 in
       (v1,v2)
 }}}

  * Now do CSE as now.  The extra let-bindings should give a lot more more
 opportunities.

  * Float inwards to reverse the effect of the first pass if CSE did not
 bite.

 Also talk to Joachim who wrote [wiki:MoreCSE].

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


More information about the ghc-tickets mailing list