Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,24 @@ bool ARMBaseInstrInfo::analyzeBranch(MachineBasicBlock &MBB,
// to clean up any instructions at the tail of the basic block.
CantAnalyze = true;
} else if (isUncondBranchOpcode(I->getOpcode())) {
// Record the fall-through target.
TBB = I->getOperand(0).getMBB();
if (AllowModify && !isPredicated(*I) && TBB &&
MBB.isLayoutSuccessor(TBB)) {
// Remove the fall-through unconditional branch and continue the
// backward scan from the previous instruction. The normal scanning
// logic will classify whatever remains (including fall-through
// conditional branches) consistently with the rest of this function.
auto After = I;
if (After == MBB.instr_begin()) {
I->eraseFromParent();
return false; // Empty of terminators: falls through.
}
auto Prev = std::prev(After);
I->eraseFromParent();
I = Prev;
continue;
}
} else if (isCondBranchOpcode(I->getOpcode())) {
// Bail out if we encounter multiple conditional branches.
if (!Cond.empty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ body: |
; CHECK-NEXT: t2CMPri $sp, 34, 14 /* CC::al */, $noreg, implicit-def $cpsr
; CHECK-NEXT: t2Bcc %bb.2, 1 /* CC::ne */, $cpsr
; CHECK-NEXT: t2Bcc %bb.2, 2 /* CC::hs */, killed $cpsr
; CHECK-NEXT: t2B %bb.1, 14 /* CC::al */, $noreg
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.1:
; CHECK-NEXT: INLINEASM &"", 1 /* sideeffect attdialect */
Expand Down
Loading