[PATCH] D118102: [LoopInterchange] WIP: Prevent interchange with unsafe control-flow divergence inside inner loops (PR48057)

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 8 18:09:19 PST 2022


congzhe added a comment.

In D118102#3306204 <https://reviews.llvm.org/D118102#3306204>, @Meinersbur wrote:

> In D118102#3305242 <https://reviews.llvm.org/D118102#3305242>, @congzhe wrote:
>
>> I've updated the check so I could detect the output dependency now (patch not updated yet).
>
> I don't see the update yet.

Updated the patch for now, such that during dependence analysis in loop interchange, it takes into account a store instruction with itself, thus can determine the output dependency. If we detect a "Scalar" output dependency under control-flow divergence, we would just bail.

Nevertheless this change exposed another problem. It fails three lit test cases under loop interchange: `lcssa-preheader.ll`, `perserve-lcssa.ll`, `pr45743-move-from-inner-preheader.ll`. They fail because there is a store instruction inside the innermost loop like this:

  ; inside the inner loop, @Array is a 2D array
  %Address  = gep @Array, 0, InnerIndvar, OuterIndvar
  store 0,  %Address

We should be able to analyze that there is no output dependency between this `store` and itself since all direction vector should be an all-zero vector. However, da returns "* *" for this output dependency and we bail from loop interchange, which we should not.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118102/new/

https://reviews.llvm.org/D118102



More information about the llvm-commits mailing list