Skip to content

Commit 3c5e96b

Browse files
committed
implement NFC feedback
1 parent 691bb41 commit 3c5e96b

File tree

5 files changed

+143
-109
lines changed

5 files changed

+143
-109
lines changed

llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ LLVM_ABI void InvertBranch(BranchInst *PBI, IRBuilderBase &Builder);
612612
// br/brcond/unreachable/ret
613613
LLVM_ABI bool hasOnlySimpleTerminator(const Function &F);
614614

615-
LLVM_ABI Printable printBBPtr(const BasicBlock *BB);
615+
LLVM_ABI Printable printBasicBlock(const BasicBlock *BB);
616616

617617
} // end namespace llvm
618618

llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ bool llvm::hasOnlySimpleTerminator(const Function &F) {
17761776
return true;
17771777
}
17781778

1779-
Printable llvm::printBBPtr(const BasicBlock *BB) {
1779+
Printable llvm::printBasicBlock(const BasicBlock *BB) {
17801780
return Printable([BB](raw_ostream &OS) {
17811781
if (BB)
17821782
return BB->printAsOperand(OS);

llvm/lib/Transforms/Utils/FixIrreducible.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,10 @@ static bool fixIrreducible(Cycle &C, CycleInfo &CI, DominatorTree &DT,
299299
assert(Succ0 || Succ1);
300300
CHub.addBranch(P, Succ0, Succ1);
301301

302-
LLVM_DEBUG(dbgs() << "Added internal branch: " << printBBPtr(P) << " -> "
303-
<< printBBPtr(Succ0) << (Succ0 && Succ1 ? " " : "")
304-
<< printBBPtr(Succ1) << "\n");
302+
LLVM_DEBUG(dbgs() << "Added internal branch: " << printBasicBlock(P)
303+
<< " -> " << printBasicBlock(Succ0)
304+
<< (Succ0 && Succ1 ? " " : "") << printBasicBlock(Succ1)
305+
<< "\n");
305306
} else if (CallBrInst *CallBr = dyn_cast<CallBrInst>(P->getTerminator())) {
306307
for (unsigned I = 0; I < CallBr->getNumSuccessors(); ++I) {
307308
BasicBlock *Succ = CallBr->getSuccessor(I);
@@ -310,8 +311,9 @@ static bool fixIrreducible(Cycle &C, CycleInfo &CI, DominatorTree &DT,
310311
BasicBlock *NewSucc = ControlFlowHub::createCallBrTarget(
311312
CallBr, Succ, I, /* AttachToCallBr = */ false, &CI, &DTU, LI);
312313
CHub.addBranch(NewSucc, Succ);
313-
LLVM_DEBUG(dbgs() << "Added internal branch: " << printBBPtr(NewSucc)
314-
<< " -> " << printBBPtr(Succ) << "\n");
314+
LLVM_DEBUG(dbgs() << "Added internal branch: "
315+
<< printBasicBlock(NewSucc) << " -> "
316+
<< printBasicBlock(Succ) << "\n");
315317
}
316318
} else {
317319
llvm_unreachable("unsupported block terminator");
@@ -336,9 +338,10 @@ static bool fixIrreducible(Cycle &C, CycleInfo &CI, DominatorTree &DT,
336338
Succ1 = Succ1 && C.contains(Succ1) ? Succ1 : nullptr;
337339
CHub.addBranch(P, Succ0, Succ1);
338340

339-
LLVM_DEBUG(dbgs() << "Added external branch: " << printBBPtr(P) << " -> "
340-
<< printBBPtr(Succ0) << (Succ0 && Succ1 ? " " : "")
341-
<< printBBPtr(Succ1) << "\n");
341+
LLVM_DEBUG(dbgs() << "Added external branch: " << printBasicBlock(P)
342+
<< " -> " << printBasicBlock(Succ0)
343+
<< (Succ0 && Succ1 ? " " : "") << printBasicBlock(Succ1)
344+
<< "\n");
342345
} else if (CallBrInst *CallBr = dyn_cast<CallBrInst>(P->getTerminator())) {
343346
for (unsigned I = 0; I < CallBr->getNumSuccessors(); ++I) {
344347
BasicBlock *Succ = CallBr->getSuccessor(I);
@@ -347,8 +350,9 @@ static bool fixIrreducible(Cycle &C, CycleInfo &CI, DominatorTree &DT,
347350
BasicBlock *NewSucc = ControlFlowHub::createCallBrTarget(
348351
CallBr, Succ, I, /* AttachToCallBr = */ true, &CI, &DTU, LI);
349352
CHub.addBranch(NewSucc, Succ);
350-
LLVM_DEBUG(dbgs() << "Added external branch: " << printBBPtr(NewSucc)
351-
<< " -> " << printBBPtr(Succ) << "\n");
353+
LLVM_DEBUG(dbgs() << "Added external branch: "
354+
<< printBasicBlock(NewSucc) << " -> "
355+
<< printBasicBlock(Succ) << "\n");
352356
}
353357
} else {
354358
llvm_unreachable("unsupported block terminator");

llvm/lib/Transforms/Utils/UnifyLoopExits.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
// Limitation: This assumes that all terminators in the CFG are direct branches
1414
// (the "br" instruction). The presence of any other control flow
15-
// such as indirectbr ot switch will cause an assert.
15+
// such as indirectbr or switch will cause an assert.
1616
// The callbr terminator is supported by creating intermediate
1717
// target blocks that unconditionally branch to the original target
1818
// blocks. These intermediate target blocks can then be redirected
@@ -170,9 +170,10 @@ static bool unifyLoopExits(DominatorTree &DT, LoopInfo &LI, Loop *L) {
170170
Succ1 = L->contains(Succ1) ? nullptr : Succ1;
171171
CHub.addBranch(BB, Succ0, Succ1);
172172

173-
LLVM_DEBUG(dbgs() << "Added extiting branch: " << printBBPtr(BB) << " -> "
174-
<< printBBPtr(Succ0) << (Succ0 && Succ1 ? " " : "")
175-
<< printBBPtr(Succ1) << "\n");
173+
LLVM_DEBUG(dbgs() << "Added extiting branch: " << printBasicBlock(BB)
174+
<< " -> " << printBasicBlock(Succ0)
175+
<< (Succ0 && Succ1 ? " " : "") << printBasicBlock(Succ1)
176+
<< "\n");
176177
} else if (CallBrInst *CallBr = dyn_cast<CallBrInst>(BB->getTerminator())) {
177178
for (unsigned J = 0; J < CallBr->getNumSuccessors(); ++J) {
178179
BasicBlock *Succ = CallBr->getSuccessor(J);
@@ -187,8 +188,9 @@ static bool unifyLoopExits(DominatorTree &DT, LoopInfo &LI, Loop *L) {
187188
// themselves.
188189
ExitingBlocks[I] = NewSucc;
189190
CHub.addBranch(NewSucc, Succ);
190-
LLVM_DEBUG(dbgs() << "Added exiting branch: " << printBBPtr(NewSucc)
191-
<< " -> " << printBBPtr(Succ) << "\n");
191+
LLVM_DEBUG(dbgs() << "Added exiting branch: "
192+
<< printBasicBlock(NewSucc) << " -> "
193+
<< printBasicBlock(Succ) << "\n");
192194
// Also add the new target block to the list of exiting blocks that
193195
// should later be added to the parent loops.
194196
CallBrTargetBlocks.push_back(NewSucc);

0 commit comments

Comments
 (0)