[llvm-commits] [poolalloc] r130287 - in /poolalloc/trunk: include/dsa/DataStructure.h lib/DSA/DSGraph.cpp lib/DSA/TopDownClosure.cpp
Will Dietz
wdietz2 at illinois.edu
Tue Apr 26 21:47:40 PDT 2011
Author: wdietz2
Date: Tue Apr 26 23:47:39 2011
New Revision: 130287
URL: http://llvm.org/viewvc/llvm-project?rev=130287&view=rev
Log:
Use DenseSet instead of svset when marking nodes during graph traversal.
Theoretically this should be much faster but use more memory...
Experimentally this is significantly faster (~4x faster on 176.gcc TD),
but uses essentially the same amount of memory.
svset's are inferior here due to very slow insert (sorted vector insert)
Modified:
poolalloc/trunk/include/dsa/DataStructure.h
poolalloc/trunk/lib/DSA/DSGraph.cpp
poolalloc/trunk/lib/DSA/TopDownClosure.cpp
Modified: poolalloc/trunk/include/dsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=130287&r1=130286&r2=130287&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DataStructure.h (original)
+++ poolalloc/trunk/include/dsa/DataStructure.h Tue Apr 26 23:47:39 2011
@@ -18,6 +18,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Support/CallSite.h"
#include "llvm/ADT/EquivalenceClasses.h"
+#include "llvm/ADT/DenseSet.h"
#include "dsa/DSCallGraph.h"
#include "dsa/svset.h"
@@ -380,10 +381,10 @@
private:
void markReachableFunctionsExternallyAccessible(DSNode *N,
- svset<DSNode*> &Visited);
+ DenseSet<DSNode*> &Visited);
void InlineCallersIntoGraph(DSGraph* G);
- void ComputePostOrder(const Function &F, svset<DSGraph*> &Visited,
+ void ComputePostOrder(const Function &F, DenseSet<DSGraph*> &Visited,
std::vector<DSGraph*> &PostOrder);
};
Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=130287&r1=130286&r2=130287&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSGraph.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSGraph.cpp Tue Apr 26 23:47:39 2011
@@ -681,7 +681,7 @@
// markExternalNode -- Marks the specified node, and all that's reachable from it,
// as external. Uses 'processedNodes' to track recursion.
-static void markExternalNode(DSNode *N, svset<DSNode *> & processedNodes) {
+static void markExternalNode(DSNode *N, DenseSet<DSNode *> & processedNodes) {
// Stop recursion if no node, or if node already processed
if (N == 0 || processedNodes.count(N) ) return;
@@ -699,7 +699,7 @@
}
// markExternal --marks the specified callsite external, using 'processedNodes' to track recursion.
-static void markExternal(const DSCallSite &Call, svset<DSNode *> & processedNodes) {
+static void markExternal(const DSCallSite &Call, DenseSet<DSNode *> & processedNodes) {
markExternalNode(Call.getRetVal().getNode(), processedNodes);
markExternalNode(Call.getVAVal().getNode(), processedNodes);
@@ -711,7 +711,7 @@
// propagateExternal -- Walk the given DSGraph making sure that within this graph
// everything reachable from an already-external node is also marked External.
-static void propagateExternal(DSGraph * G, svset<DSNode *> & processedNodes) {
+static void propagateExternal(DSGraph * G, DenseSet<DSNode *> & processedNodes) {
DSGraph::node_iterator I = G->node_begin(),
E = G->node_end();
for ( ; I != E; ++I ) {
@@ -731,7 +731,7 @@
// computeExternalFlags -- mark all reachable from external as external
void DSGraph::computeExternalFlags(unsigned Flags) {
- svset<DSNode *> processedNodes;
+ DenseSet<DSNode *> processedNodes;
// Reset if indicated
if (Flags & ResetExternal) {
Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TopDownClosure.cpp?rev=130287&r1=130286&r2=130287&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/TopDownClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/TopDownClosure.cpp Tue Apr 26 23:47:39 2011
@@ -49,7 +49,7 @@
}
void TDDataStructures::markReachableFunctionsExternallyAccessible(DSNode *N,
- svset<DSNode*> &Visited) {
+ DenseSet<DSNode*> &Visited) {
if (!N || Visited.count(N)) return;
Visited.insert(N);
@@ -93,7 +93,7 @@
// arguments are functions which are reachable by incomplete or external
// nodes in the globals graph.
const DSScalarMap &GGSM = GlobalsGraph->getScalarMap();
- svset<DSNode*> Visited;
+ DenseSet<DSNode*> Visited;
for (DSScalarMap::global_iterator I=GGSM.global_begin(), E=GGSM.global_end();
I != E; ++I) {
DSNode *N = GGSM.find(*I)->second.getNode();
@@ -130,7 +130,7 @@
// We want to traverse the call graph in reverse post-order. To do this, we
// calculate a post-order traversal, then reverse it.
- svset<DSGraph*> VisitedGraph;
+ DenseSet<DSGraph*> VisitedGraph;
std::vector<DSGraph*> PostOrder;
{TIME_REGION(XXX, "td:Compute postorder");
@@ -194,7 +194,7 @@
void TDDataStructures::ComputePostOrder(const Function &F,
- svset<DSGraph*> &Visited,
+ DenseSet<DSGraph*> &Visited,
std::vector<DSGraph*> &PostOrder) {
if (F.isDeclaration()) return;
DSGraph* G = getOrCreateGraph(&F);
More information about the llvm-commits
mailing list