diff options
author | Dehao Chen <dehao@google.com> | 2017-01-30 22:26:05 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-01-30 22:26:05 +0000 |
commit | 6217fa44b87f2213f7e8513d29b0ff8f8a1d6615 (patch) | |
tree | e26a63d460155a924440e249898463e0fab2e5ea /llvm/lib/Transforms/IPO/SampleProfile.cpp | |
parent | a2aee8fad074c28aff23db0751d4e4d80b8c1dd0 (diff) | |
download | bcm5719-llvm-6217fa44b87f2213f7e8513d29b0ff8f8a1d6615.tar.gz bcm5719-llvm-6217fa44b87f2213f7e8513d29b0ff8f8a1d6615.zip |
Revert r292979 which causes compile time failure.
llvm-svn: 293557
Diffstat (limited to 'llvm/lib/Transforms/IPO/SampleProfile.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 109dbe068ef..cba0a813c44 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -52,7 +52,6 @@ #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/IPO.h" -#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Utils/Cloning.h" #include <cctype> @@ -615,14 +614,14 @@ SampleProfileLoader::findFunctionSamples(const Instruction &Inst) const { /// Iteratively traverse all callsites of the function \p F, and find if /// the corresponding inlined instance exists and is hot in profile. If /// it is hot enough, inline the callsites and adds new callsites of the -/// callee into the caller. If the call is an indirect call, first promote -/// it to direct call. Each indirect call is limited with a single target. +/// callee into the caller. +/// +/// TODO: investigate the possibility of not invoking InlineFunction directly. /// /// \param F function to perform iterative inlining. /// /// \returns True if there is any inline happened. bool SampleProfileLoader::inlineHotFunctions(Function &F) { - DenseSet<Instruction *> PromotedInsns; bool Changed = false; LLVMContext &Ctx = F.getContext(); std::function<AssumptionCache &(Function &)> GetAssumptionCache = [&]( @@ -648,23 +647,10 @@ bool SampleProfileLoader::inlineHotFunctions(Function &F) { } for (auto I : CIS) { InlineFunctionInfo IFI(nullptr, ACT ? &GetAssumptionCache : nullptr); - Function *CalledFunction = CallSite(I).getCalledFunction(); - Instruction *DI = I; - if (!CalledFunction && !PromotedInsns.count(I)) { - CalledFunction = F.getParent()->getFunction( - findCalleeFunctionSamples(*I)->getName()); - if (CalledFunction) { - // The indirect target was promoted and inlined in the profile, as a - // result, we do not have profile info for the branch probability. - // We set the probability to 80% taken to indicate that the static - // call is likely taken. - DI = promoteIndirectCall(I, CalledFunction, 80, 100); - PromotedInsns.insert(I); - } - } + CallSite CS(I); + Function *CalledFunction = CS.getCalledFunction(); if (!CalledFunction || !CalledFunction->getSubprogram()) continue; - CallSite CS(DI); DebugLoc DLoc = I->getDebugLoc(); uint64_t NumSamples = findCalleeFunctionSamples(*I)->getTotalSamples(); if (InlineFunction(CS, IFI)) { |