[llvm] [LoopInterchange] Improve profitability check for vectorization (PR #133672)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 07:57:43 PDT 2025


================
@@ -276,11 +320,12 @@ static bool isLegalToInterChangeLoops(CharMatrix &DepMatrix,
       continue;
 
     // Check if the direction vector is lexicographically positive (or zero)
-    // for both before/after exchanged.
-    if (isLexicographicallyPositive(Cur, OuterLoopId, Cur.size()) == false)
+    // for both before/after exchanged. Ignore the last element because it
+    // doesn't affect the legality.
----------------
Meinersbur wrote:

[not a change request] This is probably true for anything inside `InnerLoopId` as well, but historically we checked the inner vector as well, like we do check dependencies before the interchange (which should tautologically be non-negative depdencence vectors)

https://github.com/llvm/llvm-project/pull/133672


More information about the llvm-commits mailing list