diff options
author | Matthias Braun <matze@braunis.de> | 2015-02-06 17:28:47 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2015-02-06 17:28:47 +0000 |
commit | 7dc96dea0a566cfe14c4d2826773bae9e9a87b85 (patch) | |
tree | 4591efba2259590bafac7c4a8b1523515478cb84 /llvm/lib | |
parent | b4ef66832dee03a992c0424c4c6aa115bdefdbb6 (diff) | |
download | bcm5719-llvm-7dc96dea0a566cfe14c4d2826773bae9e9a87b85.tar.gz bcm5719-llvm-7dc96dea0a566cfe14c4d2826773bae9e9a87b85.zip |
LiveInterval: Fix SubRange memory leak.
llvm-svn: 228405
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/LiveInterval.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index 9423edc3091..5790905ba5c 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -598,6 +598,11 @@ VNInfo *LiveRange::MergeValueNumberInto(VNInfo *V1, VNInfo *V2) { return V2; } +void LiveInterval::freeSubRange(SubRange *S) { + S->~SubRange(); + // Memory was allocated with BumpPtr allocator and is not freed here. +} + void LiveInterval::removeEmptySubRanges() { SubRange **NextPtr = &SubRanges; SubRange *I = *NextPtr; @@ -609,12 +614,22 @@ void LiveInterval::removeEmptySubRanges() { } // Skip empty subranges until we find the first nonempty one. do { - I = I->Next; + SubRange *Next = I->Next; + freeSubRange(I); + I = Next; } while (I != nullptr && I->empty()); *NextPtr = I; } } +void LiveInterval::clearSubRanges() { + for (SubRange *I = SubRanges, *Next; I != nullptr; I = Next) { + Next = I->Next; + freeSubRange(I); + } + SubRanges = nullptr; +} + /// Helper function for constructMainRangeFromSubranges(): Search the CFG /// backwards until we find a place covered by a LiveRange segment that actually /// has a valno set. |