diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2008-04-01 23:59:29 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2008-04-01 23:59:29 +0000 |
| commit | a3a03293053509bb588fb56ed81cfed06b9ec14f (patch) | |
| tree | f4c37ab938498cfa72b1a483b5161b49e30a888f /lib/Transforms | |
| parent | bc1f1ee9dfe810cbb8c99fa0c834774cd00129a2 (diff) | |
| download | external_llvm-a3a03293053509bb588fb56ed81cfed06b9ec14f.zip external_llvm-a3a03293053509bb588fb56ed81cfed06b9ec14f.tar.gz external_llvm-a3a03293053509bb588fb56ed81cfed06b9ec14f.tar.bz2 | |
1. Drop default inline threshold back down to 200.
2. Do not use # of basic blocks as part of the cost computation since it doesn't really figure into function size.
3. More aggressively inline function with vector code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/IPO/Inliner.cpp | 4 | ||||
| -rw-r--r-- | lib/Transforms/Utils/InlineCost.cpp | 21 |
2 files changed, 15 insertions, 10 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index f33f368..cb21b79 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -32,8 +32,8 @@ STATISTIC(NumDeleted, "Number of functions deleted because all callers found"); namespace { cl::opt<int> - InlineLimit("inline-threshold", cl::Hidden, cl::init(400), - cl::desc("Control the amount of inlining to perform (default = 400)")); + InlineLimit("inline-threshold", cl::Hidden, cl::init(200), + cl::desc("Control the amount of inlining to perform (default = 200)")); } Inliner::Inliner(const void *ID) diff --git a/lib/Transforms/Utils/InlineCost.cpp b/lib/Transforms/Utils/InlineCost.cpp index 4349d0e..16f1264 100644 --- a/lib/Transforms/Utils/InlineCost.cpp +++ b/lib/Transforms/Utils/InlineCost.cpp @@ -234,14 +234,12 @@ int InlineCostAnalyzer::getInlineCost(CallSite CS, // Now that we have considered all of the factors that make the call site more // likely to be inlined, look at factors that make us not want to inline it. - // Don't inline into something too big, which would make it bigger. Here, we - // count each basic block as a single unit. + // Don't inline into something too big, which would make it bigger. // InlineCost += Caller->size()/20; - // Look at the size of the callee. Each basic block counts as 20 units, and - // each instruction counts as 5. - InlineCost += CalleeFI.NumInsts*5 + CalleeFI.NumBlocks*20; + // Look at the size of the callee. Each instruction counts as 5. + InlineCost += CalleeFI.NumInsts*5; return InlineCost; } @@ -258,9 +256,16 @@ float InlineCostAnalyzer::getInlineFudgeFactor(CallSite CS) { if (CalleeFI.NumBlocks == 0) CalleeFI.analyzeFunction(Callee); + float Factor = 1.0f; + // Single BB functions are often written to be inlined. + if (CalleeFI.NumBlocks == 1) + Factor += 0.5f; + // Be more aggressive if the function contains a good chunk (if it mades up // at least 10% of the instructions) of vector instructions. - if (CalleeFI.NumVectorInsts > CalleeFI.NumInsts/10) - return 1.5f; - return 1.0f; + if (CalleeFI.NumVectorInsts > CalleeFI.NumInsts/2) + Factor += 2.0f; + else if (CalleeFI.NumVectorInsts > CalleeFI.NumInsts/10) + Factor += 1.5f; + return Factor; } |
