[GHC] #2940: Do CSE after CorePrep

GHC ghc-devs at haskell.org
Mon Nov 30 20:25:32 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 osa1):

 Why do we need to do CSE in STG level to avoid allocation in `Either`s
 `fmap`? What does STG give us extra over Core? Do you mean not having type
 terms help? If so, how?

 {{{#!haskell
 -- RHS size: {terms: 14, types: 17, coercions: 0}
 Main.$fFunctorEither1_$cfmap
   :: forall a_aOH a1_avU b_avV.
      (a1_avU -> b_avV) -> Either1 a_aOH a1_avU -> Either1 a_aOH b_avV
 Main.$fFunctorEither1_$cfmap =
   \ (@ a_aOH)
     (@ a1_aOL)
     (@ b_aOM)
     (ds_dR3 :: a1_aOL -> b_aOM)
     (ds1_dR4 :: Either1 a_aOH a1_aOL) ->
     case ds1_dR4 of _ {
       Left1 x_avi -> Main.Left1 @ a_aOH @ b_aOM x_avi;
       Right1 y_avk -> Main.Right1 @ a_aOH @ b_aOM (ds_dR3 y_avk)
     }
 }}}

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


More information about the ghc-tickets mailing list