[llvm-commits] CVS: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
Evan Cheng
evan.cheng at apple.com
Thu Jan 25 18:02:54 PST 2007
Changes in directory llvm/lib/Target/ARM:
ARMConstantIslandPass.cpp updated: 1.7 -> 1.8
---
Log message:
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.
---
Diffs of the changes: (+6 -2)
ARMConstantIslandPass.cpp | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.7 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.8
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.7 Thu Jan 25 19:04:44 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Thu Jan 25 20:02:39 2007
@@ -602,13 +602,17 @@
// 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;
More information about the llvm-commits
mailing list