[llvm-commits] [llvm] r133432 - /llvm/trunk/lib/CodeGen/TailDuplication.cpp
Rafael Espindola
rafael.espindola at gmail.com
Mon Jun 20 07:11:42 PDT 2011
Author: rafael
Date: Mon Jun 20 09:11:42 2011
New Revision: 133432
URL: http://llvm.org/viewvc/llvm-project?rev=133432&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/TailDuplication.cpp
Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=133432&r1=133431&r2=133432&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original)
+++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Mon Jun 20 09:11:42 2011
@@ -669,8 +669,10 @@
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 @@
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 @@
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
More information about the llvm-commits
mailing list