Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged");
Statistic<> NumNodeAllocated ("dsa", "Number of nodes allocated");
Statistic<> NumDNE ("dsa", "Number of nodes removed by reachability");
+ Statistic<> NumTrivialDNE ("dsa", "Number of nodes trivially removed");
+ Statistic<> NumTrivialGlobalDNE("dsa", "Number of globals trivially removed");
cl::opt<bool>
EnableDSNodeGlobalRootsHack("enable-dsa-globalrootshack", cl::Hidden,
//
void DSGraph::removeTriviallyDeadNodes() {
TIME_REGION(X, "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
for (unsigned j = 0, e = Globals.size(); j != e; ++j)
ScalarMap.erase(Globals[j]);
Node.makeNodeDead();
+ ++NumTrivialGlobalDNE;
}
}
}
if (Node.getNodeFlags() == 0 && Node.hasNoReferrers()) {
// This node is dead!
NI = Nodes.erase(NI); // Erase & remove from node list.
+ ++NumTrivialDNE;
} else {
++NI;
}
}
+
+ removeIdenticalCalls(FunctionCalls);
+ removeIdenticalCalls(AuxFunctionCalls);
}
AuxFunctionCalls.erase(AuxFunctionCalls.begin()+CurIdx,
AuxFunctionCalls.end());
- // We are finally done with the GGCloner so we can clear it and then get rid
- // of unused nodes in the GlobalsGraph produced by merging.
- if (GGCloner.clonedNode()) {
- GGCloner.destroy();
- GlobalsGraph->removeTriviallyDeadNodes();
- }
+ // We are finally done with the GGCloner so we can destroy it.
+ GGCloner.destroy();
// At this point, any nodes which are visited, but not alive, are nodes
// which can be removed. Loop over all nodes, eliminating completely