summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-09-20 18:49:29 +0000
committerCraig Topper <craig.topper@intel.com>2017-09-20 18:49:29 +0000
commita0c897f634d5fc7916a66acdf686af0b92f28617 (patch)
treec00ac4e4c85c19d5b3d309b61de9f7b80dbbc9bd
parent432b88e5f45aa69f63d73a7e86a0b330d955e98c (diff)
downloadbcm5719-llvm-a0c897f634d5fc7916a66acdf686af0b92f28617.tar.gz
bcm5719-llvm-a0c897f634d5fc7916a66acdf686af0b92f28617.zip
[InstCombine] Use APInt::getActiveBits() to avoid creating an APInt from a trailing zero count to do a comparison. NFCI
llvm-svn: 313792
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index b51d7bc4034..980519bcf9c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -1718,7 +1718,7 @@ Instruction *InstCombiner::foldICmpAndConstConst(ICmpInst &Cmp,
// result greater than C1.
unsigned NumTZ = C2->countTrailingZeros();
if (Cmp.getPredicate() == ICmpInst::ICMP_UGT && NumTZ < C2->getBitWidth() &&
- APInt::getOneBitSet(C2->getBitWidth(), NumTZ).ugt(*C1)) {
+ NumTZ >= C1->getActiveBits()) {
Constant *Zero = Constant::getNullValue(And->getType());
return new ICmpInst(ICmpInst::ICMP_NE, And, Zero);
}
OpenPOWER on IntegriCloud