mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Instead of callign removeTriviallyDeadNodes on the global graph every time
removeDeadNodes is called, only call it at the end of the pass being run. This saves 1.3 seconds running DSA on 177.mesa (5.3->4.0s), which is pretty big. This is only possible because of the automatic garbage collection done on forwarding nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11178 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cd90f21c0c
commit
c3f5f7701f
@ -63,6 +63,7 @@ bool BUDataStructures::run(Module &M) {
|
|||||||
// nodes at the end of the BU phase should make things that they point to
|
// nodes at the end of the BU phase should make things that they point to
|
||||||
// incomplete in the globals graph.
|
// incomplete in the globals graph.
|
||||||
//
|
//
|
||||||
|
GlobalsGraph->removeTriviallyDeadNodes();
|
||||||
GlobalsGraph->maskIncompleteMarkers();
|
GlobalsGraph->maskIncompleteMarkers();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ namespace {
|
|||||||
Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged");
|
Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged");
|
||||||
Statistic<> NumNodeAllocated ("dsa", "Number of nodes allocated");
|
Statistic<> NumNodeAllocated ("dsa", "Number of nodes allocated");
|
||||||
Statistic<> NumDNE ("dsa", "Number of nodes removed by reachability");
|
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>
|
cl::opt<bool>
|
||||||
EnableDSNodeGlobalRootsHack("enable-dsa-globalrootshack", cl::Hidden,
|
EnableDSNodeGlobalRootsHack("enable-dsa-globalrootshack", cl::Hidden,
|
||||||
@ -1470,8 +1472,6 @@ static void removeIdenticalCalls(std::vector<DSCallSite> &Calls) {
|
|||||||
//
|
//
|
||||||
void DSGraph::removeTriviallyDeadNodes() {
|
void DSGraph::removeTriviallyDeadNodes() {
|
||||||
TIME_REGION(X, "removeTriviallyDeadNodes");
|
TIME_REGION(X, "removeTriviallyDeadNodes");
|
||||||
removeIdenticalCalls(FunctionCalls);
|
|
||||||
removeIdenticalCalls(AuxFunctionCalls);
|
|
||||||
|
|
||||||
// Loop over all of the nodes in the graph, calling getNode on each field.
|
// 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
|
// This will cause all nodes to update their forwarding edges, causing
|
||||||
@ -1531,6 +1531,7 @@ void DSGraph::removeTriviallyDeadNodes() {
|
|||||||
for (unsigned j = 0, e = Globals.size(); j != e; ++j)
|
for (unsigned j = 0, e = Globals.size(); j != e; ++j)
|
||||||
ScalarMap.erase(Globals[j]);
|
ScalarMap.erase(Globals[j]);
|
||||||
Node.makeNodeDead();
|
Node.makeNodeDead();
|
||||||
|
++NumTrivialGlobalDNE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1538,10 +1539,14 @@ void DSGraph::removeTriviallyDeadNodes() {
|
|||||||
if (Node.getNodeFlags() == 0 && Node.hasNoReferrers()) {
|
if (Node.getNodeFlags() == 0 && Node.hasNoReferrers()) {
|
||||||
// This node is dead!
|
// This node is dead!
|
||||||
NI = Nodes.erase(NI); // Erase & remove from node list.
|
NI = Nodes.erase(NI); // Erase & remove from node list.
|
||||||
|
++NumTrivialDNE;
|
||||||
} else {
|
} else {
|
||||||
++NI;
|
++NI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeIdenticalCalls(FunctionCalls);
|
||||||
|
removeIdenticalCalls(AuxFunctionCalls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1755,12 +1760,8 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
|
|||||||
AuxFunctionCalls.erase(AuxFunctionCalls.begin()+CurIdx,
|
AuxFunctionCalls.erase(AuxFunctionCalls.begin()+CurIdx,
|
||||||
AuxFunctionCalls.end());
|
AuxFunctionCalls.end());
|
||||||
|
|
||||||
// We are finally done with the GGCloner so we can clear it and then get rid
|
// We are finally done with the GGCloner so we can destroy it.
|
||||||
// of unused nodes in the GlobalsGraph produced by merging.
|
GGCloner.destroy();
|
||||||
if (GGCloner.clonedNode()) {
|
|
||||||
GGCloner.destroy();
|
|
||||||
GlobalsGraph->removeTriviallyDeadNodes();
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, any nodes which are visited, but not alive, are nodes
|
// At this point, any nodes which are visited, but not alive, are nodes
|
||||||
// which can be removed. Loop over all nodes, eliminating completely
|
// which can be removed. Loop over all nodes, eliminating completely
|
||||||
|
@ -623,6 +623,7 @@ bool LocalDataStructures::run(Module &M) {
|
|||||||
if (!I->isExternal())
|
if (!I->isExternal())
|
||||||
GGB.mergeInGlobalInitializer(I);
|
GGB.mergeInGlobalInitializer(I);
|
||||||
|
|
||||||
|
GlobalsGraph->removeTriviallyDeadNodes();
|
||||||
GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs);
|
GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,8 @@ bool TDDataStructures::run(Module &M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ArgsRemainIncomplete.clear();
|
ArgsRemainIncomplete.clear();
|
||||||
|
GlobalsGraph->removeTriviallyDeadNodes();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user