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

Artur Pilipenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 09:42:48 PDT 2017


apilipenko added a comment.

In https://reviews.llvm.org/D39097#905174, @anna wrote:

> Artur, before this patch, we were checking whether RangeCheckIV's postIncExpr is latchCheckIV.
>
> Now, the header comments and proof seems to point to the fact that the guard and latch are using the same offset (lines 103 - 110), but the code does not have any check that we are using the same offset. Or, is it that the offset is the same, but the difference in the latchCheckIV versus rangeCheckIV is caught in their respective `start` values, and the offset for both latch and guard remains the same?


I changed the loop in the description so it doesn't use Start. Instead the offsets are sunk into predicates G and B.

I also explicitly specified the predicates for the supported cases.



================
Comment at: lib/Transforms/Scalar/LoopPredication.cpp:61
 //       guard(G(I));
-//     } while (B(I.INC));
+//     } while (B(I));
 //   }
----------------
anna wrote:
> Now that arbitrary offsets are supported for both guard and latch, the guard can even be `guard(G(I.INC))`, while the backedge condition can be `B(I)`?
> In other words, do we need the same offset 'i' for both guard and latch?
> 
> Please add a testcase when the guard uses the I.INC and backedge uses I.
> 
No, we don't. I changed the loop so to make this clear, added the requested test case.


https://reviews.llvm.org/D39097





More information about the llvm-commits mailing list