[llvm] 3ec69c1 - [NFC] Different way of getting step
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 9 22:48:29 PST 2020
Author: Max Kazantsev
Date: 2020-11-10T13:48:02+07:00
New Revision: 3ec69c16c3eca20a9c997c6024253c383a78065e
URL: https://github.com/llvm/llvm-project/commit/3ec69c16c3eca20a9c997c6024253c383a78065e
DIFF: https://github.com/llvm/llvm-project/commit/3ec69c16c3eca20a9c997c6024253c383a78065e.diff
LOG: [NFC] Different way of getting step
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index b42265fadda8..4a0374f88d9d 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -9578,8 +9578,7 @@ bool ScalarEvolution::isLoopInvariantExitCondDuringFirstIterations(
}
auto *AR = dyn_cast<SCEVAddRecExpr>(LHS);
- // TODO: Lift affinity limitation in the future.
- if (!AR || AR->getLoop() != L || !AR->isAffine())
+ if (!AR || AR->getLoop() != L)
return false;
// The predicate must be relational (i.e. <, <=, >=, >).
@@ -9587,7 +9586,7 @@ bool ScalarEvolution::isLoopInvariantExitCondDuringFirstIterations(
return false;
// TODO: Support steps other than +/- 1.
- const SCEV *Step = AR->getOperand(1);
+ const SCEV *Step = AR->getStepRecurrence(*this);
auto *One = getOne(Step->getType());
auto *MinusOne = getNegativeSCEV(One);
if (Step != One && Step != MinusOne)
More information about the llvm-commits
mailing list