[GHC] #9441: CSE should deal with letrec (was: Merge identical top-level expressions following simplification when it is safe to do so)

GHC ghc-devs at haskell.org
Tue Aug 19 08:57:47 UTC 2014


#9441: CSE should deal with letrec
-------------------------------------+-------------------------------------
              Reporter:  dfeuer      |            Owner:
                  Type:  feature     |           Status:  new
  request                            |        Milestone:
              Priority:  normal      |          Version:  7.8.2
             Component:  Compiler    |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 The common subexpression elimination pass (CSE.lhs) doesn't deal with
 letrec at all, at the moment.  We'd like this transformation:
 {{{
    Rec { x = ...x... }
    ...
    Rec { y = ...y... }
 ===>
    rec { x = ...x... }
    ...
    NonRec { y = x }
 }}}
 Extending CSE to do this would be a good goal.  It would make a good
 little project.  Need to think about how to deal with mutual recursion
 too!  (Or maybe dealing with a singleton `Rec` would do as a start.)

 The current CSE transform is quite compact and elegeant; I would regret
 some very hairy new code, and I hope there is a nice elegant way.

 Simon

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


More information about the ghc-tickets mailing list