aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMConstantIslandPass.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2009-11-16 17:10:56 +0000
committerJim Grosbach <grosbach@apple.com>2009-11-16 17:10:56 +0000
commitca215e7804ca5d85e19e31850c3ba3d155624e89 (patch)
tree6ec53433f9b1835afc5fe3ee672ce62c5a0e9e68 /lib/Target/ARM/ARMConstantIslandPass.cpp
parent1546b11140e0b439856f363c37285e0608394f18 (diff)
Analyze has to be before checking the condition, obviously. Properly construct an iterator for prior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMConstantIslandPass.cpp')
-rw-r--r--lib/Target/ARM/ARMConstantIslandPass.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp
index 8279888dfa..4925a20455 100644
--- a/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -1772,13 +1772,15 @@ AdjustJTTargetBlockForward(MachineBasicBlock *BB, MachineBasicBlock *JTBB)
int Size = BBSizes[BBI];
MachineBasicBlock *TBB = 0, *FBB = 0;
SmallVector<MachineOperand, 4> Cond;
- // If the block is small and ends in an unconditional branch, move it.
- if (Size < 50 && Cond.empty()) {
- // If the block terminator isn't analyzable, don't try to move the block
- if (TII->AnalyzeBranch(*BB, TBB, FBB, Cond))
- return NULL;
- MachineFunction::iterator OldPrior = prior(BB);
+ // If the block terminator isn't analyzable, don't try to move the block
+ if (TII->AnalyzeBranch(*BB, TBB, FBB, Cond))
+ return NULL;
+
+ // If the block is small and ends in an unconditional branch, move it.
+ if (Size < 50 && Cond.empty() && BB != MF.begin()) {
+ MachineFunction::iterator BBi = BB;
+ MachineFunction::iterator OldPrior = prior(BBi);
BB->moveAfter(JTBB);
OldPrior->updateTerminator();
BB->updateTerminator();