summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/BranchProbabilityInfo.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-05-28 19:43:06 +0000
committerPete Cooper <peter_cooper@apple.com>2015-05-28 19:43:06 +0000
commitb9d2e34a4a6f6eacc6b3057fdd0372a2b6241126 (patch)
tree12d7db8758a7fce9587343f50a147c3a5c571d17 /llvm/lib/Analysis/BranchProbabilityInfo.cpp
parent1fd36275a125d43cc3c3db6dcd9aac52fbdd439f (diff)
downloadbcm5719-llvm-b9d2e34a4a6f6eacc6b3057fdd0372a2b6241126.tar.gz
bcm5719-llvm-b9d2e34a4a6f6eacc6b3057fdd0372a2b6241126.zip
Add BranchProbabilityInfo::releaseMemory to clear the Weights field.
BranchProbabilityInfo was leaking 3MB of memory when running 'opt -O2 verify-uselistorder.lto.bc'. This was due to the Weights member not being cleared once the pass is no longer needed. This adds the releaseMemory override to clear that field. The other fields are cleared at the end of runOnFunction so can stay there. llvm-svn: 238462
Diffstat (limited to 'llvm/lib/Analysis/BranchProbabilityInfo.cpp')
-rw-r--r--llvm/lib/Analysis/BranchProbabilityInfo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
index 091943bfc7b..430b41241ed 100644
--- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -543,6 +543,10 @@ bool BranchProbabilityInfo::runOnFunction(Function &F) {
return false;
}
+void BranchProbabilityInfo::releaseMemory() {
+ Weights.clear();
+}
+
void BranchProbabilityInfo::print(raw_ostream &OS, const Module *) const {
OS << "---- Branch Probabilities ----\n";
// We print the probabilities from the last function the analysis ran over,
OpenPOWER on IntegriCloud