[llvm-commits] [poolalloc] r52793 - /poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
John Criswell
criswell at uiuc.edu
Thu Jun 26 11:46:50 PDT 2008
Author: criswell
Date: Thu Jun 26 13:46:50 2008
New Revision: 52793
URL: http://llvm.org/viewvc/llvm-project?rev=52793&view=rev
Log:
Only merge DSNodes that alias with heap objects. Simple pool allocation does
not cause aliasing for nodes that only have the stack and/or global flags.
Modified:
poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=52793&r1=52792&r2=52793&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Thu Jun 26 13:46:50 2008
@@ -81,11 +81,23 @@
static void
MergeNodesInDSGraph (DSGraph & Graph) {
- while ((Graph.node_begin() != Graph.node_end()) &&
- ((++(Graph.node_begin())) != Graph.node_end())) {
- DSNodeHandle Node (Graph.node_begin());
- DSNodeHandle Target(++(Graph.node_begin()));
+ std::vector<DSNode *> HeapNodes;
+
+ DSGraph::node_iterator i;
+ DSGraph::node_iterator e = Graph.node_end();
+ for (i = Graph.node_begin(); i != e; ++i) {
+ DSNode * Node = i;
+ if (Node->isHeapNode())
+ HeapNodes.push_back (Node);
+ }
+
+ while (HeapNodes.size() > 1) {
+ DSNodeHandle Node (*HeapNodes.rbegin());
+ DSNodeHandle Target(*(--(HeapNodes.rbegin())));
Node.mergeWith (Target);
+ HeapNodes.pop_back();
+ HeapNodes.pop_back();
+ HeapNodes.push_back (Node.getNode());
}
return;
}
More information about the llvm-commits
mailing list