Remove trivially dead nodes was not removing nodes that were dead due to forwarding!

llvm-svn: 8634
This commit is contained in:
Chris Lattner 2003-09-20 21:34:07 +00:00
parent c8dfbbbf25
commit cc81b798e4
1 changed files with 14 additions and 0 deletions

View File

@ -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) {