///
//===----------------------------------------------------------------------===//
-
#ifndef LLVM_SUPPORT_GENERICDOMTREECONSTRUCTION_H
#define LLVM_SUPPORT_GENERICDOMTREECONSTRUCTION_H
// Increment the successor number for the next time we get to it.
++Worklist.back().second;
-
+
// Visit the successor next, if it isn't already visited.
typename GraphT::NodeType* Succ = *NextSucc;
return N;
}
-template<class GraphT>
-typename GraphT::NodeType*
-Eval(DominatorTreeBase<typename GraphT::NodeType>& DT,
+template <class GraphT>
+typename GraphT::NodeType *
+Eval(DominatorTreeBase<typename GraphT::NodeType> &DT,
typename GraphT::NodeType *VIn, unsigned LastLinked) {
typename DominatorTreeBase<typename GraphT::NodeType>::InfoRec &VInInfo =
DT.Info[VIn];
if (VInInfo.Parent >= LastLinked)
Work.push_back(VIn);
-
+
while (!Work.empty()) {
typename GraphT::NodeType* V = Work.back();
typename DominatorTreeBase<typename GraphT::NodeType>::InfoRec &VInfo =
if (Visited.insert(VAncestor).second && VInfo.Parent >= LastLinked) {
Work.push_back(VAncestor);
continue;
- }
- Work.pop_back();
+ }
+ Work.pop_back();
// Update VInfo based on Ancestor info
if (VInfo.Parent < LastLinked)
i != e; ++i)
N = DFSPass<GraphT>(DT, DT.Roots[i], N);
- // it might be that some blocks did not get a DFS number (e.g., blocks of
+ // it might be that some blocks did not get a DFS number (e.g., blocks of
// infinite loops). In these cases an artificial exit node is required.
MultipleRoots |= (DT.isPostDominator() && N != GraphTraits<FuncT*>::size(&F));
for (unsigned i = 2; i <= N; ++i) {
typename GraphT::NodeType* W = DT.Vertex[i];
+ // Don't replace this with 'count', the insertion side effect is important
if (DT.DomTreeNodes[W])
continue; // Haven't calculated this node yet?
DT.updateDFSNumbers();
}
-
}
#endif