[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.
+ bool isEqEquivalence() const;
+
+ /// Determine if this is a not-equals predicate that is also an equivalence.
+ /// This is useful in GVN-like transformations, where we can replace RHS by
+ /// LHS in the false branch of the CmpInst.
+ bool isNeEquivalence() const;
----------------
nikic wrote:
Instead of two methods, pass an invert flag.
https://github.com/llvm/llvm-project/pull/111979
More information about the llvm-commits
mailing list