diff options
author | Dan Gohman <gohman@apple.com> | 2008-08-26 01:44:34 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-08-26 01:44:34 +0000 |
commit | 1146728bfaeb471f675b805ceb27a08d28bbf468 (patch) | |
tree | 26cfd0e03423d51a9550355813e34877ff3fac2a /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | b6e3d6ce709e9ed57df055b026e55d19e50df772 (diff) |
Actually recycle SDNode allocations. SelectionDAG is using
RecyclingAllocator, but this change is needed for the nodes
to actually be recycled. This cuts SelectionDAG's memory
usage high-water-mark in half in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3d62035955..71a60fbff7 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -523,7 +523,7 @@ void SelectionDAG::RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes, N->NumOperands = 0; // Finally, remove N itself. - AllNodes.remove(N); + NodeAllocator.Deallocate(AllNodes.remove(N)); } } @@ -551,7 +551,8 @@ void SelectionDAG::DeleteNodeNotInCSEMaps(SDNode *N) { if (N->OperandsNeedDelete) delete[] N->OperandList; - AllNodes.remove(N); + assert(N != AllNodes.begin()); + NodeAllocator.Deallocate(AllNodes.remove(N)); } /// RemoveNodeFromCSEMaps - Take the specified node out of the CSE map that @@ -777,11 +778,14 @@ SelectionDAG::~SelectionDAG() { } void SelectionDAG::allnodes_clear() { + assert(&*AllNodes.begin() == &EntryNode); + AllNodes.remove(AllNodes.begin()); while (!AllNodes.empty()) { SDNode *N = AllNodes.remove(AllNodes.begin()); N->SetNextInBucket(0); if (N->OperandsNeedDelete) delete [] N->OperandList; + NodeAllocator.Deallocate(N); } } |