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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 03:38:31 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.
----------------
nikic wrote:

Rather than "this is useful", this should explain what "equivalence" here is supposed to mean. You'll likely have to add a caveat that this ignores provenance considerations.

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


More information about the llvm-commits mailing list