[PATCH] D39453: [SCEV] Strengthen variance condition in calculateLoopDisposition

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 05:05:54 PST 2017


mkazantsev added a comment.

In https://reviews.llvm.org/D39453#918719, @reames wrote:

> Max, I don't quite follow your discussion enough to know for sure, but I suspect there's something wrong with your framing here.  A induction variable in one loop may be loop invariant with respect to sibling loop.  That's normal.  Is there maybe a subcase here?  Or are you looking at flawed assumption in caller code?
>
> int i;
>  for (i = 0; i < N; i++) { /* i is variant, j is undefined here */ }
>  for (int j = 0; j < M; j++) {/* i is invariant, j is varying. */ }


We are speaking about case `/* i is variant, j is undefined here */ `. We attempt to get the disposition of `j` w.r.t. the first loop, and we falsely return `Invariant` in this case. We don't have `Undefined` stance, so I used `Variant` instead of it.

I agree that `i` is invariant w.r.t. loop 2, but this is not the case that we cover in this patch.


https://reviews.llvm.org/D39453





More information about the llvm-commits mailing list