[llvm] ac8a51c - [ValueTracking] Early exit known non zero for phis

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 12:07:55 PDT 2020


Author: Nikita Popov
Date: 2020-09-29T21:07:36+02:00
New Revision: ac8a51c701ebd332a44944f8ff8545c21bc438ce

URL: https://github.com/llvm/llvm-project/commit/ac8a51c701ebd332a44944f8ff8545c21bc438ce
DIFF: https://github.com/llvm/llvm-project/commit/ac8a51c701ebd332a44944f8ff8545c21bc438ce.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 11377c467bee..11eb5f303c55 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -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)) {


        


More information about the llvm-commits mailing list