[llvm] [StructurizeCFG] Order IF Else block using Heuristics (PR #139605)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 11:41:59 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/StructurizeCFG.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
index 924f271df..30f86bdd6 100644
--- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -441,7 +441,7 @@ INITIALIZE_PASS_END(StructurizeCFGLegacyPass, "structurizecfg",
                     "Structurize the CFG", false, false)
 
 /// Then and Else block order in SCC is arbitrary. But based on the
-/// order, after structurization there are cases where there might be extra 
+/// order, after structurization there are cases where there might be extra
 /// VGPR copies due to interference during register coelescing.
 ///  eg:- incoming phi values from Else block contains only vgpr copies and
 ///  incoming phis in Then block has are some modification for the vgprs.
@@ -451,9 +451,9 @@ INITIALIZE_PASS_END(StructurizeCFGLegacyPass, "structurizecfg",
 ///
 /// This function checks the incoming phi values in the merge block and
 /// orders based on the following heuristics  of Then and Else block. Checks
-/// whether an incoming phi can be potential copy instructions and if so 
-/// checks whether copy within the block or not. 
-/// Increases score if its a potential copy from outside the block. 
+/// whether an incoming phi can be potential copy instructions and if so
+/// checks whether copy within the block or not.
+/// Increases score if its a potential copy from outside the block.
 /// the higher scored block is ordered first.
 void StructurizeCFG::reorderIfElseBlock(BasicBlock *BB, unsigned Idx) {
   BranchInst *Term = dyn_cast<BranchInst>(BB->getTerminator());

``````````

</details>


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


More information about the llvm-commits mailing list