diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-05 00:10:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-05 00:10:08 +0000 |
commit | 7ae8c4c810935625bcdbdf832a33ef4032bad906 (patch) | |
tree | 7c04dc6876d66518ec1434f5b68347284df6a2b4 /lib/VMCore | |
parent | e93e31198109b03b8c22296a1500839e95d59b5f (diff) | |
download | external_llvm-7ae8c4c810935625bcdbdf832a33ef4032bad906.zip external_llvm-7ae8c4c810935625bcdbdf832a33ef4032bad906.tar.gz external_llvm-7ae8c4c810935625bcdbdf832a33ef4032bad906.tar.bz2 |
Switch DomTreeNode::assignDFSNumber from using a std::set to using
a smallptrset. This speeds up domtree by about 15% and postdomtree by 20%.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Dominators.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index bb780c5..6231eb8 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -496,10 +496,10 @@ BasicBlock *DominatorTreeBase::findNearestCommonDominator(BasicBlock *A, /// in dfs order. void DomTreeNode::assignDFSNumber(int num) { std::vector<DomTreeNode *> workStack; - std::set<DomTreeNode *> visitedNodes; + SmallPtrSet<DomTreeNode *, 32> Visited; workStack.push_back(this); - visitedNodes.insert(this); + Visited.insert(this); this->DFSNumIn = num++; while (!workStack.empty()) { @@ -509,12 +509,12 @@ void DomTreeNode::assignDFSNumber(int num) { for (std::vector<DomTreeNode*>::iterator DI = Node->begin(), E = Node->end(); DI != E && !visitChild; ++DI) { DomTreeNode *Child = *DI; - if (visitedNodes.count(Child) == 0) { - visitChild = true; - Child->DFSNumIn = num++; - workStack.push_back(Child); - visitedNodes.insert(Child); - } + if (!Visited.insert(Child)) + continue; + + visitChild = true; + Child->DFSNumIn = num++; + workStack.push_back(Child); } if (!visitChild) { // If we reach here means all children are visited |