[llvm] [LoopInterchange] Exit early in certain cases in legality check (NFC) (PR #139254)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 05:28:55 PDT 2025
================
@@ -256,10 +260,19 @@ static bool isLegalToInterChangeLoops(CharMatrix &DepMatrix,
// Create temporary DepVector check its lexicographical order
// before and after swapping OuterLoop vs InnerLoop
Cur = DepMatrix[Row];
- if (!isLexicographicallyPositive(Cur))
+
+ // If the direction vector is lexicographically positive due to an element
+ // to the left of OuterLoopId, it is still positive after exchanging the two
+ // loops. In such a case we can skip the subsequent check.
----------------
Meinersbur wrote:
```suggestion
// If the surrounding loops already ensure that the direction vector is lexicographically positive, nothing within the loop will be able to break the dependence.
// In such a case we can skip the subsequent check.
```
https://github.com/llvm/llvm-project/pull/139254
More information about the llvm-commits
mailing list