summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-07-19 00:37:25 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-07-19 00:37:25 +0000
commita7a20c494697225ccdc5dc668fa1966c4d8f4d7f (patch)
tree903191279b6ba0bc8d99f96ca1c61ac9edd6f302 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parentbf3a52a62c85913e521ee28e62db00c6e7789316 (diff)
downloadbcm5719-llvm-a7a20c494697225ccdc5dc668fa1966c4d8f4d7f.tar.gz
bcm5719-llvm-a7a20c494697225ccdc5dc668fa1966c4d8f4d7f.zip
Fix a memory leak in LiveIntervalAnalysis.
llvm-svn: 53779
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 8c99831de18..f57cd2b7d18 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -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) {
OpenPOWER on IntegriCloud