[GHC] #4301: Optimisations give bad core for foldl' (flip seq) ()

GHC ghc-devs at haskell.org
Sun Nov 30 21:17:39 UTC 2014


#4301: Optimisations give bad core for foldl' (flip seq) ()
-------------------------------------+-------------------------------------
              Reporter:              |            Owner:
  daniel.is.fischer                  |           Status:  new
                  Type:  bug         |        Milestone:  7.10.1
              Priority:  low         |          Version:  6.12.3
             Component:  Compiler    |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:  Runtime     |  Related Tickets:
  performance bug                    |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * cc: dfeuer (added)
 * difficulty:   => Unknown


Comment:

 `foldl'` doesn't seem to get inlined with HEAD. I don't know if this
 ticket is still relevant.

 {{{
 $ cat test.hs
 module Foo where
 import Data.List

 foo :: [a] -> ()
 foo = foldl' (flip seq) ()

 $ ghc-7.9.20141125 -ddump-simpl -dsuppress-all -fforce-recomp -O test.hs
 ...
 foo1
 foo1 =
   \ @ a_aua x_auY y_auZ -> case y_auZ of _ { __DEFAULT -> x_auY }

 foo
 foo = \ @ a_aua -> foldl' (foo1) ()
 }}}

 With 7.8.3:
 {{{
 $ ghc-7.8.3 -ddump-simpl -dsuppress-all -fforce-recomp -O test.hs
 ...
 Rec {
 foo1
 foo1 =
   \ @ a_avy w_sP6 ->
     case case w_sP6 of _ {
            [] -> ();
            : x_aOm xs_aOn ->
              case x_aOm of _ { __DEFAULT ->
              case foo1 xs_aOn of _ { (# #) -> () }
              }
          }
     of _ { () ->
     (##)
     }
 end Rec }

 foo
 foo = \ @ a_avy w_sPd -> case foo1 w_sPd of _ { (# #) -> () }
 }}}

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


More information about the ghc-tickets mailing list