aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
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