[llvm-branch-commits] [llvm] [LoopInterchange] Reject if outer reduction value has extra user (PR #203241)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 11 03:54:09 PDT 2026


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 origin/main HEAD --extensions cpp -- llvm/lib/Transforms/Scalar/LoopInterchange.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</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 5e0af6fe7..c96dfc102 100644
--- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
@@ -1281,21 +1281,23 @@ bool LoopInterchangeLegality::checkInductionsAndReductions(Loop *OuterLoop) {
           return false;
         }
 
-        // Reject if PHI has users other than InnerRedPhi. The typical case is as follows:
+        // Reject if PHI has users other than InnerRedPhi. The typical case is
+        // as follows:
         //
         //   o.header:
         //     %red.o = phi [ 0, ... ], [ %red.next, %o.latch ]
         //     br label %i.header
-        //  
+        //
         //   i.header:
         //     %red.i = phi [ %red.o, %o.header ], [ %red.next, %i.latch ]
         //     br label %i.body
-        //  
+        //
         //   i.body:
         //     store %red.o to %mem
         //     ...
-        // 
-        if (!all_of(PHI.users(), [InnerRedPhi](User *U) { return U == InnerRedPhi; }))
+        //
+        if (!all_of(PHI.users(),
+                    [InnerRedPhi](User *U) { return U == InnerRedPhi; }))
           return false;
 
         OuterInnerReductions.insert(&PHI);

``````````

</details>


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


More information about the llvm-branch-commits mailing list