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

Ramkrishnan Narayanan Komala via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 10:24:35 PDT 2022


ram-NK updated this revision to Diff 468607.
ram-NK added a comment.

> I'm worried about losing functional coverage by avoiding interchange here due to profitability. Can you play with -loop-interchange-threshold or make slight changes to the memory accesses to make the test case profitable?

Reverted the changes in pr43797-lcssa-for-multiple-outer-loop-blocks.ll. In this case, CostMap is empty and calculated legacy cost is 0. For retaining the loop interchange functionality, lowered the loop interchange threshold to -1000 (added -loop-interchange-threshold=-1000).


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

https://reviews.llvm.org/D135808

Files:
  llvm/lib/Transforms/Scalar/LoopInterchange.cpp
  llvm/test/Transforms/LoopInterchange/pr43797-lcssa-for-multiple-outer-loop-blocks.ll


Index: llvm/test/Transforms/LoopInterchange/pr43797-lcssa-for-multiple-outer-loop-blocks.ll
===================================================================
--- llvm/test/Transforms/LoopInterchange/pr43797-lcssa-for-multiple-outer-loop-blocks.ll
+++ llvm/test/Transforms/LoopInterchange/pr43797-lcssa-for-multiple-outer-loop-blocks.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -loop-interchange -cache-line-size=64 -verify-loop-lcssa -S %s | FileCheck %s
+; RUN: opt -loop-interchange -cache-line-size=64 -loop-interchange-threshold=-1000 -verify-loop-lcssa -S %s | FileCheck %s
 
 ; Tests for PR43797.
 
Index: llvm/lib/Transforms/Scalar/LoopInterchange.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopInterchange.cpp
+++ llvm/lib/Transforms/Scalar/LoopInterchange.cpp
@@ -1117,10 +1117,10 @@
   // If the inner loop is loop independent or doesn't carry any dependency it is
   // profitable to move this to outer position.
   for (auto &Row : DepMatrix) {
-    if (Row[InnerLoopId] != 'S' && Row[InnerLoopId] != 'I')
+    if (Row[InnerLoopId] != 'I' && Row[InnerLoopId] != '=')
       return false;
     // TODO: We need to improve this heuristic.
-    if (Row[OuterLoopId] != '=')
+    if (Row[OuterLoopId] == '=')
       return false;
   }
   // If outer loop has dependence and inner loop is loop independent then it is


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135808.468607.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221018/2cc3c2a3/attachment.bin>


More information about the llvm-commits mailing list