[commit: ghc] master: In CoreSubst, optimize Coercible values aggressively (f4fb94f)

git at git.haskell.org git at git.haskell.org
Tue Feb 11 15:40:24 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f4fb94f366cc3c25f0d77e977611105ac75d9aa5/ghc

>---------------------------------------------------------------

commit f4fb94f366cc3c25f0d77e977611105ac75d9aa5
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Jan 24 13:34:50 2014 +0000

    In CoreSubst, optimize Coercible values aggressively
    
    just like boxed type equalities.


>---------------------------------------------------------------

f4fb94f366cc3c25f0d77e977611105ac75d9aa5
 compiler/coreSyn/CoreSubst.lhs                        |    4 ++--
 testsuite/tests/ghci.debugger/scripts/print018.stdout |    6 +++---
 testsuite/tests/perf/compiler/all.T                   |    5 +++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/compiler/coreSyn/CoreSubst.lhs b/compiler/coreSyn/CoreSubst.lhs
index fef3e86..8531f92 100644
--- a/compiler/coreSyn/CoreSubst.lhs
+++ b/compiler/coreSyn/CoreSubst.lhs
@@ -61,7 +61,7 @@ import Coercion hiding ( substTy, substCo, extendTvSubst, substTyVarBndr, substC
 
 import TyCon       ( tyConArity )
 import DataCon
-import PrelNames   ( eqBoxDataConKey )
+import PrelNames   ( eqBoxDataConKey, coercibleDataConKey )
 import OptCoercion ( optCoercion )
 import PprCore     ( pprCoreBindings, pprRules )
 import Module	   ( Module )
@@ -1039,7 +1039,7 @@ maybe_substitute subst b r
     trivial | exprIsTrivial r = True
             | (Var fun, args) <- collectArgs r
             , Just dc <- isDataConWorkId_maybe fun
-            , dc `hasKey` eqBoxDataConKey
+            , dc `hasKey` eqBoxDataConKey || dc `hasKey` coercibleDataConKey
             , all exprIsTrivial args = True -- See Note [Optimise coercion boxes agressively]
             | otherwise = False
 
diff --git a/testsuite/tests/ghci.debugger/scripts/print018.stdout b/testsuite/tests/ghci.debugger/scripts/print018.stdout
index 2686130..d5b7d46 100644
--- a/testsuite/tests/ghci.debugger/scripts/print018.stdout
+++ b/testsuite/tests/ghci.debugger/scripts/print018.stdout
@@ -3,9 +3,9 @@ Stopped at ../Test.hs:40:1-17
 _result :: () = _
 Stopped at ../Test.hs:40:10-17
 _result :: () = _
-x :: a = _
-x = (_t1::a)
-x :: a
+x :: a17 = _
+x = (_t1::a17)
+x :: a17
 ()
 x = Unary
 x :: Unary
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index ac6d5e8..947c6f0 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -222,13 +222,14 @@ test('T3064',
             # 2012-10-30: 111189536 (x86/Windows)
             # 2013-11-13: 146626504 (x86/Windows, 64bit machine)
             # 2014-01-22: 162457940 (x86/Linux)
-           (wordsize(64), 329795912, 5)]),
+           (wordsize(64), 308422280, 5)]),
             # (amd64/Linux) (28/06/2011):  73259544
             # (amd64/Linux) (07/02/2013): 224798696
             # (amd64/Linux) (02/08/2013): 236404384, increase from roles
             # (amd64/Linux) (11/09/2013): 290165632, increase from AMP warnings
             # (amd64/Linux) (22/11/2013): 308300448, GND via Coercible and counters for constraints solving
-	    # (amd64/Linux) (02/12/2013): 329795912, Coercible refactor
+	        # (amd64/Linux) (02/12/2013): 329795912, Coercible refactor
+            # (amd64/Linux) (11/02/2014): 308422280, optimize Coercions in simpleOptExpr
 
       compiler_stats_num_field('max_bytes_used',
           [(wordsize(32), 7218200 , 20),



More information about the ghc-commits mailing list