forked from OSchip/llvm-project
[ValueTracking] Early exit known non zero for phis
After D88276 we no longer expect computeKnownBits() to prove non-zeroness for cases where isKnownNonZero() can't, so don't fall through to it.
This commit is contained in:
parent
15fbae8ac3
commit
ac8a51c701
|
@ -2564,14 +2564,12 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
|
||||||
// Check if all incoming values are non-zero using recursion.
|
// Check if all incoming values are non-zero using recursion.
|
||||||
Query RecQ = Q;
|
Query RecQ = Q;
|
||||||
unsigned NewDepth = std::max(Depth, MaxAnalysisRecursionDepth - 1);
|
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)
|
if (U.get() == PN)
|
||||||
return true;
|
return true;
|
||||||
RecQ.CxtI = PN->getIncomingBlock(U)->getTerminator();
|
RecQ.CxtI = PN->getIncomingBlock(U)->getTerminator();
|
||||||
return isKnownNonZero(U.get(), DemandedElts, NewDepth, RecQ);
|
return isKnownNonZero(U.get(), DemandedElts, NewDepth, RecQ);
|
||||||
});
|
});
|
||||||
if (AllNonZero)
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
// ExtractElement
|
// ExtractElement
|
||||||
else if (const auto *EEI = dyn_cast<ExtractElementInst>(V)) {
|
else if (const auto *EEI = dyn_cast<ExtractElementInst>(V)) {
|
||||||
|
|
Loading…
Reference in New Issue