summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-01-26 02:02:39 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-01-26 02:02:39 +0000
commit1e270b639d26f3b49dc5c0d88cdc433e08a4dd0f (patch)
tree1a483938c75b3c4a9fac5d931d8f3060ae8a4e34 /llvm/lib/Target/ARM
parent6a47b3c655d46ef84abd96e02d6d04d9adb5af96 (diff)
downloadbcm5719-llvm-1e270b639d26f3b49dc5c0d88cdc433e08a4dd0f.tar.gz
bcm5719-llvm-1e270b639d26f3b49dc5c0d88cdc433e08a4dd0f.zip
SplitBlockBeforeInstr() insert a unconditional branch to the next BB. This
is unnecessary when we are fixing up a conditional branch since we will be adding a unconditional branch to the destination of the original branch. llvm-svn: 33517
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r--llvm/lib/Target/ARM/ARMConstantIslandPass.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
index 62e47172e26..db50bde3849 100644
--- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -602,13 +602,17 @@ ARMConstantIslands::FixUpImmediateBranch(MachineFunction &Fn, ImmBranch &Br) {
// direct the updated conditional branch to the fall-through block. Otherwise,
// split the MBB before the next instruction.
MachineBasicBlock *MBB = MI->getParent();
- if (&MBB->back() != MI || !BBHasFallthrough(MBB))
+ if (&MBB->back() != MI || !BBHasFallthrough(MBB)) {
SplitBlockBeforeInstr(MI);
+ // No need for the branch to the next block. We're adding a unconditional
+ // branch to the destination.
+ MBB->back().eraseFromParent();
+ }
MachineBasicBlock *NextBB = next(MachineFunction::iterator(MBB));
// Insert a unconditional branch and replace the conditional branch.
// Also update the ImmBranch as well as adding a new entry for the new branch.
- BuildMI(MBB, TII->get(MI->getOpcode())).addMBB(NextBB).addImm((unsigned)CC);
+ BuildMI(MBB, TII->get(MI->getOpcode())).addMBB(NextBB).addImm(CC);
Br.MI = &MBB->back();
BuildMI(MBB, TII->get(Br.UncondBr)).addMBB(DestBB);
unsigned MaxDisp = (Br.UncondBr == ARM::tB) ? (1<<10)*2 : (1<<23)*4;
OpenPOWER on IntegriCloud