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 | 2e834906b9fb15f7e71117092e075ef0c95370af (patch) | |
tree | 308f8216090417b121f6f50d90a8ca3a7e7886f9 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | cf3e3017c832014b81816f38911dd03ea6c851ce (diff) | |
download | bcm5719-llvm-2e834906b9fb15f7e71117092e075ef0c95370af.tar.gz bcm5719-llvm-2e834906b9fb15f7e71117092e075ef0c95370af.zip |
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.
llvm-svn: 55351
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3d620359558..71a60fbff7e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/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); } } |