[llvm] r300265 - [InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBitsSet. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 14:49:48 PDT 2017


Author: ctopper
Date: Thu Apr 13 16:49:48 2017
New Revision: 300265

URL: http://llvm.org/viewvc/llvm-project?rev=300265&view=rev
Log:
[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBitsSet. NFC

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=300265&r1=300264&r2=300265&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Thu Apr 13 16:49:48 2017
@@ -3810,16 +3810,14 @@ static APInt getDemandedBitsLHSMask(ICmp
   // greater than the RHS must differ in a bit higher than these due to carry.
   case ICmpInst::ICMP_UGT: {
     unsigned trailingOnes = RHS.countTrailingOnes();
-    APInt lowBitsSet = APInt::getLowBitsSet(BitWidth, trailingOnes);
-    return ~lowBitsSet;
+    return APInt::getBitsSetFrom(BitWidth, trailingOnes);
   }
 
   // Similarly, for a ULT comparison, we don't care about the trailing zeros.
   // Any value less than the RHS must differ in a higher bit because of carries.
   case ICmpInst::ICMP_ULT: {
     unsigned trailingZeros = RHS.countTrailingZeros();
-    APInt lowBitsSet = APInt::getLowBitsSet(BitWidth, trailingZeros);
-    return ~lowBitsSet;
+    return APInt::getBitsSetFrom(BitWidth, trailingZeros);
   }
 
   default:




More information about the llvm-commits mailing list