[llvm] IR: introduce CmpInst::isEquivalence (PR #111979)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 05:27:52 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:
For pointers, if A == B, you generally cannot replace A with B unless they have the same provenance.
https://github.com/llvm/llvm-project/pull/111979
More information about the llvm-commits
mailing list