diff options
| author | Jim Grosbach <grosbach@apple.com> | 2009-11-16 17:10:56 +0000 |
|---|---|---|
| committer | Jim Grosbach <grosbach@apple.com> | 2009-11-16 17:10:56 +0000 |
| commit | 47d5e333ff4ad9db4f01ea78f94e497c9a365834 (patch) | |
| tree | c1a0596c6fb53b9adc320db258cabc2f2230e707 /llvm/lib | |
| parent | 16917aa19dec4e47d3ca4773354afb662ada2399 (diff) | |
| download | bcm5719-llvm-47d5e333ff4ad9db4f01ea78f94e497c9a365834.tar.gz bcm5719-llvm-47d5e333ff4ad9db4f01ea78f94e497c9a365834.zip | |
Analyze has to be before checking the condition, obviously. Properly construct an iterator for prior.
llvm-svn: 88917
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMConstantIslandPass.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp index 8279888dfac..4925a20455c 100644 --- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/llvm/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(); |

