split dom frontier handling stuff out to its own DominanceFrontier header,

so that Dominators.h is *just* domtree.  Also prune #includes a bit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2011-01-02 22:09:33 +00:00
parent 12be936cc9
commit 9fc5cdf77c
26 changed files with 259 additions and 245 deletions

View File

@ -46,7 +46,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/Type.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/DominanceFrontier.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolution.h"
@ -163,9 +163,8 @@ ReprocessLoop:
for (SmallPtrSet<BasicBlock*, 4>::iterator I = BadPreds.begin(),
E = BadPreds.end(); I != E; ++I) {
DEBUG(dbgs() << "LoopSimplify: Deleting edge from dead predecessor ";
WriteAsOperand(dbgs(), *I, false);
dbgs() << "\n");
DEBUG(dbgs() << "LoopSimplify: Deleting edge from dead predecessor "
<< (*I)->getName() << "\n");
// Inform each successor of each dead pred.
for (succ_iterator SI = succ_begin(*I), SE = succ_end(*I); SI != SE; ++SI)
@ -190,9 +189,8 @@ ReprocessLoop:
if (BI->isConditional()) {
if (UndefValue *Cond = dyn_cast<UndefValue>(BI->getCondition())) {
DEBUG(dbgs() << "LoopSimplify: Resolving \"br i1 undef\" to exit in ";
WriteAsOperand(dbgs(), *I, false);
dbgs() << "\n");
DEBUG(dbgs() << "LoopSimplify: Resolving \"br i1 undef\" to exit in "
<< (*I)->getName() << "\n");
BI->setCondition(ConstantInt::get(Cond->getType(),
!L->contains(BI->getSuccessor(0))));
@ -324,10 +322,8 @@ ReprocessLoop:
// Success. The block is now dead, so remove it from the loop,
// update the dominator tree and dominance frontier, and delete it.
DEBUG(dbgs() << "LoopSimplify: Eliminating exiting block ";
WriteAsOperand(dbgs(), ExitingBlock, false);
dbgs() << "\n");
DEBUG(dbgs() << "LoopSimplify: Eliminating exiting block "
<< ExitingBlock->getName() << "\n");
assert(pred_begin(ExitingBlock) == pred_end(ExitingBlock));
Changed = true;
@ -384,9 +380,8 @@ BasicBlock *LoopSimplify::InsertPreheaderForLoop(Loop *L) {
SplitBlockPredecessors(Header, &OutsideBlocks[0], OutsideBlocks.size(),
".preheader", this);
DEBUG(dbgs() << "LoopSimplify: Creating pre-header ";
WriteAsOperand(dbgs(), NewBB, false);
dbgs() << "\n");
DEBUG(dbgs() << "LoopSimplify: Creating pre-header " << NewBB->getName()
<< "\n");
// Make sure that NewBB is put someplace intelligent, which doesn't mess up
// code layout too horribly.
@ -415,10 +410,8 @@ BasicBlock *LoopSimplify::RewriteLoopExitBlock(Loop *L, BasicBlock *Exit) {
LoopBlocks.size(), ".loopexit",
this);
DEBUG(dbgs() << "LoopSimplify: Creating dedicated exit block ";
WriteAsOperand(dbgs(), NewBB, false);
dbgs() << "\n");
DEBUG(dbgs() << "LoopSimplify: Creating dedicated exit block "
<< NewBB->getName() << "\n");
return NewBB;
}
@ -649,9 +642,8 @@ LoopSimplify::InsertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader) {
Header->getName()+".backedge", F);
BranchInst *BETerminator = BranchInst::Create(Header, BEBlock);
DEBUG(dbgs() << "LoopSimplify: Inserting unique backedge block ";
WriteAsOperand(dbgs(), BEBlock, false);
dbgs() << "\n");
DEBUG(dbgs() << "LoopSimplify: Inserting unique backedge block "
<< BEBlock->getName() << "\n");
// Move the new backedge block to right after the last backedge block.
Function::iterator InsertPos = BackedgeBlocks.back(); ++InsertPos;