[llvm] [LoopNestAnalysis] Change the definition of perfect loop nest (NFC) (PR #206077)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 08:15:40 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/Analysis/LoopNestAnalysis.cpp llvm/unittests/Analysis/LoopNestTest.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/unittests/Analysis/LoopNestTest.cpp b/llvm/unittests/Analysis/LoopNestTest.cpp
index 2ef76af6e..8940edfac 100644
--- a/llvm/unittests/Analysis/LoopNestTest.cpp
+++ b/llvm/unittests/Analysis/LoopNestTest.cpp
@@ -51,33 +51,33 @@ static Instruction *getInstructionByName(Function &F, StringRef Name) {
 
 TEST(LoopNestTest, PerfectLoopNest) {
   const char *ModuleStr =
-    "target datalayout = \"e-m:o-i64:64-f80:128-n8:16:32:64-S128\"\n"
-    "define void @foo(i64 signext %nx, i64 signext %ny) {\n"
-    "entry:\n"
-    "  br label %for.outer\n"
-    "for.outer:\n"
-    "  %i = phi i64 [ 0, %entry ], [ %inc13, %for.outer.latch ]\n"
-    "  br label %for.inner.preheader\n"
-    "for.inner.preheader:\n"
-    "  br label %for.inner\n"
-    "for.inner:\n"
-    "  %j = phi i64 [ 0, %for.inner.preheader ], [ %inc, %for.inner.latch ]\n"
-    "  br label %for.inner.latch\n"
-    "for.inner.latch:\n"
-    "  %inc = add nsw i64 %j, 1\n"
-    "  %cmp2 = icmp slt i64 %inc, %ny\n"
-    "  br i1 %cmp2, label %for.inner, label %for.inner.exit\n"
-    "for.inner.exit:\n"
-    "  br label %for.outer.latch\n"
-    "for.outer.latch:\n"
-    "  %inc13 = add nsw i64 %i, 1\n"
-    "  %cmp = icmp slt i64 %inc13, %nx\n"
-    "  br i1 %cmp, label %for.outer, label %for.outer.exit\n"
-    "for.outer.exit:\n"
-    "  br label %for.end\n"
-    "for.end:\n"
-    "  ret void\n"
-    "}\n";
+      "target datalayout = \"e-m:o-i64:64-f80:128-n8:16:32:64-S128\"\n"
+      "define void @foo(i64 signext %nx, i64 signext %ny) {\n"
+      "entry:\n"
+      "  br label %for.outer\n"
+      "for.outer:\n"
+      "  %i = phi i64 [ 0, %entry ], [ %inc13, %for.outer.latch ]\n"
+      "  br label %for.inner.preheader\n"
+      "for.inner.preheader:\n"
+      "  br label %for.inner\n"
+      "for.inner:\n"
+      "  %j = phi i64 [ 0, %for.inner.preheader ], [ %inc, %for.inner.latch ]\n"
+      "  br label %for.inner.latch\n"
+      "for.inner.latch:\n"
+      "  %inc = add nsw i64 %j, 1\n"
+      "  %cmp2 = icmp slt i64 %inc, %ny\n"
+      "  br i1 %cmp2, label %for.inner, label %for.inner.exit\n"
+      "for.inner.exit:\n"
+      "  br label %for.outer.latch\n"
+      "for.outer.latch:\n"
+      "  %inc13 = add nsw i64 %i, 1\n"
+      "  %cmp = icmp slt i64 %inc13, %nx\n"
+      "  br i1 %cmp, label %for.outer, label %for.outer.exit\n"
+      "for.outer.exit:\n"
+      "  br label %for.end\n"
+      "for.end:\n"
+      "  ret void\n"
+      "}\n";
 
   LLVMContext Context;
   std::unique_ptr<Module> M = makeLLVMModule(Context, ModuleStr);

``````````

</details>


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


More information about the llvm-commits mailing list