summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-03-09 22:43:37 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-03-09 22:43:37 +0000
commit4497475905af32034dcfb7cf47028b478b2a039f (patch)
tree957625663e621f33b1603d5a8bee9cd41706fd2d /llvm/lib
parent7242868e712232258bfeab46df7e3c39149c8c3c (diff)
downloadbcm5719-llvm-4497475905af32034dcfb7cf47028b478b2a039f.tar.gz
bcm5719-llvm-4497475905af32034dcfb7cf47028b478b2a039f.zip
Revert r98089, it was breaking a clang test.
llvm-svn: 98094
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp36
-rw-r--r--llvm/lib/Transforms/IPO/InlineAlways.cpp5
-rw-r--r--llvm/lib/Transforms/IPO/InlineSimple.cpp3
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp10
4 files changed, 6 insertions, 48 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 09e66487c7a..140e7daa6d3 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -383,39 +383,3 @@ float InlineCostAnalyzer::getInlineFudgeFactor(CallSite CS) {
Factor += 1.5f;
return Factor;
}
-
-/// growCachedCostInfo - update the cached cost info for Caller after Callee has
-/// been inlined.
-void
-InlineCostAnalyzer::growCachedCostInfo(Function* Caller, Function* Callee) {
- FunctionInfo &CallerFI = CachedFunctionInfo[Caller];
-
- // For small functions we prefer to recalculate the cost for better accuracy.
- if (!CallerFI.Metrics.NumBlocks || CallerFI.Metrics.NumInsts < 100) {
- resetCachedCostInfo(Caller);
- return;
- }
-
- // For large functions, we can save a lot of computation time by skipping
- // recalculations.
- if (CallerFI.Metrics.NumCalls > 0)
- --CallerFI.Metrics.NumCalls;
-
- if (Callee) {
- FunctionInfo &CalleeFI = CachedFunctionInfo[Callee];
- if (!CalleeFI.Metrics.NumBlocks) {
- resetCachedCostInfo(Caller);
- return;
- }
- CallerFI.Metrics.NeverInline |= CalleeFI.Metrics.NeverInline;
- CallerFI.Metrics.usesDynamicAlloca |= CalleeFI.Metrics.usesDynamicAlloca;
-
- CallerFI.Metrics.NumInsts += CalleeFI.Metrics.NumInsts;
- CallerFI.Metrics.NumBlocks += CalleeFI.Metrics.NumBlocks;
- CallerFI.Metrics.NumCalls += CalleeFI.Metrics.NumCalls;
- CallerFI.Metrics.NumVectorInsts += CalleeFI.Metrics.NumVectorInsts;
- CallerFI.Metrics.NumRets += CalleeFI.Metrics.NumRets;
- }
- // We are not updating the argumentweights. We have already determined that
- // Caller is a fairly large function, so we accept the loss of precision.
-}
diff --git a/llvm/lib/Transforms/IPO/InlineAlways.cpp b/llvm/lib/Transforms/IPO/InlineAlways.cpp
index bc8028c020a..f11ecae8dfc 100644
--- a/llvm/lib/Transforms/IPO/InlineAlways.cpp
+++ b/llvm/lib/Transforms/IPO/InlineAlways.cpp
@@ -45,10 +45,7 @@ namespace {
return CA.getInlineFudgeFactor(CS);
}
void resetCachedCostInfo(Function *Caller) {
- CA.resetCachedCostInfo(Caller);
- }
- void growCachedCostInfo(Function* Caller, Function* Callee) {
- CA.growCachedCostInfo(Caller, Callee);
+ return CA.resetCachedCostInfo(Caller);
}
virtual bool doFinalization(CallGraph &CG) {
return removeDeadFunctions(CG, &NeverInline);
diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp
index 46cf4b25e42..598043de694 100644
--- a/llvm/lib/Transforms/IPO/InlineSimple.cpp
+++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp
@@ -45,9 +45,6 @@ namespace {
void resetCachedCostInfo(Function *Caller) {
CA.resetCachedCostInfo(Caller);
}
- void growCachedCostInfo(Function* Caller, Function* Callee) {
- CA.growCachedCostInfo(Caller, Callee);
- }
virtual bool doInitialization(CallGraph &CG);
};
}
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index 03ec72c0304..3d0309f87cf 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -369,8 +369,6 @@ bool Inliner::runOnSCC(std::vector<CallGraphNode*> &SCC) {
CG[Caller]->removeCallEdgeFor(CS);
CS.getInstruction()->eraseFromParent();
++NumCallsDeleted;
- // Update the cached cost info with the missing call
- growCachedCostInfo(Caller, NULL);
} else {
// We can only inline direct calls to non-declarations.
if (Callee == 0 || Callee->isDeclaration()) continue;
@@ -384,9 +382,6 @@ bool Inliner::runOnSCC(std::vector<CallGraphNode*> &SCC) {
if (!InlineCallIfPossible(CS, CG, TD, InlinedArrayAllocas))
continue;
++NumInlined;
-
- // Update the cached cost info with the inlined call.
- growCachedCostInfo(Caller, Callee);
}
// If we inlined or deleted the last possible call site to the function,
@@ -412,6 +407,11 @@ bool Inliner::runOnSCC(std::vector<CallGraphNode*> &SCC) {
delete CG.removeFunctionFromModule(CalleeNode);
++NumDeleted;
}
+
+ // Remove any cached cost info for this caller, as inlining the
+ // callee has increased the size of the caller (which may be the
+ // same as the callee).
+ 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
OpenPOWER on IntegriCloud