[PATCH] D26185: [ARM] Loop Strength Reduction crashes when targeting ARM or Thumb if the LLVM-IR is not in LCSSA form.
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 1 10:06:31 PDT 2016
efriedma requested changes to this revision.
efriedma added a reviewer: efriedma.
efriedma added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:329
+ if (!AR->getStart()->isZero() &&
+ SE.isLoopInvariant(AR->getStepRecurrence(SE), AR->getLoop())) {
DoInitialMatch(AR->getStart(), L, Good, Bad, SE);
----------------
"SE.isLoopInvariant(AR->getStepRecurrence(SE), AR->getLoop())" is always true; if you try to build an AddRec with non-invariant operands, you'll hit the assertion you pointed out.
================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:582
// FIXME: AR->getNoWrapFlags(SCEV::FlagNW)
- return SE.getAddRecExpr(Start, Step, AR->getLoop(), SCEV::FlagAnyWrap);
+ if (SE.isLoopInvariant(Step, AR->getLoop()))
+ return SE.getAddRecExpr(Start, Step, AR->getLoop(), SCEV::FlagAnyWrap);
----------------
It would be more clear to check "SE.isLoopInvariant(RHS, AR->getLoop())".
================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:3208
+ if (Remainder != AR->getStart() &&
+ SE.isLoopInvariant(AR->getStepRecurrence(SE), AR->getLoop())) {
if (!Remainder)
----------------
Again, useless check.
https://reviews.llvm.org/D26185
More information about the llvm-commits
mailing list