summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-05-12 21:48:15 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-05-12 21:48:15 +0000
commitc63aa1e8ab8d622a34f6df147acb35acdb6cf2d6 (patch)
treedfc836217dace6abc9c7c75b05fe6c0e3322d769
parent12a78f502a613dceedd8a9c7a361f5efabcbe28b (diff)
downloadbcm5719-llvm-c63aa1e8ab8d622a34f6df147acb35acdb6cf2d6.tar.gz
bcm5719-llvm-c63aa1e8ab8d622a34f6df147acb35acdb6cf2d6.zip
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. llvm-svn: 103653
-rw-r--r--llvm/include/llvm/Analysis/InlineCost.h3
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp7
-rw-r--r--llvm/lib/Transforms/IPO/InlineSimple.cpp3
3 files changed, 12 insertions, 1 deletions
diff --git a/llvm/include/llvm/Analysis/InlineCost.h b/llvm/include/llvm/Analysis/InlineCost.h
index d51dd6cbd6f..cac7cfe2455 100644
--- a/llvm/include/llvm/Analysis/InlineCost.h
+++ b/llvm/include/llvm/Analysis/InlineCost.h
@@ -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,
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 62713715970..10c2d79bef3 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -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();
+}
diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp
index 46cf4b25e42..74b4a1c10ec 100644
--- a/llvm/lib/Transforms/IPO/InlineSimple.cpp
+++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp
@@ -49,6 +49,9 @@ namespace {
CA.growCachedCostInfo(Caller, Callee);
}
virtual bool doInitialization(CallGraph &CG);
+ void releaseMemory() {
+ CA.clear();
+ }
};
}
OpenPOWER on IntegriCloud