[commit: ghc] master: Remove unused eqExprX (82dfe08)
git at git.haskell.org
git at git.haskell.org
Tue Dec 17 15:58:38 UTC 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/82dfe08d43e5cb9617fbc056fd3359b514414413/ghc
>---------------------------------------------------------------
commit 82dfe08d43e5cb9617fbc056fd3359b514414413
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Tue Dec 17 16:34:28 2013 +0100
Remove unused eqExprX
>---------------------------------------------------------------
82dfe08d43e5cb9617fbc056fd3359b514414413
compiler/coreSyn/CoreUtils.lhs | 44 +++++-----------------------------------
1 file changed, 5 insertions(+), 39 deletions(-)
diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs
index bb7b3e2..ea2e17f 100644
--- a/compiler/coreSyn/CoreUtils.lhs
+++ b/compiler/coreSyn/CoreUtils.lhs
@@ -31,7 +31,7 @@ module CoreUtils (
CoreStats(..), coreBindsStats,
-- * Equality
- cheapEqExpr, eqExpr, eqExprX,
+ cheapEqExpr, eqExpr,
-- * Eta reduction
tryEtaReduce,
@@ -1330,43 +1330,18 @@ exprIsBig _ = True
eqExpr :: InScopeSet -> CoreExpr -> CoreExpr -> Bool
-- Compares for equality, modulo alpha
eqExpr in_scope e1 e2
- = eqExprX id_unf (mkRnEnv2 in_scope) e1 e2
- where
- id_unf _ = noUnfolding -- Don't expand
-\end{code}
-
-\begin{code}
-eqExprX :: IdUnfoldingFun -> RnEnv2 -> CoreExpr -> CoreExpr -> Bool
--- ^ Compares expressions for equality, modulo alpha.
--- Does /not/ look through newtypes or predicate types
--- Used in rule matching, and also CSE
-
-eqExprX id_unfolding_fun env e1 e2
- = go env e1 e2
+ = go (mkRnEnv2 in_scope) e1 e2
where
go env (Var v1) (Var v2)
| rnOccL env v1 == rnOccR env v2
= True
- -- The next two rules expand non-local variables
- -- C.f. Note [Expanding variables] in Rules.lhs
- -- and Note [Do not expand locally-bound variables] in Rules.lhs
- go env (Var v1) e2
- | not (locallyBoundL env v1)
- , Just e1' <- expandUnfolding_maybe (id_unfolding_fun (lookupRnInScope env v1))
- = go (nukeRnEnvL env) e1' e2
-
- go env e1 (Var v2)
- | not (locallyBoundR env v2)
- , Just e2' <- expandUnfolding_maybe (id_unfolding_fun (lookupRnInScope env v2))
- = go (nukeRnEnvR env) e1 e2'
-
go _ (Lit lit1) (Lit lit2) = lit1 == lit2
go env (Type t1) (Type t2) = eqTypeX env t1 t2
go env (Coercion co1) (Coercion co2) = coreEqCoercion2 env co1 co2
go env (Cast e1 co1) (Cast e2 co2) = coreEqCoercion2 env co1 co2 && go env e1 e2
go env (App f1 a1) (App f2 a2) = go env f1 f2 && go env a1 a2
- go env (Tick n1 e1) (Tick n2 e2) = go_tickish n1 n2 && go env e1 e2
+ go env (Tick n1 e1) (Tick n2 e2) = go_tickish env n1 n2 && go env e1 e2
go env (Lam b1 e1) (Lam b2 e2)
= eqTypeX env (varType b1) (varType b2) -- False for Id/TyVar combination
@@ -1396,20 +1371,11 @@ eqExprX id_unfolding_fun env e1 e2
= c1 == c2 && go (rnBndrs2 env bs1 bs2) e1 e2
-----------
- go_tickish (Breakpoint lid lids) (Breakpoint rid rids)
+ go_tickish env (Breakpoint lid lids) (Breakpoint rid rids)
= lid == rid && map (rnOccL env) lids == map (rnOccR env) rids
- go_tickish l r = l == r
-\end{code}
-
-Auxiliary functions
-
-\begin{code}
-locallyBoundL, locallyBoundR :: RnEnv2 -> Var -> Bool
-locallyBoundL rn_env v = inRnEnvL rn_env v
-locallyBoundR rn_env v = inRnEnvR rn_env v
+ go_tickish _ l r = l == r
\end{code}
-
%************************************************************************
%* *
\subsection{The size of an expression}
More information about the ghc-commits
mailing list