[PATCH] D40353: [Loop Predication] Teach LP about reverse loops

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 00:38:57 PST 2017


mkazantsev accepted this revision.
mkazantsev added a comment.
This revision is now accepted and ready to land.

LGTM with test with `%lowerlimit = 0` added.



================
Comment at: lib/Transforms/Scalar/LoopPredication.cpp:534
+  // not have the same value (we support both 1 and -1 steps).
+  assert(Step->getType() ==
+             CurrLatchCheck.IV->getStepRecurrence(*SE)->getType() &&
----------------
Can this go as a separate NFC? As far as I understand, we currently don't support steps of different types anyways.


================
Comment at: lib/Transforms/Scalar/LoopPredication.cpp:545
+                                               Expander, Builder);
+  else
+    return widenICmpRangeCheckDecrementingLoop(CurrLatchCheck, *RangeCheck,
----------------
Assert that step is `-1`?


================
Comment at: test/Transforms/LoopPredication/reverse.ll:21
+; CHECK: loop:
+; CHECK:    call void (i1, ...) @llvm.experimental.guard(i1 [[wide_cond]], i32 9) [ "deopt"() ]
+loop:
----------------
Do you mind adding a test with `%lowerlimit = 0` to make sure that we don't predicate in this case?


https://reviews.llvm.org/D40353





More information about the llvm-commits mailing list