[llvm] IR: introduce CmpInst::isEquivalence (PR #111979)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 05:18:18 PST 2024


================
@@ -2567,8 +2514,8 @@ bool GVNPass::propagateEquality(Value *LHS, Value *RHS,
       // If "A == B" is known true, or "A != B" is known false, then replace
       // A with B everywhere in the scope.  For floating point operations, we
       // have to be careful since equality does not always imply equivalance.
-      if ((isKnownTrue && impliesEquivalanceIfTrue(Cmp)) ||
-          (isKnownFalse && impliesEquivalanceIfFalse(Cmp)))
+      if ((isKnownTrue && Cmp->isEquivalence()) ||
+          (isKnownFalse && Cmp->isEquivalence(/* Invert = */ true)))
----------------
nikic wrote:

```suggestion
      if (Cmp->isEquivalence(isKnownFalse))
```

https://github.com/llvm/llvm-project/pull/111979


More information about the llvm-commits mailing list