[llvm] [LoopSimplifyCFG] Add check for missing loop preheader (PR #149743)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 09:21:51 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/LoopSimplifyCFG.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
index c63578c63..b9546c5fa 100644
--- a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -222,9 +222,11 @@ private:
     // wasn't able to form one because the loop can be entered through an
     // indirectbr we cannot continue.
     if (!L.getLoopPreheader()) {
-      assert(any_of(predecessors(L.getHeader()), [&](BasicBlock *Pred) {
-        return isa<IndirectBrInst>(Pred->getTerminator());
-      }) && "Loop should have preheader if it is not entered indirectly");
+      assert(any_of(predecessors(L.getHeader()),
+                    [&](BasicBlock *Pred) {
+                      return isa<IndirectBrInst>(Pred->getTerminator());
+                    }) &&
+             "Loop should have preheader if it is not entered indirectly");
       HasIndirectEntry = true;
       return;
     }

``````````

</details>


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


More information about the llvm-commits mailing list