Reapply r99881 with some fixes: only call destructor in releaseMemory!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99883 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Torok Edwin
2010-03-30 11:17:48 +00:00
parent 226dd2ba99
commit 01cb1b665d
5 changed files with 28 additions and 12 deletions

View File

@ -82,6 +82,11 @@ void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
MachineFunctionPass::getAnalysisUsage(AU);
}
static void VNInfoDTor(void* Ptr)
{
reinterpret_cast<VNInfo*>(Ptr)->~VNInfo();
}
void LiveIntervals::releaseMemory() {
// Free the live intervals themselves.
for (DenseMap<unsigned, LiveInterval*>::iterator I = r2iMap_.begin(),
@ -91,7 +96,7 @@ void LiveIntervals::releaseMemory() {
r2iMap_.clear();
// Release VNInfo memroy regions after all VNInfo objects are dtor'd.
VNInfoAllocator.Reset();
VNInfoAllocator.Reset((unsigned)sizeof(VNInfo), alignof<VNInfo>(), VNInfoDTor);
while (!CloneMIs.empty()) {
MachineInstr *MI = CloneMIs.back();
CloneMIs.pop_back();