Skip to content

Commit b7c7b42

Browse files
davemgreentstellar
authored andcommitted
[ARM] Use just ARM::t2B in ARMBlockPlacementPass
The ARMConstantIsland pass will convert any t2B to tB if they are within range after it has added or moved any constant pools. They don't need to be deliberately converted beforehand, and it doesn't deal with needing to convert tB to t2B very well.
1 parent d29ae44 commit b7c7b42

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Diff for: llvm/lib/Target/ARM/ARMBlockPlacement.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ bool ARMBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
145145
It++) {
146146
MachineBasicBlock *MBB = &*It;
147147
for (auto &Terminator : MBB->terminators()) {
148-
if (Terminator.getOpcode() != ARM::t2LoopEnd &&
149-
Terminator.getOpcode() != ARM::t2LoopEndDec)
148+
if (Terminator.getOpcode() != ARM::t2LoopEndDec)
150149
continue;
151150
MachineBasicBlock *LETarget = Terminator.getOperand(2).getMBB();
152151
// The LE will become forwards branching if it branches to LoopExit
@@ -204,10 +203,8 @@ void ARMBlockPlacement::moveBasicBlock(MachineBasicBlock *BB,
204203
if (!Terminator.isUnconditionalBranch()) {
205204
// The BB doesn't have an unconditional branch so it relied on
206205
// fall-through. Fix by adding an unconditional branch to the moved BB.
207-
unsigned BrOpc =
208-
BBUtils->isBBInRange(&Terminator, To, 254) ? ARM::tB : ARM::t2B;
209206
MachineInstrBuilder MIB =
210-
BuildMI(From, Terminator.getDebugLoc(), TII->get(BrOpc));
207+
BuildMI(From, Terminator.getDebugLoc(), TII->get(ARM::t2B));
211208
MIB.addMBB(To);
212209
MIB.addImm(ARMCC::CondCodes::AL);
213210
MIB.addReg(ARM::NoRegister);

Diff for: llvm/test/CodeGen/Thumb2/block-placement.mir

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ body: |
4848
; CHECK: bb.2:
4949
; CHECK: successors: %bb.3(0x80000000)
5050
; CHECK: t2WhileLoopStart killed renamable $r0, %bb.1, implicit-def dead $cpsr
51-
; CHECK: tB %bb.3, 14 /* CC::al */, $noreg
51+
; CHECK: t2B %bb.3, 14 /* CC::al */, $noreg
5252
; CHECK: bb.1:
5353
; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc
5454
; CHECK: bb.3:
@@ -145,7 +145,7 @@ body: |
145145
; CHECK: $lr = tMOVr $r0, 14 /* CC::al */, $noreg
146146
; CHECK: renamable $r0 = t2ADDrs killed renamable $r2, killed $r0, 18, 14 /* CC::al */, $noreg, $noreg
147147
; CHECK: t2WhileLoopStart killed renamable $lr, %bb.1, implicit-def dead $cpsr
148-
; CHECK: tB %bb.3, 14 /* CC::al */, $noreg
148+
; CHECK: t2B %bb.3, 14 /* CC::al */, $noreg
149149
; CHECK: bb.1:
150150
; CHECK: successors: %bb.4(0x80000000)
151151
; CHECK: tCMPi8 renamable $r1, 1, 14 /* CC::al */, $noreg, implicit-def $cpsr

0 commit comments

Comments
 (0)