[PATCH] D39097: [LoopPredication] Handle the case when the guard and the latch IV have different offsets

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 05:47:21 PDT 2017


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

LGTM.



================
Comment at: lib/Transforms/Scalar/LoopPredication.cpp:56
 //
-//   if (B(Start)) {
+//   if (B(0)) {
 //     do {
----------------
I'm not sure if this is clearer :) 
My concern was that this loop makes it look like we support only the case where B and G use the same value of I. 

It becomes clearer when we define what B and G predicates are.


================
Comment at: lib/Transforms/Scalar/LoopPredication.cpp:103
 //   * The loop has a single latch with the condition of the form:
-//      ++i <pred> latchLimit, where <pred> is u<, u<=, s<, or s<=.
+//     B(X) = latchStart + X <pred> latchLimit,
+//     where <pred> is u<, u<=, s<, or s<=.
----------------
The key point here is that latchStart and guardStart can be different values.
So, B(X) can be X, while G(X) is X+1. Various different combinations are allowed. 


https://reviews.llvm.org/D39097





More information about the llvm-commits mailing list