[PATCH] D76132: [LoopUnrollAndJam] Changed safety checks to consider more than 2-levels loop nest.

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 28 05:23:18 PDT 2020


Whitney added a comment.

> Consider a case where the dependency in the i-loop is GE:
> 
>   for i
>     for j        <= unroll loop
>      for k
>         A[i][j][k]>
>         A[c ? i : i-1][j-1][k]
>   
>   Here S2 conditionally accessed the element from the previous i-iteration or the same, depending on `c`. Thus the possibility of "EQ" requires us to check further.

Thanks for your reply.
I am still confused. Your version only allow GT (by checking == GT). My version only allow GT, LT, NE (by checking ! &EQ). So both versions requires us to check further with GE.
I was trying to use

  for i
    for j        <= unroll loop
      for k
         S1: A[i][j][k]
         S2: A[i-1][j+1][k-1]

as an example, where your version would consider as unsafe and my version would consider as safe.
Am I correct to think loop-j is safe to unroll and jam?
If yes, do you have an example where LT or NE for loop-i should be considered as unsafe for unroll and jam loop-j?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76132





More information about the llvm-commits mailing list