[llvm] [ValueTracking] X ^ Y != 0 if X != Y (PR #146975)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 4 03:00:59 PDT 2025
================
@@ -3043,6 +3043,10 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
// (X ^ (X != 0)) is non zero
if (matchOpWithOpEqZero(I->getOperand(0), I->getOperand(1)))
return true;
+ // X ^ Y != 0 if X != Y.
+ if (isKnownNonEqual(I->getOperand(0), I->getOperand(1), DemandedElts, Q,
+ Depth))
+ return true;
----------------
nikic wrote:
Can we make this `return isKnownNonEqual()`? I don't think the fallback path using KnownBits should be able to infer any additional cases, as isKnownNonEqual() also has the KnownBits logic.
https://github.com/llvm/llvm-project/pull/146975
More information about the llvm-commits
mailing list