diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-09-06 01:07:24 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-09-06 01:07:24 +0000 |
commit | dd199d29b781bc713462f1255b63d3f153bfd9e9 (patch) | |
tree | 6da1c375907b3e11438ef39f82e0b1b2ba9cd403 /lib/CodeGen | |
parent | 61d9c861fd6fabfc94421801d3ada9ef648467b7 (diff) |
Fix a memory leak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/LiveInterval.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index 4d38f0adcf..9b4872d830 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/lib/CodeGen/LiveInterval.cpp @@ -476,7 +476,9 @@ void LiveInterval::MergeValueNumberInto(VNInfo *V1, VNInfo *V2) { // ~1U so it can be nuked later. if (V1->id == getNumValNums()-1) { do { + VNInfo *VNI = valnos.back(); valnos.pop_back(); + VNI->~VNInfo(); } while (valnos.back()->def == ~1U); } else { V1->def = ~1U; diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index 2f93b76948..3d324b7bfc 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -62,10 +62,11 @@ void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const { } void LiveIntervals::releaseMemory() { - VNInfoAllocator.Reset(); mi2iMap_.clear(); i2miMap_.clear(); r2iMap_.clear(); + // Release VNInfo memroy regions after all VNInfo objects are dtor'd. + VNInfoAllocator.Reset(); for (unsigned i = 0, e = ClonedMIs.size(); i != e; ++i) delete ClonedMIs[i]; } |