[llvm] [LoopInterchange] Exit early in certain cases in legality check (NFC) (PR #139254)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 05:38:39 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/Scalar/LoopInterchange.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
index e5178a27f..cca27e07b 100644
--- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
@@ -236,9 +236,9 @@ static void interChangeDependencies(CharMatrix &DepMatrix, unsigned FromIndx,
 // [Theorem] A permutation of the loops in a perfect nest is legal if and only
 // if the direction matrix, after the same permutation is applied to its
 // columns, has no ">" direction as the leftmost non-"=" direction in any row.
-static std::optional<bool> isLexicographicallyPositive(std::vector<char> &DV,
-                                                       unsigned Begin = 0,
-                                                       unsigned End = DV.size()) {
+static std::optional<bool>
+isLexicographicallyPositive(std::vector<char> &DV, unsigned Begin = 0,
+                            unsigned End = DV.size()) {
   ArrayRef<char> DVRef(DV);
   for (unsigned char Direction : DVRef.slice(Begin, End - Begin)) {
     if (Direction == '<')
@@ -261,8 +261,9 @@ static bool isLegalToInterChangeLoops(CharMatrix &DepMatrix,
     // before and after swapping OuterLoop vs InnerLoop
     Cur = DepMatrix[Row];
 
-    // 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.
+    // 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.
     if (isLexicographicallyPositive(Cur, 0, OuterLoopId) == true)
       continue;
 

``````````

</details>


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


More information about the llvm-commits mailing list