aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-01-09 01:30:11 +0000
committerDale Johannesen <dalej@apple.com>2009-01-09 01:30:11 +0000
commitec46e4852f6e2e628f27a980ba58c4672bb26a3c (patch)
treef8b39f7bf252361ce3898f38b9c38ca9b5b0d11e /lib/Transforms/IPO
parent3a3b1149a482ef16701de6607681c7ecc82bc0e1 (diff)
downloadexternal_llvm-ec46e4852f6e2e628f27a980ba58c4672bb26a3c.zip
external_llvm-ec46e4852f6e2e628f27a980ba58c4672bb26a3c.tar.gz
external_llvm-ec46e4852f6e2e628f27a980ba58c4672bb26a3c.tar.bz2
Adjustments to last patch based on review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61969 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/InlineAlways.cpp3
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp3
-rw-r--r--lib/Transforms/IPO/Inliner.cpp5
3 files changed, 11 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/InlineAlways.cpp b/lib/Transforms/IPO/InlineAlways.cpp
index 9031432..5f9ea54 100644
--- a/lib/Transforms/IPO/InlineAlways.cpp
+++ b/lib/Transforms/IPO/InlineAlways.cpp
@@ -45,6 +45,9 @@ namespace {
float getInlineFudgeFactor(CallSite CS) {
return CA.getInlineFudgeFactor(CS);
}
+ void resetCachedCostInfo(Function *Caller) {
+ return CA.resetCachedCostInfo(Caller);
+ }
virtual bool doFinalization(CallGraph &CG) {
return removeDeadFunctions(CG, &NeverInline);
}
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 8ae5235..e107a00 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -43,6 +43,9 @@ namespace {
float getInlineFudgeFactor(CallSite CS) {
return CA.getInlineFudgeFactor(CS);
}
+ void resetCachedCostInfo(Function *Caller) {
+ CA.resetCachedCostInfo(Caller);
+ }
virtual bool doInitialization(CallGraph &CG);
};
}
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index f97fce6..639f3a8 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -185,9 +185,14 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
// try to do so.
CallSite CS = CallSites[CSi];
if (shouldInline(CS)) {
+ Function *Caller = CS.getCaller();
// Attempt to inline the function...
if (InlineCallIfPossible(CS, CG, SCCFunctions,
getAnalysis<TargetData>())) {
+ // Remove any cached cost info for this caller, as inlining the callee
+ // has increased the size of the caller.
+ resetCachedCostInfo(Caller);
+
// Remove this call site from the list. If possible, use
// swap/pop_back for efficiency, but do not use it if doing so would
// move a call site to a function in this SCC before the