[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:
parent
432b88e5f4
commit
a0c897f634
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue