Skip to content

Commit f86d2bc

Browse files
committed
[InstCombine] Address review comments. NFC.
1 parent 6b5d6c9 commit f86d2bc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3190,9 +3190,8 @@ Instruction *InstCombinerImpl::foldICmpAddConstant(ICmpInst &Cmp,
31903190
unsigned CmpBW = Ty->getScalarSizeInBits();
31913191
unsigned NewCmpBW = NewCmpTy->getScalarSizeInBits();
31923192
if (shouldChangeType(Ty, NewCmpTy)) {
3193-
if (auto ZExtCR = CR.exactIntersectWith(ConstantRange(
3194-
APInt::getZero(CmpBW), APInt::getOneBitSet(CmpBW, NewCmpBW)))) {
3195-
ConstantRange SrcCR = ZExtCR->truncate(NewCmpBW);
3193+
if (CR.getActiveBits() <= NewCmpBW) {
3194+
ConstantRange SrcCR = CR.truncate(NewCmpBW);
31963195
CmpInst::Predicate EquivPred;
31973196
APInt EquivInt;
31983197
APInt EquivOffset;

0 commit comments

Comments
 (0)