[llvm] r298683 - [ValueTracking] Convert more places to use setHighBits/setLowBits/setSignBit. NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 20:57:24 PDT 2017


Author: ctopper
Date: Thu Mar 23 22:57:24 2017
New Revision: 298683

URL: http://llvm.org/viewvc/llvm-project?rev=298683&view=rev
Log:
[ValueTracking] Convert more places to use setHighBits/setLowBits/setSignBit. NFCI

Modified:
    llvm/trunk/lib/Analysis/ValueTracking.cpp

Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=298683&r1=298682&r2=298683&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Thu Mar 23 22:57:24 2017
@@ -971,7 +971,7 @@ static void computeKnownBitsFromOperator
       LeadZ = std::min(BitWidth,
                        LeadZ + BitWidth - RHSUnknownLeadingOnes - 1);
 
-    KnownZero = APInt::getHighBitsSet(BitWidth, LeadZ);
+    KnownZero.setHighBits(LeadZ);
     break;
   }
   case Instruction::Select: {
@@ -1233,7 +1233,7 @@ static void computeKnownBitsFromOperator
       Align = Q.DL.getABITypeAlignment(AI->getAllocatedType());
 
     if (Align > 0)
-      KnownZero = APInt::getLowBitsSet(BitWidth, countTrailingZeros(Align));
+      KnownZero.setLowBits(countTrailingZeros(Align));
     break;
   }
   case Instruction::GetElementPtr: {
@@ -1280,7 +1280,7 @@ static void computeKnownBitsFromOperator
       }
     }
 
-    KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ);
+    KnownZero.setLowBits(TrailZ);
     break;
   }
   case Instruction::PHI: {
@@ -1321,9 +1321,8 @@ static void computeKnownBitsFromOperator
           APInt KnownZero3(KnownZero), KnownOne3(KnownOne);
           computeKnownBits(L, KnownZero3, KnownOne3, Depth + 1, Q);
 
-          KnownZero = APInt::getLowBitsSet(
-              BitWidth, std::min(KnownZero2.countTrailingOnes(),
-                                 KnownZero3.countTrailingOnes()));
+          KnownZero.setLowBits(std::min(KnownZero2.countTrailingOnes(),
+                                        KnownZero3.countTrailingOnes()));
 
           if (DontImproveNonNegativePhiBits)
             break;
@@ -1343,7 +1342,7 @@ static void computeKnownBitsFromOperator
               if (KnownZero2.isNegative() && KnownZero3.isNegative())
                 KnownZero.setSignBit();
               else if (KnownOne2.isNegative() && KnownOne3.isNegative())
-                KnownOne.setBit(BitWidth - 1);
+                KnownOne.setSignBit();
             }
 
             // (sub nsw non-negative, negative) --> non-negative




More information about the llvm-commits mailing list