[llvm] Think in terms of blocks for ARC (PR #130860)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 11 15:54:55 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 701148f05a7b90ed6b8c4fc38db4c2b0c9241ffc 50c7e464f8f1e8f9028563856732869199e07cb8 --extensions cpp -- llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
index 1c19743880..60bd238476 100644
--- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
+++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
@@ -1765,7 +1765,7 @@ void ObjCARCOpt::MoveCalls(Value *Arg, RRInfo &RetainsToMove,
for (Instruction *InsertPt : RetainsToMove.ReverseInsertPts) {
BasicBlock *BB = InsertPt->getParent();
BasicBlock *Pred = BB->getUniquePredecessor();
-
+
// If this is a critical edge, split it
if (!Pred && BB->hasNPredecessors(1)) {
for (BasicBlock *PredBB : predecessors(BB)) {
@@ -1780,13 +1780,13 @@ void ObjCARCOpt::MoveCalls(Value *Arg, RRInfo &RetainsToMove,
NewRetainInsertPts.push_back(InsertPt);
}
}
-
+
// Then handle critical edges for release insertion points
SmallVector<Instruction *, 4> NewReleaseInsertPts;
for (Instruction *InsertPt : ReleasesToMove.ReverseInsertPts) {
BasicBlock *BB = InsertPt->getParent();
BasicBlock *Pred = BB->getUniquePredecessor();
-
+
// If this is a critical edge, split it
if (!Pred && BB->hasNPredecessors(1)) {
for (BasicBlock *PredBB : predecessors(BB)) {
@@ -2534,16 +2534,16 @@ BasicBlock *ObjCARCOpt::SplitCriticalEdge(BasicBlock *Pred, BasicBlock *Succ) {
if (Succ->isLandingPad() || isa<InvokeInst>(Pred->getTerminator()))
return nullptr;
- // We need both multiple successors in predecessor and
+ // We need both multiple successors in predecessor and
// multiple predecessors in successor
- if (Pred->getTerminator()->getNumSuccessors() <= 1 ||
+ if (Pred->getTerminator()->getNumSuccessors() <= 1 ||
Succ->getUniquePredecessor())
return nullptr;
// Create a new basic block for the split edge
- BasicBlock *NewBB = BasicBlock::Create(Pred->getContext(),
- Pred->getName() + "." + Succ->getName() + ".arc",
- Pred->getParent());
+ BasicBlock *NewBB = BasicBlock::Create(
+ Pred->getContext(), Pred->getName() + "." + Succ->getName() + ".arc",
+ Pred->getParent());
// Update the terminator of Pred to branch to NewBB instead of Succ
BranchInst *Term = cast<BranchInst>(Pred->getTerminator());
``````````
</details>
https://github.com/llvm/llvm-project/pull/130860
More information about the llvm-commits
mailing list