Skip to content

Commit 3f0e1d4

Browse files
authored
[SCEV] Swap order of arguments to MatchBinaryAddToConst (NFCI). (#91945)
The argument order to MatchBinaryAddToConst doesn't match the comment and also is counter-intuitive (passing RHS before LHS, C2 before C1). This patch adjusts the order to be inline with the calls above, which should be equivalent, but more natural: https://alive2.llvm.org/ce/z/ZWGp-Z PR: #91945
1 parent 8823abe commit 3f0e1d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11274,7 +11274,7 @@ bool ScalarEvolution::isKnownPredicateViaNoOverflow(ICmpInst::Predicate Pred,
1127411274
[[fallthrough]];
1127511275
case ICmpInst::ICMP_ULE:
1127611276
// (X + C1)<nuw> u<= (X + C2)<nuw> for C1 u<= C2.
11277-
if (MatchBinaryAddToConst(RHS, LHS, C2, C1, SCEV::FlagNUW) && C1.ule(C2))
11277+
if (MatchBinaryAddToConst(LHS, RHS, C1, C2, SCEV::FlagNUW) && C1.ule(C2))
1127811278
return true;
1127911279

1128011280
break;
@@ -11284,7 +11284,7 @@ bool ScalarEvolution::isKnownPredicateViaNoOverflow(ICmpInst::Predicate Pred,
1128411284
[[fallthrough]];
1128511285
case ICmpInst::ICMP_ULT:
1128611286
// (X + C1)<nuw> u< (X + C2)<nuw> if C1 u< C2.
11287-
if (MatchBinaryAddToConst(RHS, LHS, C2, C1, SCEV::FlagNUW) && C1.ult(C2))
11287+
if (MatchBinaryAddToConst(LHS, RHS, C1, C2, SCEV::FlagNUW) && C1.ult(C2))
1128811288
return true;
1128911289
break;
1129011290
}

0 commit comments

Comments
 (0)