[llvm] [CodeGenPrepare] Extend SimplifyCFG to lower s/ucmp + 3-arm switch (PR #223268)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 12:01:30 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/CodeGen/CodeGenPrepare.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/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 431234d99..72fa0d73a 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -8102,8 +8102,8 @@ bool CodeGenPrepare::optimizeSwitchOfCmpIntrinsic(SwitchInst *SI) {
CmpInst::Predicate Pred = Result < 0 ? Cmp->getLTPredicate()
: Result > 0 ? Cmp->getGTPredicate()
: CmpInst::ICMP_EQ;
- Arms.push_back({Dest, Pred, BPI->getEdgeProbability(SwitchBB, Index),
- Weights[Index]});
+ Arms.push_back(
+ {Dest, Pred, BPI->getEdgeProbability(SwitchBB, Index), Weights[Index]});
};
// The results -1, 0 and 1 sum to zero, so with two cases the default takes
@@ -8123,7 +8123,6 @@ bool CodeGenPrepare::optimizeSwitchOfCmpIntrinsic(SwitchInst *SI) {
// Test the most likely arm first.
stable_sort(Arms, [](const Arm &A, const Arm &B) { return A.Prob > B.Prob; });
-
// Check if any BBs contain a loop backedge.
MDNode *LoopMD = SI->getMetadata(LLVMContext::MD_loop);
auto IsBackedge = [&](const Arm &A) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/223268
More information about the llvm-commits
mailing list