diff options
author | Easwaran Raman <eraman@google.com> | 2017-09-13 20:16:02 +0000 |
---|---|---|
committer | Easwaran Raman <eraman@google.com> | 2017-09-13 20:16:02 +0000 |
commit | 4924bb002d0157fa795b743b4f427c71aa21fc63 (patch) | |
tree | eec1ad13ee3181e141277ed0a94a803f2639215e /llvm/lib/Analysis/InlineCost.cpp | |
parent | 3e635f2309f020a272ac613714387cfbf13d0e9e (diff) | |
download | bcm5719-llvm-4924bb002d0157fa795b743b4f427c71aa21fc63.tar.gz bcm5719-llvm-4924bb002d0157fa795b743b4f427c71aa21fc63.zip |
[Inliner] Add another way to compute full inline cost.
Summary:
Full inline cost is computed when -inline-cost-full is true or ORE is
non-null. This patch adds another way to compute full inline cost by
adding a field to InlineParams. This will be used by SampleProfileLoader
to check legality of inlining a callee that it wants to inline.
Reviewers: danielcdh, haicheng
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D37819
llvm-svn: 313185
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index 8cdf2046702..416298b51b7 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -82,7 +82,7 @@ static cl::opt<int> HotCallSiteRelFreq( "entry frequency, for a callsite to be hot in the absence of " "profile information.")); -static cl::opt<bool> ComputeFullInlineCost( +static cl::opt<bool> OptComputeFullInlineCost( "inline-cost-full", cl::Hidden, cl::init(false), cl::desc("Compute the full inline cost of a call site even when the cost " "exceeds the threshold.")); @@ -124,6 +124,7 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> { int Threshold; int Cost; + bool ComputeFullInlineCost; bool IsCallerRecursive; bool IsRecursiveCall; @@ -256,7 +257,9 @@ public: : TTI(TTI), GetAssumptionCache(GetAssumptionCache), GetBFI(GetBFI), PSI(PSI), F(Callee), DL(F.getParent()->getDataLayout()), ORE(ORE), CandidateCS(CSArg), Params(Params), Threshold(Params.DefaultThreshold), - Cost(0), IsCallerRecursive(false), IsRecursiveCall(false), + Cost(0), ComputeFullInlineCost(OptComputeFullInlineCost || + Params.ComputeFullInlineCost || ORE), + IsCallerRecursive(false), IsRecursiveCall(false), ExposesReturnsTwice(false), HasDynamicAlloca(false), ContainsNoDuplicateCall(false), HasReturn(false), HasIndirectBr(false), HasFrameEscape(false), AllocatedSize(0), NumInstructions(0), @@ -1722,9 +1725,6 @@ InlineCost llvm::getInlineCost( CS.isNoInline()) return llvm::InlineCost::getNever(); - if (ORE) - ComputeFullInlineCost = true; - DEBUG(llvm::dbgs() << " Analyzing call of " << Callee->getName() << "... (caller:" << Caller->getName() << ")\n"); |