Skip to content

Commit 8811c8d

Browse files
committed
[InlineAdvisor] Add option to control deferred inlining (NFC)
This change is split out from D115497 to add the option independently from the switch of the default value.
1 parent 8404254 commit 8811c8d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

llvm/include/llvm/Analysis/InlineCost.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ struct InlineParams {
212212
Optional<bool> ComputeFullInlineCost;
213213

214214
/// Indicate whether we should allow inline deferral.
215-
Optional<bool> EnableDeferral = true;
215+
Optional<bool> EnableDeferral;
216216
};
217217

218218
/// Generate the parameters to tune the inline cost analysis based only on the

llvm/lib/Analysis/InlineAdvisor.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ static cl::opt<bool>
4040
" callsites processed by inliner but decided"
4141
" to be not inlined"));
4242

43+
static cl::opt<bool> EnableInlineDeferral("inline-deferral", cl::init(true),
44+
cl::Hidden,
45+
cl::desc("Enable deferred inlining"));
46+
4347
// An integer used to limit the cost of inline deferral. The default negative
4448
// number tells shouldBeDeferred to only take the secondary cost into account.
4549
static cl::opt<int>
@@ -100,8 +104,9 @@ llvm::Optional<llvm::InlineCost> static getDefaultInlineAdvice(
100104
return getInlineCost(CB, Params, CalleeTTI, GetAssumptionCache, GetTLI,
101105
GetBFI, PSI, RemarksEnabled ? &ORE : nullptr);
102106
};
103-
return llvm::shouldInline(CB, GetInlineCost, ORE,
104-
Params.EnableDeferral.getValueOr(false));
107+
return llvm::shouldInline(
108+
CB, GetInlineCost, ORE,
109+
Params.EnableDeferral.getValueOr(EnableInlineDeferral));
105110
}
106111

107112
std::unique_ptr<InlineAdvice>

0 commit comments

Comments
 (0)