[PATCH] D135808: [LoopInterchange] Correcting the profitability checking for vectorization

Ramkrishnan Narayanan Komala via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 14:01:13 PDT 2022


ram-NK marked 2 inline comments as done.
ram-NK added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:1116-1118
   // TODO: Improve this heuristic to catch more cases.
   // If the inner loop is loop independent or doesn't carry any dependency it is
   // profitable to move this to outer position.
----------------
Meinersbur wrote:
> Does you patch cover this TODO?
Corrected the dependency checking and corrected the comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:1120-1123
+    if (Row[InnerLoopId] != 'I' && Row[InnerLoopId] != '=')
       return false;
     // TODO: We need to improve this heuristic.
+    if (Row[OuterLoopId] == '=')
----------------
Meinersbur wrote:
> Shouldn't the condition on `Row[InnerLoopId]` and `Row[OuterLoopId]` be exact opposite? That is, it is profitable if the innermost loop has loop-carried dependencies while the outer has not?
Corrected the dependency check. If  inner loop has loop carried dependency and outer loop is loop independent then, loop interchange is considered as profitable for vectorization.  


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

https://reviews.llvm.org/D135808



More information about the llvm-commits mailing list