[llvm] IR: introduce CmpInst::is{Eq,Ne}Equivalence (PR #111979)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 04:03:01 PDT 2024


================
@@ -912,6 +912,16 @@ class CmpInst : public Instruction {
   /// Determine if this is an equals/not equals predicate.
   bool isEquality() const { return isEquality(getPredicate()); }
 
+  /// Determine if this is an equals predicate that is also an equivalence. This
+  /// is useful in GVN-like transformations, where we can replace RHS by LHS in
+  /// the true branch of the CmpInst.
----------------
artagnon wrote:

I'm not sure what the caveat is, if the operands are loaded from memory: can you explain?

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


More information about the llvm-commits mailing list