diff --git a/llvm/include/llvm/Analysis/InlineCost.h b/llvm/include/llvm/Analysis/InlineCost.h index b22841343b1a..776749b9a07f 100644 --- a/llvm/include/llvm/Analysis/InlineCost.h +++ b/llvm/include/llvm/Analysis/InlineCost.h @@ -212,7 +212,7 @@ struct InlineParams { Optional ComputeFullInlineCost; /// Indicate whether we should allow inline deferral. - Optional EnableDeferral = true; + Optional EnableDeferral; /// Indicate whether we allow inlining for recursive call. Optional AllowRecursiveCall = false; diff --git a/llvm/lib/Analysis/InlineAdvisor.cpp b/llvm/lib/Analysis/InlineAdvisor.cpp index ce34c8440db5..45c45f36b17b 100644 --- a/llvm/lib/Analysis/InlineAdvisor.cpp +++ b/llvm/lib/Analysis/InlineAdvisor.cpp @@ -40,6 +40,10 @@ static cl::opt " callsites processed by inliner but decided" " to be not inlined")); +static cl::opt EnableInlineDeferral("inline-deferral", cl::init(true), + cl::Hidden, + cl::desc("Enable deferred inlining")); + // An integer used to limit the cost of inline deferral. The default negative // number tells shouldBeDeferred to only take the secondary cost into account. static cl::opt @@ -136,8 +140,9 @@ llvm::Optional static getDefaultInlineAdvice( return getInlineCost(CB, Params, CalleeTTI, GetAssumptionCache, GetTLI, GetBFI, PSI, RemarksEnabled ? &ORE : nullptr); }; - return llvm::shouldInline(CB, GetInlineCost, ORE, - Params.EnableDeferral.getValueOr(false)); + return llvm::shouldInline( + CB, GetInlineCost, ORE, + Params.EnableDeferral.getValueOr(EnableInlineDeferral)); } std::unique_ptr