[GHC] #5996: fix for CSE

GHC ghc-devs at haskell.org
Tue Nov 12 15:23:43 UTC 2013


#5996: fix for CSE
--------------------------------------------+------------------------------
        Reporter:  michalt                  |            Owner:  simonpj
            Type:  bug                      |           Status:  patch
        Priority:  normal                   |        Milestone:  7.8.1
       Component:  Compiler                 |          Version:  7.5
      Resolution:                           |         Keywords:
Operating System:  Unknown/Multiple         |     Architecture:
 Type of failure:  Runtime performance bug  |  Unknown/Multiple
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------

Comment (by simonpj):

 Commit message properly formatted
 {{{
 Fix egregious omission in CSE (Trac #5996)

 This patch fixes a bad omission in CSE, thanks to 'michaelt' for spotting
 it, and correctly identifying the fix (in cseRhs).  The trouble was with
    x1 = C a b
    x2 = C x1 b
    y1 = C a b
    y2 = C y1 b
 we were not commoning up y2=x2, because we failed to substitute y1:=x1,
 so y2's RHS looked different to x2's

 I also refactoring, so taht the cs_map in a CSEnv map is
        cs_map    :: CoreMap (OutExpr, Id)
 instead of
        cs_map    :: CoreMap (OutExpr, OutExpr)
 Much nicer!

 This doesn't make much difference to allocation, but it gives a
 surprisingly
 big benefit to binary size.

 --------------------------------------------------------------------------------
         Program           Size    Allocs   Runtime   Elapsed  TotalMem
 --------------------------------------------------------------------------------
            ansi          -1.7%     -0.8%      0.00      0.00     +0.0%
            bspt          -1.6%     -1.5%      0.01      0.01     +0.0%
       cacheprof          -1.8%     -0.2%     +1.6%     +1.9%     +2.7%
             fft          -1.4%     -1.3%      0.06      0.06    +11.1%
             ida          -1.4%     -1.0%      0.12      0.12     +0.0%
            rfib          -1.4%     -0.1%      0.03      0.03     +0.0%
             scs          -1.6%     -0.1%     +1.5%     +1.5%     +0.0%
   spectral-norm          -1.3%     -0.1%     -0.2%     -0.2%     +0.0%
             tak          -1.4%     -0.1%      0.02      0.02     +0.0%
         veritas          -1.4%     -0.1%      0.00      0.00     +0.0%
 --------------------------------------------------------------------------------
             Min          -2.5%     -1.5%    -11.8%    -11.8%     -8.0%
             Max          -1.0%     +0.0%     +2.7%     +2.5%    +11.1%
  Geometric Mean          -1.3%     -0.1%     -2.6%     -2.6%     +0.0%
 }}}

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


More information about the ghc-tickets mailing list