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 | dc2d66e7b34c0ae93017c70900cd42a8c625b3dc (patch) | |
tree | 8a6d141633eb46284415d45fa1d7f37e9e8a1613 /llvm/lib | |
parent | cc88ebfa5fc96ae5a0e43da8bd848fee1f2713e4 (diff) | |
download | bcm5719-llvm-dc2d66e7b34c0ae93017c70900cd42a8c625b3dc.tar.gz bcm5719-llvm-dc2d66e7b34c0ae93017c70900cd42a8c625b3dc.zip |
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.
llvm-svn: 206856
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp b/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp index c2337bebe3b..bc3722eb9d4 100644 --- a/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp +++ b/llvm/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. |