Skip to content

Commit 5d833ee

Browse files
committed
[SCEV] Avoid unnecessary computeConstantDifference() call (NFC)
No need to do the second one if the first one already failed.
1 parent 5168140 commit 5d833ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12098,8 +12098,10 @@ bool ScalarEvolution::isImpliedCondOperandsViaNoOverflow(
1209812098
// C)".
1209912099

1210012100
std::optional<APInt> LDiff = computeConstantDifference(LHS, FoundLHS);
12101+
if (!LDiff)
12102+
return false;
1210112103
std::optional<APInt> RDiff = computeConstantDifference(RHS, FoundRHS);
12102-
if (!LDiff || !RDiff || *LDiff != *RDiff)
12104+
if (!RDiff || *LDiff != *RDiff)
1210312105
return false;
1210412106

1210512107
if (LDiff->isMinValue())

0 commit comments

Comments
 (0)