Never call UpdateTerminator() when AnalyzeBranch would fail.

llvm-svn: 89139
This commit is contained in:
Jakob Stoklund Olesen 2009-11-17 20:46:00 +00:00
parent a2873f4d59
commit f992022e54
1 changed files with 13 additions and 1 deletions

View File

@ -445,9 +445,21 @@ bool llvm::PHIElimination::isLiveIn(unsigned Reg, const MachineBasicBlock &MBB,
MachineBasicBlock *PHIElimination::SplitCriticalEdge(MachineBasicBlock *A, MachineBasicBlock *PHIElimination::SplitCriticalEdge(MachineBasicBlock *A,
MachineBasicBlock *B) { MachineBasicBlock *B) {
assert(A && B && "Missing MBB end point"); assert(A && B && "Missing MBB end point");
++NumSplits;
MachineFunction *MF = A->getParent(); 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(); MachineBasicBlock *NMBB = MF->CreateMachineBasicBlock();
MF->push_back(NMBB); MF->push_back(NMBB);
DEBUG(errs() << "PHIElimination splitting critical edge:" DEBUG(errs() << "PHIElimination splitting critical edge:"