Skip to content

Commit

Permalink
[InstSimplify] Avoid use of ConstantExpr::getICmp() (NFC)
Browse files Browse the repository at this point in the history
Use ConstantFoldCompareInstOperands() instead.
  • Loading branch information
nikic committed May 21, 2024
1 parent 566431c commit d094bb6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions llvm/lib/Analysis/InstructionSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3954,12 +3954,14 @@ static Value *simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
// LHS >s RHS.
case ICmpInst::ICMP_SGT:
case ICmpInst::ICMP_SGE:
return ConstantExpr::getICmp(ICmpInst::ICMP_SLT, C,
Constant::getNullValue(C->getType()));
return ConstantFoldCompareInstOperands(
ICmpInst::ICMP_SLT, C, Constant::getNullValue(C->getType()),
Q.DL);
case ICmpInst::ICMP_SLT:
case ICmpInst::ICMP_SLE:
return ConstantExpr::getICmp(ICmpInst::ICMP_SGE, C,
Constant::getNullValue(C->getType()));
return ConstantFoldCompareInstOperands(
ICmpInst::ICMP_SGE, C, Constant::getNullValue(C->getType()),
Q.DL);

// If LHS is non-negative then LHS <u RHS. If LHS is negative then
// LHS >u RHS.
Expand Down

0 comments on commit d094bb6

Please sign in to comment.