diff options
author | Piotr Padlewski <piotr.padlewski@gmail.com> | 2016-09-29 17:32:07 +0000 |
---|---|---|
committer | Piotr Padlewski <piotr.padlewski@gmail.com> | 2016-09-29 17:32:07 +0000 |
commit | ba72b95f7bf2e3ea7fc49fa282c694ecf9f4fb62 (patch) | |
tree | 4907ad54fdf10e5d7cc780830577c98c5e5aff74 /llvm/lib/Transforms/IPO | |
parent | 3ace13adfa7a296595c3569d0e9bfc262aff33b5 (diff) | |
download | bcm5719-llvm-ba72b95f7bf2e3ea7fc49fa282c694ecf9f4fb62.tar.gz bcm5719-llvm-ba72b95f7bf2e3ea7fc49fa282c694ecf9f4fb62.zip |
[thinlto] Add cold-callsite import heuristic
Summary:
Not tunned up heuristic, but with this small heuristic there is about
+0.10% improvement on SPEC 2006
Reviewers: tejohnson, mehdi_amini, eraman
Subscribers: mehdi_amini, llvm-commits
Differential Revision: https://reviews.llvm.org/D24940
llvm-svn: 282733
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 6c43b780870..58877b1dc05 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -48,10 +48,15 @@ static cl::opt<float> cl::desc("As we import functions, multiply the " "`import-instr-limit` threshold by this factor " "before processing newly imported functions")); + static cl::opt<float> ImportHotMultiplier( "import-hot-multiplier", cl::init(3.0), cl::Hidden, cl::value_desc("x"), - cl::ZeroOrMore, cl::desc("Multiply the `import-instr-limit` threshold for " - "hot callsites")); + cl::desc("Multiply the `import-instr-limit` threshold for hot callsites")); + +// FIXME: This multiplier was not really tuned up. +static cl::opt<float> ImportColdMultiplier( + "import-cold-multiplier", cl::init(0), cl::Hidden, cl::value_desc("N"), + cl::desc("Multiply the `import-instr-limit` threshold for cold callsites")); static cl::opt<bool> PrintImports("print-imports", cl::init(false), cl::Hidden, cl::desc("Print imported functions")); @@ -285,11 +290,16 @@ static void computeImportForFunction( continue; } - // FIXME: Also lower the threshold for cold callsites. + auto GetBonusMultiplier = [](CalleeInfo::HotnessType Hotness) -> float { + if (Hotness == CalleeInfo::HotnessType::Hot) + return ImportHotMultiplier; + if (Hotness == CalleeInfo::HotnessType::Cold) + return ImportColdMultiplier; + return 1.0; + }; + const auto NewThreshold = - Edge.second.Hotness == CalleeInfo::HotnessType::Hot - ? Threshold * ImportHotMultiplier - : Threshold; + Threshold * GetBonusMultiplier(Edge.second.Hotness); auto *CalleeSummary = selectCallee(GUID, NewThreshold, Index); if (!CalleeSummary) { DEBUG(dbgs() << "ignored! No qualifying callee with summary found.\n"); |