[PATCH] D101825: [AMDGPU] Use standard MachineBasicBlock::getFallThrough method. NFCI.
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 4 03:16:37 PDT 2021
foad created this revision.
foad added reviewers: rampitec, alex-t.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
foad requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101825
Files:
llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
Index: llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
+++ llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
@@ -715,23 +715,6 @@
}
bool SILowerControlFlow::removeMBBifRedundant(MachineBasicBlock &MBB) {
- auto GetFallThroughSucc = [=](MachineBasicBlock *B) -> MachineBasicBlock * {
- auto *S = B->getNextNode();
- if (!S)
- return nullptr;
- if (B->isSuccessor(S)) {
- // The only fallthrough candidate
- MachineBasicBlock::iterator I(B->getFirstInstrTerminator());
- MachineBasicBlock::iterator E = B->end();
- for (; I != E; I++) {
- if (I->isBranch() && TII->getBranchDestBlock(*I) == S)
- // We have unoptimized branch to layout successor
- return nullptr;
- }
- }
- return S;
- };
-
for (auto &I : MBB.instrs()) {
if (!I.isDebugInstr() && !I.isUnconditionalBranch())
return false;
@@ -744,7 +727,7 @@
while (!MBB.predecessors().empty()) {
MachineBasicBlock *P = *MBB.pred_begin();
- if (GetFallThroughSucc(P) == &MBB)
+ if (P->getFallThrough() == &MBB)
FallThrough = P;
P->ReplaceUsesOfBlockWith(&MBB, Succ);
}
@@ -756,7 +739,7 @@
MBB.clear();
MBB.eraseFromParent();
if (FallThrough && !FallThrough->isLayoutSuccessor(Succ)) {
- if (!GetFallThroughSucc(Succ)) {
+ if (!Succ->canFallThrough()) {
MachineFunction *MF = FallThrough->getParent();
MachineFunction::iterator FallThroughPos(FallThrough);
MF->splice(std::next(FallThroughPos), Succ);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101825.342687.patch
Type: text/x-patch
Size: 1619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210504/0d1c2e22/attachment.bin>
More information about the llvm-commits
mailing list