[Git][ghc/ghc][wip/romes/fixes] Remove redundant computation in eqDeBruijnExpr

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Mon Jun 19 23:05:04 UTC 2023



Rodrigo Mesquita pushed to branch wip/romes/fixes at Glasgow Haskell Compiler / GHC


Commits:
f544a9b0 by Rodrigo Mesquita at 2023-06-20T00:04:56+01:00
Remove redundant computation in eqDeBruijnExpr

In eqDeBruijnExpr, we checked if the lists had the same length.
However, all2 already returns False if the length doesn't match.

- - - - -


1 changed file:

- compiler/GHC/Core/Map/Expr.hs


Changes:

=====================================
compiler/GHC/Core/Map/Expr.hs
=====================================
@@ -171,11 +171,12 @@ eqDeBruijnExpr (D env1 e1) (D env2 e2) = go e1 e2 where
       && eqDeBruijnExpr (D (extendCME env1 v1) e1) (D (extendCME env2 v2) e2)
 
     go (Let (Rec ps1) e1) (Let (Rec ps2) e2)
-      = equalLength ps1 ps2
+      =
       -- See Note [Alpha-equality for let-bindings]
-      && all2 (\b1 b2 -> eqDeBruijnType (D env1 (varType b1))
-                                        (D env2 (varType b2)))
-              bs1 bs2
+      -- NB: `all2` returns False if its argument lists differ in length
+      all2 (\b1 b2 -> eqDeBruijnType (D env1 (varType b1))
+                                     (D env2 (varType b2)))
+           bs1 bs2
       && D env1' rs1 == D env2' rs2
       && eqDeBruijnExpr (D env1' e1) (D env2' e2)
       where



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f544a9b0819f0e5662e2d8d64d0f2dc2eedde3df

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f544a9b0819f0e5662e2d8d64d0f2dc2eedde3df
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230619/77635f62/attachment-0001.html>


More information about the ghc-commits mailing list