[GHC] #11781: Improve common sub-expression

GHC ghc-devs at haskell.org
Tue Apr 5 19:59:14 UTC 2016


#11781: Improve common sub-expression
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2074
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nomeata):

 >  Should I land this thing (CSE improvements) now already?

 I guess not before you have told me whether this change in T7116 is benign
 or not:

 {{{
  ==================== Tidy Core ====================
 -Result size of Tidy Core = {terms: 32, types: 17, coercions: 0}
 +Result size of Tidy Core = {terms: 46, types: 23, coercions: 0}

  -- RHS size: {terms: 2, types: 0, coercions: 0}
  T7116.$trModule2 :: GHC.Types.TrName
 @@ -49,7 +49,7 @@
      GHC.Types.D# (GHC.Prim.+## x1 x1)
      }

 --- RHS size: {terms: 1, types: 0, coercions: 0}
 +-- RHS size: {terms: 8, types: 3, coercions: 0}
  dl :: Double -> Double
  [GblId,
   Arity=1,
 @@ -62,7 +62,11 @@
                   case x of _ [Occ=Dead] { GHC.Types.D# y ->
                   GHC.Types.D# (GHC.Prim.+## y y)
                   }}]
 -dl = dr
 +dl =
 +  \ (x :: Double) ->
 +    case x of _ [Occ=Dead] { GHC.Types.D# y ->
 +    GHC.Types.D# (GHC.Prim.+## y y)
 +    }

  -- RHS size: {terms: 8, types: 3, coercions: 0}
  fr :: Float -> Float
 @@ -83,7 +87,7 @@
      GHC.Types.F# (GHC.Prim.plusFloat# x1 x1)
      }

 --- RHS size: {terms: 1, types: 0, coercions: 0}
 +-- RHS size: {terms: 8, types: 3, coercions: 0}
  fl :: Float -> Float
  [GblId,
   Arity=1,
 @@ -96,5 +100,9 @@
                   case x of _ [Occ=Dead] { GHC.Types.F# y ->
                   GHC.Types.F# (GHC.Prim.plusFloat# y y)
                   }}]
 -fl = fr
 +fl =
 +  \ (x :: Float) ->
 +    case x of _ [Occ=Dead] { GHC.Types.F# y ->
 +    GHC.Types.F# (GHC.Prim.plusFloat# y y)
 +    }

 *** unexpected failure for T7116(normal)
 }}}

 That ticket was bout strength reduction, and that is still happening. But
 it there seems to be some CSE lost.

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


More information about the ghc-tickets mailing list