aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-01 06:41:15 +0000
committerChris Lattner <sabre@nondot.org>2003-02-01 06:41:15 +0000
commitd4400c8297ea79a1b6950a9375aa94532e337f55 (patch)
treec5467d17b8e62b16303c714f706000dd1f02cef3 /lib/Analysis/DataStructure/DataStructure.cpp
parent5e7d0e26915cb035be621b86a591e96950e5b628 (diff)
Delete nodes more efficiently
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5463 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 8a6eab452f..f1b6e420bb 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -1090,19 +1090,17 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
ScalarMap.erase(GlobalNodes[i].first);
// Loop over all unreachable nodes, dropping their references...
- std::vector<DSNode*> DeadNodes;
- DeadNodes.reserve(Nodes.size()); // Only one allocation is allowed.
for (unsigned i = 0; i != Nodes.size(); ++i)
if (!Alive.count(Nodes[i])) {
DSNode *N = Nodes[i];
std::swap(Nodes[i--], Nodes.back()); // move node to end of vector
Nodes.pop_back(); // Erase node from alive list.
- DeadNodes.push_back(N); // Add node to our list of dead nodes
N->dropAllReferences(); // Drop all outgoing edges
+
+ while (!N->getReferrers().empty())
+ N->getReferrers().back()->setNode(0);
+ delete N;
}
-
- // Delete all dead nodes...
- std::for_each(DeadNodes.begin(), DeadNodes.end(), deleter<DSNode>);
}
#if 0