[llvm] [SimplifyCFG] Fold pairs of entries in multiple-entry phi (PR #73674)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 28 09:47:21 PST 2023
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 21361bb8605fd26a06312d80b9fb20a8b41c58ed e8f00600aa476ca9f498a875964bfd20c35396d5 -- llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h llvm/lib/Transforms/Utils/BasicBlockUtils.cpp llvm/lib/Transforms/Utils/FlattenCFG.cpp llvm/lib/Transforms/Utils/SimplifyCFG.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
index 998acbe9ab..588028cdff 100644
--- a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -596,7 +596,7 @@ void SplitBlockAndInsertForEachLane(
/// This does no checking to see if the true/false blocks have large or unsavory
/// instructions in them.
BranchInst *GetIfConditionFromMergePoint(BasicBlock *BB, BasicBlock *&IfTrue,
- BasicBlock *&IfFalse);
+ BasicBlock *&IfFalse);
/// Check whether BB is the dominant point of a if-region.
/// If so, return the merge point of the if-region. Also, return by references
@@ -606,7 +606,8 @@ BranchInst *GetIfConditionFromMergePoint(BasicBlock *BB, BasicBlock *&IfTrue,
/// This does no checking to see if the true/false blocks have large or unsavory
/// instructions in them.
///
-/// NOTE: we assume that the terminator of DomBB is a conditional branch instruction.
+/// NOTE: we assume that the terminator of DomBB is a conditional branch
+/// instruction.
BasicBlock *GetIfConditionFromDom(BasicBlock *DomBB, BasicBlock *&IfTrue,
BasicBlock *&IfFalse);
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index d43a5f7284..f1ceab4d55 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -1727,8 +1727,9 @@ void llvm::SplitBlockAndInsertForEachLane(
}
}
-BranchInst *llvm::GetIfConditionFromMergePoint(BasicBlock *BB, BasicBlock *&IfTrue,
- BasicBlock *&IfFalse) {
+BranchInst *llvm::GetIfConditionFromMergePoint(BasicBlock *BB,
+ BasicBlock *&IfTrue,
+ BasicBlock *&IfFalse) {
PHINode *SomePHI = dyn_cast<PHINode>(BB->begin());
BasicBlock *Pred1 = nullptr;
BasicBlock *Pred2 = nullptr;
@@ -1821,7 +1822,7 @@ BranchInst *llvm::GetIfConditionFromMergePoint(BasicBlock *BB, BasicBlock *&IfTr
BasicBlock *llvm::GetIfConditionFromDom(BasicBlock *DomBB, BasicBlock *&IfTrue,
BasicBlock *&IfFalse) {
- BranchInst* BI = cast<BranchInst>(DomBB->getTerminator());
+ BranchInst *BI = cast<BranchInst>(DomBB->getTerminator());
BasicBlock *Succ1 = BI->getSuccessor(0);
BasicBlock *Succ2 = BI->getSuccessor(1);
diff --git a/llvm/lib/Transforms/Utils/FlattenCFG.cpp b/llvm/lib/Transforms/Utils/FlattenCFG.cpp
index 4480202bae..08fbcef5cd 100644
--- a/llvm/lib/Transforms/Utils/FlattenCFG.cpp
+++ b/llvm/lib/Transforms/Utils/FlattenCFG.cpp
@@ -420,7 +420,8 @@ bool FlattenCFGOpt::MergeIfRegion(BasicBlock *BB, IRBuilder<> &Builder) {
return false;
BasicBlock *IfTrue1, *IfFalse1;
- BranchInst *DomBI1 = GetIfConditionFromMergePoint(SecondEntryBlock, IfTrue1, IfFalse1);
+ BranchInst *DomBI1 =
+ GetIfConditionFromMergePoint(SecondEntryBlock, IfTrue1, IfFalse1);
if (!DomBI1)
return false;
Instruction *CInst1 = dyn_cast<Instruction>(DomBI1->getCondition());
``````````
</details>
https://github.com/llvm/llvm-project/pull/73674
More information about the llvm-commits
mailing list