aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Dominators.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-08 19:12:08 +0000
committerChris Lattner <sabre@nondot.org>2002-10-08 19:12:08 +0000
commit7ca266fe1f211afaec0bdb3b8d8e8a98d2c78fbc (patch)
tree3c798ef902c7ef845227b88b70a6af769c9fe11e /lib/VMCore/Dominators.cpp
parentde013f53a797400104444416b980ea2e586611e4 (diff)
downloadexternal_llvm-7ca266fe1f211afaec0bdb3b8d8e8a98d2c78fbc.zip
external_llvm-7ca266fe1f211afaec0bdb3b8d8e8a98d2c78fbc.tar.gz
external_llvm-7ca266fe1f211afaec0bdb3b8d8e8a98d2c78fbc.tar.bz2
Expose new "recalculate" method from dominatorset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Dominators.cpp')
-rw-r--r--lib/VMCore/Dominators.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp
index 37e7d48..a9479aa 100644
--- a/lib/VMCore/Dominators.cpp
+++ b/lib/VMCore/Dominators.cpp
@@ -92,10 +92,15 @@ void DominatorSet::calculateDominatorsFromBlock(BasicBlock *RootBB) {
// specified function.
//
bool DominatorSet::runOnFunction(Function &F) {
- Doms.clear(); // Reset from the last time we were run...
Root = &F.getEntryNode();
assert(pred_begin(Root) == pred_end(Root) &&
"Root node has predecessors in function!");
+ recalculate();
+ return false;
+}
+
+void DominatorSet::recalculate() {
+ Doms.clear(); // Reset from the last time we were run...
// Calculate dominator sets for the reachable basic blocks...
calculateDominatorsFromBlock(Root);
@@ -106,11 +111,10 @@ bool DominatorSet::runOnFunction(Function &F) {
// extra pass over the function, calculating dominator information for
// unreachable blocks.
//
- for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
+ Function *F = Root->getParent();
+ for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
if (Doms[I].count(I) == 0)
calculateDominatorsFromBlock(I);
-
- return false;
}