Skip to content

Commit 68c86f4

Browse files
committed
[InstCombine] Remove redundant checks
1 parent eab6eba commit 68c86f4

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5800,12 +5800,6 @@ Instruction *InstCombinerImpl::foldICmpWithClamp(ICmpInst &I, Value *X,
58005800
return nullptr;
58015801
}
58025802

5803-
// If Hi is the maximum value, the min operation becomes redundant and
5804-
// will be removed by other optimizations.
5805-
if ((Min->isSigned() && (Lo->isMinSignedValue() || Hi->isMaxSignedValue())) ||
5806-
(!Min->isSigned() && (Lo->isMinValue() || Hi->isMaxValue())))
5807-
return nullptr;
5808-
58095803
ConstantRange CR(*Lo, *Hi + 1);
58105804
ICmpInst::Predicate Pred;
58115805
APInt C, Offset;
@@ -5814,8 +5808,7 @@ Instruction *InstCombinerImpl::foldICmpWithClamp(ICmpInst &I, Value *X,
58145808
else
58155809
CR.inverse().getEquivalentICmp(Pred, C, Offset);
58165810

5817-
if (Offset != 0)
5818-
X = Builder.CreateAdd(X, ConstantInt::get(X->getType(), Offset));
5811+
X = Builder.CreateAdd(X, ConstantInt::get(X->getType(), Offset));
58195812

58205813
return replaceInstUsesWith(
58215814
I, Builder.CreateICmp(Pred, X, ConstantInt::get(X->getType(), C)));

0 commit comments

Comments
 (0)