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

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 07:16:53 PST 2022


Meinersbur added a comment.

testcase <https://reviews.llvm.org/file/data/djr5c2jm67s4ejikk6a7/PHID-FILE-wmeppydlvqc2ag2awnkj/meme-test_case>



================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:1175-1176
                                     InnerLoop->getHeader())
            << "Interchanging loops is too costly and it does not improve "
               "parallelism.";
   });
----------------
Consider updating this message. Suggestion: "Interchanging loops not considered to improve cache locality nor vectorization."


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:1166
+  // analyze the loopnest (e.g., due to delinearization issues).
+  if (CostMap.find(InnerLoop) == CostMap.end() || CostMap.find(OuterLoop) != CostMap.end() ||
+     (CC && CC->getLoopCost(*InnerLoop) == CC->getLoopCost(*OuterLoop))) {
----------------
ram-NK wrote:
> congzhe wrote:
> > 
> Corrected the condition. any of the loop is failed to determine the loop nest and equal locality then only checks the profit of vectorization.
This is exactly the else branch of the cache analysis logic. It does not consider the fallback `Cost < -LoopInterchangeCostThreshold` legacy cost model. Please avoid the code duplication and needing to loop up the `CostMap` again.


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

https://reviews.llvm.org/D135808



More information about the llvm-commits mailing list