diff options
author | Dehao Chen <dehao@google.com> | 2017-06-08 20:11:57 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-06-08 20:11:57 +0000 |
commit | e2a428bad768ba4d60de28bd7ad8864fe111e891 (patch) | |
tree | 8a73c864a16dd71fbeda8b65e7785f07ac5c24da /llvm/lib/Transforms/IPO/SampleProfile.cpp | |
parent | 3b8974b51b4c561077ef44a2de78984d14e2bb1f (diff) | |
download | bcm5719-llvm-e2a428bad768ba4d60de28bd7ad8864fe111e891.tar.gz bcm5719-llvm-e2a428bad768ba4d60de28bd7ad8864fe111e891.zip |
Do not early-inline recursive calls in sample profile loader.
Summary: Early-inlining of recursive call makes the code size bloat exponentially. We should not disable it.
Reviewers: davidxl, dnovillo, iteratee
Reviewed By: iteratee
Subscribers: iteratee, llvm-commits, sanjoy
Differential Revision: https://reviews.llvm.org/D34017
llvm-svn: 305009
Diffstat (limited to 'llvm/lib/Transforms/IPO/SampleProfile.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index e755e2bd8f2..67bc8f5f6b7 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -695,6 +695,13 @@ bool SampleProfileLoader::inlineHotFunctions( CallSite(I).isIndirectCall()) for (const auto *FS : findIndirectCallFunctionSamples(*I)) { auto CalleeFunctionName = FS->getName(); + // If it is a recursive call, we do not inline it as it could bloat + // the code exponentially. There is way to better handle this, e.g. + // clone the caller first, and inline the cloned caller if it is + // recursive. As llvm does not inline recursive calls, we will simply + // ignore it instead of handling it explicitly. + if (CalleeFunctionName == F.getName()) + continue; const char *Reason = "Callee function not available"; auto R = SymbolMap.find(CalleeFunctionName); if (R == SymbolMap.end()) |