diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-06-20 14:11:42 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-06-20 14:11:42 +0000 |
commit | 689c24768bce1a3bf33b47559e9398525d11142d (patch) | |
tree | b33e940f5a34d24c79b18cc6acd2429f1b3d2e1f /lib/CodeGen/TailDuplication.cpp | |
parent | 2ee2d932328522267d845402e8b31d1d06f8bdd1 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TailDuplication.cpp')
-rw-r--r-- | lib/CodeGen/TailDuplication.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/TailDuplication.cpp b/lib/CodeGen/TailDuplication.cpp index 89160709f4..2d89f71bca 100644 --- a/lib/CodeGen/TailDuplication.cpp +++ b/lib/CodeGen/TailDuplication.cpp @@ -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 |