mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238462 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
24441414a3
commit
40d9379cd5
@ -47,6 +47,9 @@ public:
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
bool runOnFunction(Function &F) override;
|
||||
|
||||
void releaseMemory() override;
|
||||
|
||||
void print(raw_ostream &OS, const Module *M = nullptr) const override;
|
||||
|
||||
/// \brief Get an edge's probability, relative to other out-edges of the Src.
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user