[PATCH] D40353: [Loop Predication] Teach LP about reverse loops
Anna Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 28 11:29:05 PST 2017
anna marked an inline comment as done.
anna added inline comments.
================
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() &&
----------------
mkazantsev wrote:
> Can this go as a separate NFC? As far as I understand, we currently don't support steps of different types anyways.
yup.
================
Comment at: test/Transforms/LoopPredication/reverse.ll:21
+; CHECK: loop:
+; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 [[wide_cond]], i32 9) [ "deopt"() ]
+loop:
----------------
mkazantsev wrote:
> Do you mind adding a test with `%lowerlimit = 0` to make sure that we don't predicate in this case?
Actually we will predicate in that case - this is the second (less known) benefit of loop predication - we know statically that the range check will deopt at some point during the iteration of loop, so now we will early deopt outside the loop.
See the test `unsigned_reverse_loop_n_to_0`.
https://reviews.llvm.org/D40353
More information about the llvm-commits
mailing list