Fix a memory leak in LiveIntervalAnalysis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53779 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2008-07-19 00:37:25 +00:00
parent 5a7fb69ac2
commit 1ed9922794
2 changed files with 13 additions and 11 deletions
+8 -4
View File
@@ -72,8 +72,11 @@ void LiveIntervals::releaseMemory() {
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)
mf_->DeleteMachineInstr(ClonedMIs[i]);
while (!ClonedMIs.empty()) {
MachineInstr *MI = ClonedMIs.back();
ClonedMIs.pop_back();
mf_->DeleteMachineInstr(MI);
}
}
void LiveIntervals::computeNumbering() {
@@ -1586,8 +1589,9 @@ addIntervalsForSpills(const LiveInterval &li,
// Remember how to remat the def of this val#.
ReMatOrigDefs[VN] = ReMatDefMI;
// Original def may be modified so we have to make a copy here.
// FIXME: This is a memory leak. vrm should delete these!
ReMatDefs[VN] = mf_->CloneMachineInstr(ReMatDefMI);
MachineInstr *Clone = mf_->CloneMachineInstr(ReMatDefMI);
ClonedMIs.push_back(Clone);
ReMatDefs[VN] = Clone;
bool CanDelete = true;
if (VNI->hasPHIKill) {