[llvm] [CodeGen] Fix profiled triangular CFG threshold in MachineBlockPlacement (PR #188752)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 07:12:47 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/MachineBlockPlacement.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/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index 7a6d90a68..73d040bda 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -1453,8 +1453,8 @@ getLayoutSuccessorProbThreshold(const MachineBasicBlock *BB) {
        *   (1-T) * Prob(BB->Succ) > T * Prob(BB->Pred)
        *   So T / (1 - T) = 2, Yielding T = 2/3
        *
-       * Then remap the user-controlled ProfileLikelyProb into 
-       * a triangle-specific threshold T. 
+       * Then remap the user-controlled ProfileLikelyProb into
+       * a triangle-specific threshold T.
        *   T = (2/3) * (ProfileLikelyProb / 50)
        *     = (2 * ProfileLikelyProb) / 150
        * This preserves T = 2/3 at ProfileLikelyProb = 50.

``````````

</details>


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


More information about the llvm-commits mailing list