diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2009-11-17 20:46:00 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2009-11-17 20:46:00 +0000 |
| commit | f992022e544981a4eaee9ee98582945d2eb25452 (patch) | |
| tree | 4900b8e26010e45a8dd2d21106dc2656353aef32 /llvm/lib/CodeGen | |
| parent | a2873f4d591271e895af23b6c3d1d4147e9445d4 (diff) | |
| download | bcm5719-llvm-f992022e544981a4eaee9ee98582945d2eb25452.tar.gz bcm5719-llvm-f992022e544981a4eaee9ee98582945d2eb25452.zip | |
Never call UpdateTerminator() when AnalyzeBranch would fail.
llvm-svn: 89139
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/PHIElimination.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp index fc6574290b3..bd716c23444 100644 --- a/llvm/lib/CodeGen/PHIElimination.cpp +++ b/llvm/lib/CodeGen/PHIElimination.cpp @@ -445,9 +445,21 @@ bool llvm::PHIElimination::isLiveIn(unsigned Reg, const MachineBasicBlock &MBB, MachineBasicBlock *PHIElimination::SplitCriticalEdge(MachineBasicBlock *A, MachineBasicBlock *B) { assert(A && B && "Missing MBB end point"); - ++NumSplits; MachineFunction *MF = A->getParent(); + + // We may need to update A's terminator, but we can't do that if AnalyzeBranch + // fails. + if (A->isLayoutSuccessor(B)) { + const TargetInstrInfo *TII = MF->getTarget().getInstrInfo(); + MachineBasicBlock *TBB = 0, *FBB = 0; + SmallVector<MachineOperand, 4> Cond; + if (!TII->AnalyzeBranch(*A, TBB, FBB, Cond)) + return NULL; + } + + ++NumSplits; + MachineBasicBlock *NMBB = MF->CreateMachineBasicBlock(); MF->push_back(NMBB); DEBUG(errs() << "PHIElimination splitting critical edge:" |

