Re enable 133415 with two fixes

* Don't introduce a duplicated bb in the CFG
* When making a branch unconditional, clear the PredCond array so that it
  is really unconditional.

llvm-svn: 133432
This commit is contained in:
Rafael Espindola 2011-06-20 14:11:42 +00:00
parent 406b9be057
commit 336e10236f
1 changed files with 8 additions and 3 deletions

View File

@ -669,8 +669,10 @@ TailDuplicatePass::duplicateSimpleBB(MachineBasicBlock *TailBB,
PredTBB = NewTarget;
// Make the branch unconditional if possible
if (PredTBB == PredFBB)
if (PredTBB == PredFBB) {
PredCond.clear();
PredFBB = NULL;
}
// Avoid adding fall through branches.
if (PredFBB == NextBB)
@ -684,7 +686,10 @@ TailDuplicatePass::duplicateSimpleBB(MachineBasicBlock *TailBB,
TII->InsertBranch(*PredBB, PredTBB, PredFBB, PredCond, DebugLoc());
PredBB->removeSuccessor(TailBB);
PredBB->addSuccessor(NewTarget);
unsigned NumSuccessors = PredBB->succ_size();
assert(NumSuccessors <= 1);
if (NumSuccessors == 0 || *PredBB->succ_begin() != NewTarget)
PredBB->addSuccessor(NewTarget);
TDBBs.push_back(PredBB);
@ -707,7 +712,7 @@ TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB, MachineFunction &MF,
DenseSet<unsigned> UsedByPhi;
getRegsUsedByPHIs(*TailBB, &UsedByPhi);
if (0 && isSimpleBB(TailBB)) // Disabled to see if doing so fixes buildbots.
if (isSimpleBB(TailBB))
return duplicateSimpleBB(TailBB, TDBBs, UsedByPhi, Copies);
// Iterate through all the unique predecessors and tail-duplicate this