[commit: ghc] master: Do a bit more CSE (3ab342e)

git at git.haskell.org git at git.haskell.org
Mon Jul 31 12:37:24 UTC 2017


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

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

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

commit 3ab342eb1b82ba9218a9d7786c523b1128b2bdf1
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Jul 31 11:00:33 2017 +0100

    Do a bit more CSE
    
    I discovered that in
    
       let x = MkT y in ....(MKT y |> co)....
    
    we weren't CSE'ing the (MkT y).  The fix is easy.


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

3ab342eb1b82ba9218a9d7786c523b1128b2bdf1
 compiler/simplCore/CSE.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs
index 83f5ee6..ccbdf35 100644
--- a/compiler/simplCore/CSE.hs
+++ b/compiler/simplCore/CSE.hs
@@ -454,7 +454,7 @@ cseExpr _   (Lit lit)             = Lit lit
 cseExpr env (Var v)               = lookupSubst env v
 cseExpr env (App f a)             = App (cseExpr env f) (tryForCSE env a)
 cseExpr env (Tick t e)            = Tick t (cseExpr env e)
-cseExpr env (Cast e co)           = Cast (cseExpr env e) (substCo (csEnvSubst env) co)
+cseExpr env (Cast e co)           = Cast (tryForCSE env e) (substCo (csEnvSubst env) co)
 cseExpr env (Lam b e)             = let (env', b') = addBinder env b
                                     in Lam b' (cseExpr env' e)
 cseExpr env (Let bind e)          = let (env', bind') = cseBind NotTopLevel env bind



More information about the ghc-commits mailing list