[llvm] [ControlFlowHub] Add support for switch-based guards (PR #213549)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 2 08:02:00 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,h -- llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h llvm/include/llvm/Transforms/Utils/FixIrreducible.h llvm/include/llvm/Transforms/Utils/UnifyLoopExits.h llvm/lib/Passes/PassBuilder.cpp llvm/lib/Transforms/Utils/ControlFlowUtils.cpp llvm/lib/Transforms/Utils/FixIrreducible.cpp llvm/lib/Transforms/Utils/UnifyLoopExits.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/include/llvm/Transforms/Utils/ControlFlowUtils.h b/llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h
index 93558a135..f2dc38f76 100644
--- a/llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h
@@ -35,8 +35,8 @@ class DomTreeUpdater;
/// guard blocks are returned in the argument vector `GuardBlocks`.
///
/// In the case of a switch guard, the hub consists only of a single guard block
-/// containing a switch instruction that branches to all outgoing blocks (with an
-/// unreachable default destination). `GuardBlocks` will contain this single
+/// containing a switch instruction that branches to all outgoing blocks (with
+/// an unreachable default destination). `GuardBlocks` will contain this single
/// guard block.
///
/// This also updates any PHINodes in the successor. For each such PHINode, the
diff --git a/llvm/lib/Transforms/Utils/UnifyLoopExits.cpp b/llvm/lib/Transforms/Utils/UnifyLoopExits.cpp
index a0f78a99b..56162d1de 100644
--- a/llvm/lib/Transforms/Utils/UnifyLoopExits.cpp
+++ b/llvm/lib/Transforms/Utils/UnifyLoopExits.cpp
@@ -147,7 +147,8 @@ static void restoreSSA(const DominatorTree &DT, const Loop *L,
}
}
-static bool unifyLoopExits(DominatorTree &DT, LoopInfo &LI, Loop *L, bool SwitchGuards) {
+static bool unifyLoopExits(DominatorTree &DT, LoopInfo &LI, Loop *L,
+ bool SwitchGuards) {
// To unify the loop exits, we need a list of the exiting blocks as
// well as exit blocks. The functions for locating these lists both
// traverse the entire loop body. It is more efficient to first
``````````
</details>
https://github.com/llvm/llvm-project/pull/213549
More information about the llvm-commits
mailing list