[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp TopDownClosure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Feb 7 19:52:01 PST 2004
Changes in directory llvm/lib/Analysis/DataStructure:
BottomUpClosure.cpp updated: 1.73 -> 1.74
DataStructure.cpp updated: 1.154 -> 1.155
Local.cpp updated: 1.77 -> 1.78
TopDownClosure.cpp updated: 1.65 -> 1.66
---
Log message:
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.
---
Diffs of the changes: (+13 -8)
Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.73 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.74
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.73 Sat Jan 31 15:02:18 2004
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Feb 7 19:51:48 2004
@@ -63,6 +63,7 @@
// nodes at the end of the BU phase should make things that they point to
// incomplete in the globals graph.
//
+ GlobalsGraph->removeTriviallyDeadNodes();
GlobalsGraph->maskIncompleteMarkers();
return false;
}
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.154 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.155
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.154 Sat Feb 7 19:27:18 2004
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Feb 7 19:51:48 2004
@@ -30,6 +30,8 @@
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,
@@ -1470,8 +1472,6 @@
//
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
@@ -1531,6 +1531,7 @@
for (unsigned j = 0, e = Globals.size(); j != e; ++j)
ScalarMap.erase(Globals[j]);
Node.makeNodeDead();
+ ++NumTrivialGlobalDNE;
}
}
}
@@ -1538,10 +1539,14 @@
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);
}
@@ -1755,12 +1760,8 @@
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
Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.77 llvm/lib/Analysis/DataStructure/Local.cpp:1.78
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.77 Sat Feb 7 19:38:34 2004
+++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Feb 7 19:51:48 2004
@@ -623,6 +623,7 @@
if (!I->isExternal())
GGB.mergeInGlobalInitializer(I);
+ GlobalsGraph->removeTriviallyDeadNodes();
GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs);
return false;
}
Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.65 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.66
--- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.65 Sat Feb 7 19:40:40 2004
+++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Feb 7 19:51:48 2004
@@ -107,6 +107,8 @@
}
ArgsRemainIncomplete.clear();
+ GlobalsGraph->removeTriviallyDeadNodes();
+
return false;
}
More information about the llvm-commits
mailing list