Skip to content

Commit

Permalink
[ValueTracking] Early exit known non zero for phis
Browse files Browse the repository at this point in the history
After D88276 we no longer expect computeKnownBits() to prove
non-zeroness for cases where isKnownNonZero() can't, so don't
fall through to it.
  • Loading branch information
nikic committed Sep 29, 2020
1 parent 15fbae8 commit ac8a51c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions llvm/lib/Analysis/ValueTracking.cpp
Expand Up @@ -2564,14 +2564,12 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
// Check if all incoming values are non-zero using recursion.
Query RecQ = Q;
unsigned NewDepth = std::max(Depth, MaxAnalysisRecursionDepth - 1);
bool AllNonZero = llvm::all_of(PN->operands(), [&](const Use &U) {
return llvm::all_of(PN->operands(), [&](const Use &U) {
if (U.get() == PN)
return true;
RecQ.CxtI = PN->getIncomingBlock(U)->getTerminator();
return isKnownNonZero(U.get(), DemandedElts, NewDepth, RecQ);
});
if (AllNonZero)
return true;
}
// ExtractElement
else if (const auto *EEI = dyn_cast<ExtractElementInst>(V)) {
Expand Down

0 comments on commit ac8a51c

Please sign in to comment.