diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-04-22 03:31:34 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-04-22 03:31:34 +0000 |
commit | 153a265d0182bcfe072496663c320689fd21d392 (patch) | |
tree | 6ac893dd1b2dd4bd705111d9c412951ec15e1b97 | |
parent | aa866b9ae733f58b99410739041086ca71e9c6dc (diff) | |
download | llvm-153a265d0182bcfe072496663c320689fd21d392.tar.gz llvm-153a265d0182bcfe072496663c320689fd21d392.tar.bz2 llvm-153a265d0182bcfe072496663c320689fd21d392.tar.xz |
blockfreq: Implement clear() explicitly
This was implicitly with copy assignment before, which fails to actually
clear `std::vector<>`'s heap storage. Move assignment would work, but
since MSVC can't imply those anyway, explicitly `clear()`-ing members
makes more sense.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206856 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/BlockFrequencyInfoImpl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Analysis/BlockFrequencyInfoImpl.cpp b/lib/Analysis/BlockFrequencyInfoImpl.cpp index c2337bebe3..bc3722eb9d 100644 --- a/lib/Analysis/BlockFrequencyInfoImpl.cpp +++ b/lib/Analysis/BlockFrequencyInfoImpl.cpp @@ -598,7 +598,11 @@ void Distribution::normalize() { } void BlockFrequencyInfoImplBase::clear() { - *this = BlockFrequencyInfoImplBase(); + // Swap with a default-constructed std::vector, since std::vector<>::clear() + // does not actually clear heap storage. + std::vector<FrequencyData>().swap(Freqs); + std::vector<WorkingData>().swap(Working); + std::vector<LoopData>().swap(PackagedLoops); } /// \brief Clear all memory not needed downstream. |