[llvm] 94cc9ec - [ValueTracking] Simplify KnownBits construction

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 01:32:22 PDT 2020


Author: Jay Foad
Date: 2020-04-09T09:27:22+01:00
New Revision: 94cc9eccf65f2282ae780c3e98d19c5b3b6b9069

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

LOG: [ValueTracking] Simplify KnownBits construction

Use the simpler BitWidth constructor instead of the copy constructor to
make it clear when we don't actually need to copy an existing KnownBits
value. Split out from D74539. NFC.

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 4fa43a320031..713e09ebc78b 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1121,7 +1121,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
                                          const Query &Q) {
   unsigned BitWidth = Known.getBitWidth();
 
-  KnownBits Known2(Known);
+  KnownBits Known2(BitWidth);
   switch (I->getOpcode()) {
   default: break;
   case Instruction::Load:
@@ -1534,7 +1534,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
           computeKnownBits(R, Known2, Depth + 1, RecQ);
 
           // We need to take the minimum number of known bits
-          KnownBits Known3(Known);
+          KnownBits Known3(BitWidth);
           RecQ.CxtI = LInst;
           computeKnownBits(L, Known3, Depth + 1, RecQ);
 
@@ -1688,7 +1688,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
         if (II->getIntrinsicID() == Intrinsic::fshr)
           ShiftAmt = BitWidth - ShiftAmt;
 
-        KnownBits Known3(Known);
+        KnownBits Known3(BitWidth);
         computeKnownBits(I->getOperand(0), Known2, Depth + 1, Q);
         computeKnownBits(I->getOperand(1), Known3, Depth + 1, Q);
 


        


More information about the llvm-commits mailing list