Skip to content

Commit d094bb6

Browse files
committed
[InstSimplify] Avoid use of ConstantExpr::getICmp() (NFC)
Use ConstantFoldCompareInstOperands() instead.
1 parent 566431c commit d094bb6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3954,12 +3954,14 @@ static Value *simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
39543954
// LHS >s RHS.
39553955
case ICmpInst::ICMP_SGT:
39563956
case ICmpInst::ICMP_SGE:
3957-
return ConstantExpr::getICmp(ICmpInst::ICMP_SLT, C,
3958-
Constant::getNullValue(C->getType()));
3957+
return ConstantFoldCompareInstOperands(
3958+
ICmpInst::ICMP_SLT, C, Constant::getNullValue(C->getType()),
3959+
Q.DL);
39593960
case ICmpInst::ICMP_SLT:
39603961
case ICmpInst::ICMP_SLE:
3961-
return ConstantExpr::getICmp(ICmpInst::ICMP_SGE, C,
3962-
Constant::getNullValue(C->getType()));
3962+
return ConstantFoldCompareInstOperands(
3963+
ICmpInst::ICMP_SGE, C, Constant::getNullValue(C->getType()),
3964+
Q.DL);
39633965

39643966
// If LHS is non-negative then LHS <u RHS. If LHS is negative then
39653967
// LHS >u RHS.

0 commit comments

Comments
 (0)