aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2010-01-07 23:50:25 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2010-01-07 23:50:25 +0000
commit365ccd3a919b017f79140028dac15ef0c70641dd (patch)
tree16ba9792215df40c9eb52e1cae698f187f57d055
parentecd4694458796d8d9dd205a8eb43ff7163425bca (diff)
Remove workaround in PostDominators
Remove a FIXME and unify code that was necessary to work around broken updateDFSNumbers(). Before updateDFSNumbers() did not work correctly for post dominators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92968 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/DominatorInternals.h11
-rw-r--r--include/llvm/Analysis/Dominators.h14
2 files changed, 6 insertions, 19 deletions
diff --git a/include/llvm/Analysis/DominatorInternals.h b/include/llvm/Analysis/DominatorInternals.h
index cca0d502b6..5ecb348144 100644
--- a/include/llvm/Analysis/DominatorInternals.h
+++ b/include/llvm/Analysis/DominatorInternals.h
@@ -347,15 +347,8 @@ void Calculate(DominatorTreeBase<typename GraphTraits<NodeT>::NodeType>& DT,
DT.IDoms.clear();
DT.Info.clear();
std::vector<typename GraphT::NodeType*>().swap(DT.Vertex);
-
- // FIXME: This does not work on PostDomTrees. It seems likely that this is
- // due to an error in the algorithm for post-dominators. This really should
- // be investigated and fixed at some point.
- // DT.updateDFSNumbers();
-
- // Start out with the DFS numbers being invalid. Let them be computed if
- // demanded.
- DT.DFSInfoValid = false;
+
+ DT.updateDFSNumbers();
}
}
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 7ac474aff3..b70b23c01f 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -652,21 +652,17 @@ public:
/// recalculate - compute a dominator tree for the given function
template<class FT>
void recalculate(FT& F) {
- if (!this->IsPostDominators) {
- reset();
+ reset();
+ this->Vertex.push_back(0);
- // Initialize roots
+ if (!this->IsPostDominators) {
+ // Initialize root
this->Roots.push_back(&F.front());
this->IDoms[&F.front()] = 0;
this->DomTreeNodes[&F.front()] = 0;
- this->Vertex.push_back(0);
Calculate<FT, NodeT*>(*this, F);
-
- updateDFSNumbers();
} else {
- reset(); // Reset from the last time we were run...
-
// Initialize the roots list
for (typename FT::iterator I = F.begin(), E = F.end(); I != E; ++I) {
if (std::distance(GraphTraits<FT*>::child_begin(I),
@@ -678,8 +674,6 @@ public:
this->DomTreeNodes[I] = 0;
}
- this->Vertex.push_back(0);
-
Calculate<FT, Inverse<NodeT*> >(*this, F);
}
}