Skip to content

Commit 3baa310

Browse files
committed
!fixup address comments, thanks
1 parent f70bb3d commit 3baa310

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10893,9 +10893,10 @@ bool ScalarEvolution::SimplifyICmpOperands(CmpPredicate &Pred, const SCEV *&LHS,
1089310893
break;
1089410894
case ICmpInst::ICMP_UGE:
1089510895
// If RHS is an op we can fold the -1, try that first.
10896+
// Otherwise prefer LHS to preserve the nuw flag.
1089610897
if ((isa<SCEVConstant>(RHS) ||
10897-
match(RHS,
10898-
m_scev_AffineAddRec(m_SCEVConstant(), m_SCEV(), m_Loop()))) &&
10898+
(isa<SCEVAddExpr, SCEVAddRecExpr>(RHS) &&
10899+
isa<SCEVConstant>(cast<SCEVNAryExpr>(RHS)->getOperand(0)))) &&
1089910900
!getUnsignedRangeMin(RHS).isMinValue()) {
1090010901
RHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, true), RHS);
1090110902
Pred = ICmpInst::ICMP_UGT;

0 commit comments

Comments
 (0)