[llvm] [ValueTracking] Check both operands for being 0 and then the other for isKnownNonZero (PR #147330)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 9 06:01:48 PDT 2025
================
@@ -3892,6 +3893,12 @@ static bool isKnownNonEqual(const Value *V1, const Value *V2,
if (Depth >= MaxAnalysisRecursionDepth)
return false;
+ // 0 vs known-non-zero
+ if (match(V1, m_Zero()) && isKnownNonZero(V2, DemandedElts, Q, Depth + 1))
+ return true;
+ if (match(V2, m_Zero()) && isKnownNonZero(V1, DemandedElts, Q, Depth + 1))
+ return true;
----------------
nikic wrote:
I don't think this makes sense. x - 0 is just x and should get folded away.
https://github.com/llvm/llvm-project/pull/147330
More information about the llvm-commits
mailing list