[GHC] #10918: Float once-used let binding into a recursive function

GHC ghc-devs at haskell.org
Wed Oct 7 14:15:33 UTC 2015


#10918: Float once-used let binding into a recursive function
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
-------------------------------------+-------------------------------------

Comment (by nomeata):

 Prelimary results: In `queens` allocation goes down by 17%, due to this
 change to the core (which is pretty much a poster child for what I am
 aiming for)
 {{{#!hs
                           go =
                             \ (ds3 :: [[Int]]) ->
                               case ds3 of _ [Occ=Dead] {
                                 [] -> [] @ [Int];
                                 : y ys ->
 -                                 let {
 -                                   z :: [[Int]]
 -                                   [LclId, Str=DmdType]
 -                                   z = go ys } in
                                   letrec {
                                     go1 [Occ=LoopBreaker] :: [Int] ->
 [[Int]]
                                     [LclId, Arity=1, Str=DmdType <S,1*U>]
                                     go1 =
                                       \ (ds4 :: [Int]) ->
                                         case ds4 of _ [Occ=Dead] {
 -                                         [] -> z;
 +                                         [] -> go ys;
                                           : y1 ys1 ->

 }}}

 Multiple similar changes in cryptarithm2, 8% improved allocation.

 But in paraffins something goes very wrong, +1290% allocation. Needs more
 investigation.

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


More information about the ghc-tickets mailing list