[PATCH] D137461: [LoopInterchange] Refactor and rewrite validDepInterchange()

MengXuan Cai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 11:33:06 PST 2022


Narutoworld marked an inline comment as done.
Narutoworld added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:207-210
     char InnerDep = DepMatrix[Row][InnerLoopId];
     char OuterDep = DepMatrix[Row][OuterLoopId];
     if (InnerDep == '*' || OuterDep == '*')
       return false;
----------------
Meinersbur wrote:
> I think this logic here is also superseded by the new logic.
Hi @Meinersbur, Thanks for your comment.

The logic says if any dependency vector of InnerLoop or OuterLoop is unknown, it is not legal to do interchange.
And the function `isLexicographicallyPositive()` only checked the direction vector after potential interchage. 

Suppose we have a dependency direction vector (*, <, =) for 3 layers loop, i, j, k. and we want to check if we can interchange loop i, j.

The original code will prohibit interchange since `i-Dep is *`.

However, with `isLexicographicallyPositive()`, the temp dependency direction vector is (<,*,=), which makes it a valid interchange candidate.
Although I can add more codes to force the same logic, (checking the interchanged position has a * ), it contains logic beyond checking **Lexicographical Order** only. 

That is the reason why I would like to keep the original code.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137461



More information about the llvm-commits mailing list