aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/PostDominators.cpp20
-rw-r--r--lib/VMCore/Dominators.cpp12
2 files changed, 2 insertions, 30 deletions
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 0384fad732..370cd95529 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -29,25 +29,7 @@ static RegisterPass<PostDominatorTree>
F("postdomtree", "Post-Dominator Tree Construction", true);
bool PostDominatorTree::runOnFunction(Function &F) {
- reset(); // Reset from the last time we were run...
-
- // Initialize the roots list
- for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
- TerminatorInst *Insn = I->getTerminator();
- if (Insn->getNumSuccessors() == 0) {
- // Unreachable block is not a root node.
- if (!isa<UnreachableInst>(Insn))
- Roots.push_back(I);
- }
-
- // Prepopulate maps so that we don't get iterator invalidation issues later.
- IDoms[I] = 0;
- DomTreeNodes[I] = 0;
- }
-
- Vertex.push_back(0);
-
- Calculate<Inverse<BasicBlock*>, GraphTraits<Inverse<BasicBlock*> > >(*this, F);
+ DT->recalculate(F);
return false;
}
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp
index b909a0014c..5bb25d47d6 100644
--- a/lib/VMCore/Dominators.cpp
+++ b/lib/VMCore/Dominators.cpp
@@ -57,17 +57,7 @@ static RegisterPass<DominatorTree>
E("domtree", "Dominator Tree Construction", true);
bool DominatorTree::runOnFunction(Function &F) {
- reset(); // Reset from the last time we were run...
-
- // Initialize roots
- Roots.push_back(&F.getEntryBlock());
- IDoms[&F.getEntryBlock()] = 0;
- DomTreeNodes[&F.getEntryBlock()] = 0;
- Vertex.push_back(0);
-
- Calculate<BasicBlock*, GraphTraits<BasicBlock*> >(*this, F);
-
- updateDFSNumbers();
+ DT->recalculate(F);
return false;
}