summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmm/CmmCommonBlockElim.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/cmm/CmmCommonBlockElim.hs b/compiler/cmm/CmmCommonBlockElim.hs
index b3a0b6ffa4..c8220787d7 100644
--- a/compiler/cmm/CmmCommonBlockElim.hs
+++ b/compiler/cmm/CmmCommonBlockElim.hs
@@ -316,7 +316,7 @@ eqMiddleWith dflags eqBid env a b =
-- result registers aren't compared since they are binding occurrences
(CmmUnsafeForeignCall t1 _ a1, CmmUnsafeForeignCall t2 _ a2) ->
let eq = t1 == t2
- && and (zipWith (eqExprWith eqBid env) a1 a2)
+ && eqLists (eqExprWith eqBid env) a1 a2
in (env', eq)
_ -> (env, False)
@@ -326,6 +326,11 @@ eqMiddleWith dflags eqBid env a b =
defd_a = foldLocalRegsDefd dflags (flip (:)) [] a
defd_b = foldLocalRegsDefd dflags (flip (:)) [] b
+eqLists :: (a -> b -> Bool) -> [a] -> [b] -> Bool
+eqLists f (a:as) (b:bs) = f a b && eqLists f as bs
+eqLists _ [] [] = True
+eqLists _ _ _ = False
+
eqExprWith :: (BlockId -> BlockId -> Bool)
-> LocalRegMapping
-> CmmExpr -> CmmExpr
@@ -340,7 +345,7 @@ eqExprWith eqBid env = eq
CmmStackSlot a1 i1 `eq` CmmStackSlot a2 i2 = eqArea a1 a2 && i1==i2
_e1 `eq` _e2 = False
- xs `eqs` ys = and (zipWith eq xs ys)
+ xs `eqs` ys = eqLists eq xs ys
-- See Note [Equivalence up to local registers in CBE]
CmmLocal a `eqReg` CmmLocal b
@@ -399,7 +404,7 @@ eqLastWith eqBid env a b =
(CmmForeignCall t1 _ a1 s1 ret_args1 ret_off1 intrbl1,
CmmForeignCall t2 _ a2 s2 ret_args2 ret_off2 intrbl2) ->
t1 == t2
- && and (zipWith (eqExprWith eqBid env) a1 a2)
+ && eqLists (eqExprWith eqBid env) a1 a2
&& s1 == s2
&& ret_args1 == ret_args2
&& ret_off1 == ret_off2