aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/InlineCost.h
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-02-05 00:49:15 +0000
committerEric Christopher <echristo@apple.com>2011-02-05 00:49:15 +0000
commit4e8af6db184118638c21f713ad98e3292c6891c9 (patch)
tree4527fa0f07aef9b250bdbc195ff97edd97f13eb9 /include/llvm/Analysis/InlineCost.h
parent66c357dbc44c3f3fe1b789f1ad581bd55f25dea4 (diff)
downloadexternal_llvm-4e8af6db184118638c21f713ad98e3292c6891c9.zip
external_llvm-4e8af6db184118638c21f713ad98e3292c6891c9.tar.gz
external_llvm-4e8af6db184118638c21f713ad98e3292c6891c9.tar.bz2
Rewrite how the indirect call bonus is handled. This now works by:
a) Making it a per call site bonus for functions that we can move from indirect to direct calls. b) Reduces the bonus from 500 to 100 per call site. c) Subtracts the size of the possible newly inlineable call from the bonus to only add a bonus if we can inline a small function to devirtualize it. Also changes the bonus from a positive that's subtracted to a negative that's added. Fixes the remainder of rdar://8546196 by reducing the object file size after inlining by 84%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124916 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/InlineCost.h')
-rw-r--r--include/llvm/Analysis/InlineCost.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/llvm/Analysis/InlineCost.h b/include/llvm/Analysis/InlineCost.h
index e53d7f6..b08bf57 100644
--- a/include/llvm/Analysis/InlineCost.h
+++ b/include/llvm/Analysis/InlineCost.h
@@ -33,7 +33,7 @@ namespace llvm {
namespace InlineConstants {
// Various magic constants used to adjust heuristics.
const int InstrCost = 5;
- const int IndirectCallBonus = 500;
+ const int IndirectCallBonus = -100;
const int CallPenalty = 25;
const int LastCallToStaticBonus = -15000;
const int ColdccPenalty = 2000;
@@ -124,7 +124,10 @@ namespace llvm {
// the ValueMap will update itself when this happens.
ValueMap<const Function *, FunctionInfo> CachedFunctionInfo;
- unsigned CountBonusForConstant(Value *V);
+ int CountBonusForConstant(Value *V, Constant *C = NULL);
+ int ConstantFunctionBonus(CallSite CS, Constant *C);
+ int getInlineSize(CallSite CS, Function *Callee);
+ int getInlineBonuses(CallSite CS, Function *Callee);
public:
/// getInlineCost - The heuristic used to determine if we should inline the