Clear CachedFunctionInfo upon Pass::releaseMemory. Because ValueMap will abort

on RAUW of functions, this is a correctness issue instead of a mere memory
usage problem.


No testcase until the new MergeFunctions can land.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103653 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky 2010-05-12 21:48:15 +00:00
parent bd4fa2efd3
commit 9a1581b910
3 changed files with 12 additions and 1 deletions

View File

@ -198,6 +198,9 @@ namespace llvm {
/// has been inlined. If Callee is NULL it means a dead call has been
/// eliminated.
void growCachedCostInfo(Function* Caller, Function* Callee);
/// clear - empty the cache of inline costs
void clear();
};
/// callIsSmall - If a call is likely to lower to a single target instruction,

View File

@ -455,6 +455,11 @@ InlineCostAnalyzer::growCachedCostInfo(Function *Caller, Function *Callee) {
else
CallerMetrics.NumInsts = 0;
// We are not updating the argumentweights. We have already determined that
// We are not updating the argument weights. We have already determined that
// Caller is a fairly large function, so we accept the loss of precision.
}
/// clear - empty the cache of inline costs
void InlineCostAnalyzer::clear() {
CachedFunctionInfo.clear();
}

View File

@ -49,6 +49,9 @@ namespace {
CA.growCachedCostInfo(Caller, Callee);
}
virtual bool doInitialization(CallGraph &CG);
void releaseMemory() {
CA.clear();
}
};
}