[InstCombine] Use APInt::getActiveBits() to avoid creating an APInt from a trailing zero count to do a comparison. NFCI

llvm-svn: 313792
This commit is contained in:
Craig Topper 2017-09-20 18:49:29 +00:00
parent 432b88e5f4
commit a0c897f634
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}