aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-20 21:34:07 +0000
committerChris Lattner <sabre@nondot.org>2003-09-20 21:34:07 +0000
commitbab8c28924d42e982c2fde0bbb95eda95b19143b (patch)
tree3d0c2acc6fde94acb9ac3f1bc5a87a0ff28ae4ff /lib/Analysis/DataStructure
parenta2d51afd79879607e7a1882462df0719d4b40fb8 (diff)
Remove trivially dead nodes was not removing nodes that were dead due to forwarding!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8634 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure')
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 0a6fa57aa0..bdf8d810fb 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -1228,6 +1228,20 @@ void DSGraph::removeTriviallyDeadNodes() {
removeIdenticalCalls(FunctionCalls);
removeIdenticalCalls(AuxFunctionCalls);
+ // Loop over all of the nodes in the graph, calling getNode on each field.
+ // This will cause all nodes to update their forwarding edges, causing
+ // forwarded nodes to be delete-able.
+ for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
+ DSNode *N = Nodes[i];
+ for (unsigned l = 0, e = N->getNumLinks(); l != e; ++l)
+ N->getLink(l*N->getPointerSize()).getNode();
+ }
+
+ // Likewise, forward any edges from the scalar nodes...
+ for (ScalarMapTy::iterator I = ScalarMap.begin(), E = ScalarMap.end();
+ I != E; ++I)
+ I->second.getNode();
+
bool isGlobalsGraph = !GlobalsGraph;
for (unsigned i = 0; i != Nodes.size(); ++i) {