[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 8 14:13:02 PDT 2002
Changes in directory llvm/lib/VMCore:
Dominators.cpp updated: 1.41 -> 1.42
---
Log message:
Expose new "recalculate" method from dominatorset
---
Diffs of the changes:
Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.41 llvm/lib/VMCore/Dominators.cpp:1.42
--- llvm/lib/VMCore/Dominators.cpp:1.41 Fri Oct 4 09:45:48 2002
+++ llvm/lib/VMCore/Dominators.cpp Tue Oct 8 14:12:08 2002
@@ -92,10 +92,15 @@
// 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 @@
// 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;
}
More information about the llvm-commits
mailing list