From: Craig Topper Date: Thu, 13 Apr 2017 21:49:48 +0000 (+0000) Subject: [InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBits... X-Git-Tag: android-x86-7.1-r4~17726 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e7866ab1801719d4a3c17441051d05910e89719b;p=android-x86%2Fexternal-llvm.git [InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBitsSet. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300265 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index 2419d4f3288..5a292ef849e 100644 --- a/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -3810,16 +3810,14 @@ static APInt getDemandedBitsLHSMask(ICmpInst &I, unsigned BitWidth, // 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: