[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 11:19:57 PDT 2016


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:581
       // FIXME: AR->getNoWrapFlags(SCEV::FlagNW)
-      return SE.getAddRecExpr(Start, Step, AR->getLoop(), SCEV::FlagAnyWrap);
+      if (AR->isAffine())
+        return SE.getAddRecExpr(Start, Step, AR->getLoop(), SCEV::FlagAnyWrap);
----------------
Please move this check into the earlier if statement.


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:3206
     }
-    if (Remainder != AR->getStart()) {
+    if (Remainder != AR->getStart() && AR->isAffine()) {
       if (!Remainder)
----------------
Please move this check earlier (maybe the same place as the "AR->getStart()->isZero()" check).


================
Comment at: test/Transforms/LoopStrengthReduce/ARM/addrec-is-loop-invariant.ll:3
+
+; This test checks that when the IR is not under LCSSA form,
+; Loop Strength Reduction will not create an Add Reccurence
----------------
This issue has nothing to do with LCSSA, as far as I can tell.


https://reviews.llvm.org/D26185





More information about the llvm-commits mailing list