[llvm] 45dec8f - [ValueTracking] Avoid known bits fallthrough for freeze (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 02:03:22 PDT 2022


Author: Nikita Popov
Date: 2022-10-04T11:02:31+02:00
New Revision: 45dec8f5fdd82cf1ed456b0fa860774a26c0acca

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

LOG: [ValueTracking] Avoid known bits fallthrough for freeze (NFCI)

The known bits logic should never produce a better result than
the direct recursive non-zero query here, so skip the fallthrough.

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e7c7d636d527..81f606f39c65 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2737,10 +2737,9 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth,
     }
     break;
   case Instruction::Freeze:
-    if (isKnownNonZero(I->getOperand(0), Depth, Q) &&
-        isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CxtI, Q.DT, Depth))
-      return true;
-    break;
+    return isKnownNonZero(I->getOperand(0), Depth, Q) &&
+           isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+                                     Depth);
   case Instruction::Call:
     if (cast<CallInst>(I)->getIntrinsicID() == Intrinsic::vscale)
       return true;


        


More information about the llvm-commits mailing list