[llvm-commits] [poolalloc] r52794 - /poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
John Criswell
criswell at uiuc.edu
Thu Jun 26 12:16:12 PDT 2008
Author: criswell
Date: Thu Jun 26 14:16:12 2008
New Revision: 52794
URL: http://llvm.org/viewvc/llvm-project?rev=52794&view=rev
Log:
Fix a run-time error on Mac OS X by just looping through the vector.
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=52794&r1=52793&r2=52794&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Thu Jun 26 14:16:12 2008
@@ -81,24 +81,19 @@
static void
MergeNodesInDSGraph (DSGraph & Graph) {
- std::vector<DSNode *> HeapNodes;
+ std::vector<DSNodeHandle> 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);
+ HeapNodes.push_back (DSNodeHandle(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());
- }
+ for (unsigned i = 0; i < HeapNodes.size(); ++i)
+ for (unsigned j = i+1; j < HeapNodes.size(); ++j)
+ HeapNodes[i].mergeWith (HeapNodes[j]);
return;
}
More information about the llvm-commits
mailing list