summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/DepthFirstIterator.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-08-18 19:00:11 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-08-18 19:00:11 +0000
commit4d440bd786ae4dad7035c30fd09044a9efc8dccd (patch)
tree9a631ebe204c82dfcbe6ad380737891355facdad /include/llvm/ADT/DepthFirstIterator.h
parent1407c84242688dbcdbaa5b0296c18f46d102f25a (diff)
downloadllvm-4d440bd786ae4dad7035c30fd09044a9efc8dccd.tar.gz
llvm-4d440bd786ae4dad7035c30fd09044a9efc8dccd.tar.bz2
llvm-4d440bd786ae4dad7035c30fd09044a9efc8dccd.tar.xz
Aggressively prune the DFS when inserting phi-defs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111394 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/DepthFirstIterator.h')
-rw-r--r--include/llvm/ADT/DepthFirstIterator.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/ADT/DepthFirstIterator.h b/include/llvm/ADT/DepthFirstIterator.h
index b9e5cbdf8c..3edb555078 100644
--- a/include/llvm/ADT/DepthFirstIterator.h
+++ b/include/llvm/ADT/DepthFirstIterator.h
@@ -193,6 +193,15 @@ public:
NodeType *getPath(unsigned n) const {
return VisitStack[n].first.getPointer();
}
+
+ /// skipChildren - Skip all children of Node, assuming that Node is on the
+ /// current path. This allows more aggressive pruning than just skipping
+ /// children of the current node.
+ _Self& skipChildren(NodeType *Node) {
+ while (!VisitStack.empty() && **this != Node)
+ VisitStack.pop_back();
+ return skipChildren();
+ }
};