[llvm-branch-commits] [llvm] [profcheck][SimplifyCFG] Propagate !prof from `switch` to `select` (PR #159645)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Sep 18 13:18:02 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 origin/main HEAD --extensions cpp -- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
``````````

: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/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 276ca89d7..f775991b5 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -6357,7 +6357,7 @@ static Value *foldSwitchToSelect(const SwitchCaseResultVectorTy &ResultVector,
         setBranchWeights(SelectValueInst, BranchWeights[2],
                          BranchWeights[0] + BranchWeights[1],
                          /*IsExpected=*/false);
-        }
+      }
     }
     Value *ValueCompare =
         Builder.CreateICmpEQ(Condition, FirstCase, "switch.selectcmp");
@@ -6411,8 +6411,8 @@ static Value *foldSwitchToSelect(const SwitchCaseResultVectorTy &ResultVector,
           Value *And = Builder.CreateAnd(Condition, AndMask);
           Value *Cmp = Builder.CreateICmpEQ(
               And, Constant::getIntegerValue(And->getType(), AndMask));
-          SelectInst *Ret = cast<SelectInst>(Builder.CreateSelect(Cmp, ResultVector[0].first,
-                                      DefaultResult));
+          SelectInst *Ret = cast<SelectInst>(
+              Builder.CreateSelect(Cmp, ResultVector[0].first, DefaultResult));
           if (HasBranchWeights) {
             // We know there's a Default case. We base the resulting branch
             // weights off its probability.

``````````

</details>


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


More information about the llvm-branch-commits mailing list