LLVM  14.0.0git
MLInlineAdvisor.cpp
Go to the documentation of this file.
1 //===- MLInlineAdvisor.cpp - machine learned InlineAdvisor ----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the interface between the inliner and a learned model.
10 // It delegates model evaluation to either the AOT compiled model (the
11 // 'release' mode) or a runtime-loaded model (the 'development' case).
12 //
13 //===----------------------------------------------------------------------===//
14 #include "llvm/Config/config.h"
15 #if defined(LLVM_HAVE_TF_AOT) || defined(LLVM_HAVE_TF_API)
16 
17 #include <limits>
18 #include <unordered_map>
19 #include <unordered_set>
20 
21 #include "llvm/ADT/SCCIterator.h"
30 #include "llvm/IR/InstIterator.h"
31 #include "llvm/IR/Instructions.h"
32 #include "llvm/IR/PassManager.h"
34 #include "llvm/Support/Path.h"
35 
36 using namespace llvm;
37 
38 #define DEBUG_TYPE "inline-ml"
39 
40 static cl::opt<float> SizeIncreaseThreshold(
41  "ml-advisor-size-increase-threshold", cl::Hidden,
42  cl::desc("Maximum factor by which expected native size may increase before "
43  "blocking any further inlining."),
44  cl::init(2.0));
45 
46 // clang-format off
47 const std::array<std::string, NumberOfFeatures> llvm::FeatureNameMap{
48 // InlineCost features - these must come first
49 #define POPULATE_NAMES(INDEX_NAME, NAME) NAME,
50  INLINE_COST_FEATURE_ITERATOR(POPULATE_NAMES)
51 #undef POPULATE_NAMES
52 
53 // Non-cost features
54 #define POPULATE_NAMES(INDEX_NAME, NAME, COMMENT) NAME,
55  INLINE_FEATURE_ITERATOR(POPULATE_NAMES)
56 #undef POPULATE_NAMES
57 };
58 // clang-format on
59 
60 const char *const llvm::DecisionName = "inlining_decision";
61 const char *const llvm::DefaultDecisionName = "inlining_default";
62 const char *const llvm::RewardName = "delta_size";
63 
64 CallBase *getInlinableCS(Instruction &I) {
65  if (auto *CS = dyn_cast<CallBase>(&I))
66  if (Function *Callee = CS->getCalledFunction()) {
67  if (!Callee->isDeclaration()) {
68  return CS;
69  }
70  }
71  return nullptr;
72 }
73 
75  std::unique_ptr<MLModelRunner> Runner)
76  : InlineAdvisor(
77  M, MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager()),
78  ModelRunner(std::move(Runner)), CG(new CallGraph(M)),
79  InitialIRSize(getModuleIRSize()), CurrentIRSize(InitialIRSize) {
80  assert(ModelRunner);
81 
82  // Extract the 'call site height' feature - the position of a call site
83  // relative to the farthest statically reachable SCC node. We don't mutate
84  // this value while inlining happens. Empirically, this feature proved
85  // critical in behavioral cloning - i.e. training a model to mimic the manual
86  // heuristic's decisions - and, thus, equally important for training for
87  // improvement.
88  for (auto I = scc_begin(CG.get()); !I.isAtEnd(); ++I) {
89  const std::vector<CallGraphNode *> &CGNodes = *I;
90  unsigned Level = 0;
91  for (auto *CGNode : CGNodes) {
92  Function *F = CGNode->getFunction();
93  if (!F || F->isDeclaration())
94  continue;
95  for (auto &I : instructions(F)) {
96  if (auto *CS = getInlinableCS(I)) {
97  auto *Called = CS->getCalledFunction();
98  auto Pos = FunctionLevels.find(Called);
99  // In bottom up traversal, an inlinable callee is either in the
100  // same SCC, or to a function in a visited SCC. So not finding its
101  // level means we haven't visited it yet, meaning it's in this SCC.
102  if (Pos == FunctionLevels.end())
103  continue;
104  Level = std::max(Level, Pos->second + 1);
105  }
106  }
107  }
108  for (auto *CGNode : CGNodes) {
109  Function *F = CGNode->getFunction();
110  if (F && !F->isDeclaration())
111  FunctionLevels[F] = Level;
112  }
113  }
114 }
115 
117  // Function passes executed between InlinerPass runs may have changed the
118  // module-wide features.
119  NodeCount = 0;
120  EdgeCount = 0;
121  for (auto &F : M)
122  if (!F.isDeclaration()) {
123  ++NodeCount;
124  EdgeCount += getLocalCalls(F);
125  }
126 }
127 
130  .DirectCallsToDefinedFunctions;
131 }
132 
133 // Update the internal state of the advisor, and force invalidate feature
134 // analysis. Currently, we maintain minimal (and very simple) global state - the
135 // number of functions and the number of static calls. We also keep track of the
136 // total IR size in this module, to stop misbehaving policies at a certain bloat
137 // factor (SizeIncreaseThreshold)
139  bool CalleeWasDeleted) {
140  assert(!ForceStop);
141  Function *Caller = Advice.getCaller();
142  Function *Callee = Advice.getCallee();
143 
144  // The caller features aren't valid anymore.
145  {
148  FAM.invalidate(*Caller, PA);
149  }
150  int64_t IRSizeAfter =
151  getIRSize(*Caller) + (CalleeWasDeleted ? 0 : Advice.CalleeIRSize);
152  CurrentIRSize += IRSizeAfter - (Advice.CallerIRSize + Advice.CalleeIRSize);
153  if (CurrentIRSize > SizeIncreaseThreshold * InitialIRSize)
154  ForceStop = true;
155 
156  // We can delta-update module-wide features. We know the inlining only changed
157  // the caller, and maybe the callee (by deleting the latter).
158  // Nodes are simple to update.
159  // For edges, we 'forget' the edges that the caller and callee used to have
160  // before inlining, and add back what they currently have together.
161  int64_t NewCallerAndCalleeEdges =
163  .DirectCallsToDefinedFunctions;
164 
165  if (CalleeWasDeleted)
166  --NodeCount;
167  else
168  NewCallerAndCalleeEdges +=
170  .DirectCallsToDefinedFunctions;
171  EdgeCount += (NewCallerAndCalleeEdges - Advice.CallerAndCalleeEdges);
172  assert(CurrentIRSize >= 0 && EdgeCount >= 0 && NodeCount >= 0);
173 }
174 
175 int64_t MLInlineAdvisor::getModuleIRSize() const {
176  int64_t Ret = 0;
177  for (auto &F : CG->getModule())
178  if (!F.isDeclaration())
179  Ret += getIRSize(F);
180  return Ret;
181 }
182 
183 std::unique_ptr<InlineAdvice> MLInlineAdvisor::getAdviceImpl(CallBase &CB) {
184  auto &Caller = *CB.getCaller();
185  auto &Callee = *CB.getCalledFunction();
186 
187  auto GetAssumptionCache = [&](Function &F) -> AssumptionCache & {
189  };
190  auto &TIR = FAM.getResult<TargetIRAnalysis>(Callee);
192 
193  auto MandatoryKind = InlineAdvisor::getMandatoryKind(CB, FAM, ORE);
194  // If this is a "never inline" case, there won't be any changes to internal
195  // state we need to track, so we can just return the base InlineAdvice, which
196  // will do nothing interesting.
197  // Same thing if this is a recursive case.
198  if (MandatoryKind == InlineAdvisor::MandatoryInliningKind::Never ||
199  &Caller == &Callee)
200  return getMandatoryAdvice(CB, false);
201 
202  bool Mandatory =
204 
205  // If we need to stop, we won't want to track anymore any state changes, so
206  // we just return the base InlineAdvice, which acts as a noop.
207  if (ForceStop) {
208  ORE.emit([&] {
209  return OptimizationRemarkMissed(DEBUG_TYPE, "ForceStop", &CB)
210  << "Won't attempt inlining because module size grew too much.";
211  });
212  return std::make_unique<InlineAdvice>(this, CB, ORE, Mandatory);
213  }
214 
215  int CostEstimate = 0;
216  if (!Mandatory) {
217  auto IsCallSiteInlinable =
218  llvm::getInliningCostEstimate(CB, TIR, GetAssumptionCache);
219  if (!IsCallSiteInlinable) {
220  // We can't inline this for correctness reasons, so return the base
221  // InlineAdvice, as we don't care about tracking any state changes (which
222  // won't happen).
223  return std::make_unique<InlineAdvice>(this, CB, ORE, false);
224  }
225  CostEstimate = *IsCallSiteInlinable;
226  }
227 
228  const auto CostFeatures =
229  llvm::getInliningCostFeatures(CB, TIR, GetAssumptionCache);
230  if (!CostFeatures) {
231  return std::make_unique<InlineAdvice>(this, CB, ORE, false);
232  }
233 
234  if (Mandatory)
235  return getMandatoryAdvice(CB, true);
236 
237  auto NrCtantParams = 0;
238  for (auto I = CB.arg_begin(), E = CB.arg_end(); I != E; ++I) {
239  NrCtantParams += (isa<Constant>(*I));
240  }
241 
242  auto &CallerBefore = FAM.getResult<FunctionPropertiesAnalysis>(Caller);
243  auto &CalleeBefore = FAM.getResult<FunctionPropertiesAnalysis>(Callee);
244 
245  ModelRunner->setFeature(FeatureIndex::CalleeBasicBlockCount,
246  CalleeBefore.BasicBlockCount);
247  ModelRunner->setFeature(FeatureIndex::CallSiteHeight,
248  FunctionLevels[&Caller]);
249  ModelRunner->setFeature(FeatureIndex::NodeCount, NodeCount);
250  ModelRunner->setFeature(FeatureIndex::NrCtantParams, NrCtantParams);
251  ModelRunner->setFeature(FeatureIndex::EdgeCount, EdgeCount);
252  ModelRunner->setFeature(FeatureIndex::CallerUsers, CallerBefore.Uses);
253  ModelRunner->setFeature(FeatureIndex::CallerConditionallyExecutedBlocks,
254  CallerBefore.BlocksReachedFromConditionalInstruction);
255  ModelRunner->setFeature(FeatureIndex::CallerBasicBlockCount,
256  CallerBefore.BasicBlockCount);
257  ModelRunner->setFeature(FeatureIndex::CalleeConditionallyExecutedBlocks,
258  CalleeBefore.BlocksReachedFromConditionalInstruction);
259  ModelRunner->setFeature(FeatureIndex::CalleeUsers, CalleeBefore.Uses);
260  ModelRunner->setFeature(FeatureIndex::CostEstimate, CostEstimate);
261 
262  // Add the cost features
263  for (size_t I = 0;
264  I < static_cast<size_t>(InlineCostFeatureIndex::NumberOfFeatures); ++I) {
265  ModelRunner->setFeature(
267  CostFeatures->at(I));
268  }
269 
270  return getAdviceFromModel(CB, ORE);
271 }
272 
273 std::unique_ptr<MLInlineAdvice>
276  return std::make_unique<MLInlineAdvice>(this, CB, ORE, ModelRunner->run());
277 }
278 
279 std::unique_ptr<InlineAdvice> MLInlineAdvisor::getMandatoryAdvice(CallBase &CB,
280  bool Advice) {
281  // Make sure we track inlinings in all cases - mandatory or not.
282  if (Advice && !ForceStop)
283  return getMandatoryAdviceImpl(CB);
284 
285  // If this is a "never inline" case, there won't be any changes to internal
286  // state we need to track, so we can just return the base InlineAdvice, which
287  // will do nothing interesting.
288  // Same if we are forced to stop - we don't track anymore.
289  return std::make_unique<InlineAdvice>(this, CB, getCallerORE(CB), Advice);
290 }
291 
292 std::unique_ptr<MLInlineAdvice>
294  return std::make_unique<MLInlineAdvice>(this, CB, getCallerORE(CB), true);
295 }
296 
297 void MLInlineAdvice::reportContextForRemark(
299  using namespace ore;
300  OR << NV("Callee", Callee->getName());
301  for (size_t I = 0; I < NumberOfFeatures; ++I)
302  OR << NV(FeatureNameMap[I], getAdvisor()->getModelRunner().getFeature(I));
303  OR << NV("ShouldInline", isInliningRecommended());
304 }
305 
307  ORE.emit([&]() {
308  OptimizationRemark R(DEBUG_TYPE, "InliningSuccess", DLoc, Block);
309  reportContextForRemark(R);
310  return R;
311  });
312  getAdvisor()->onSuccessfulInlining(*this, /*CalleeWasDeleted*/ false);
313 }
314 
316  ORE.emit([&]() {
317  OptimizationRemark R(DEBUG_TYPE, "InliningSuccessWithCalleeDeleted", DLoc,
318  Block);
319  reportContextForRemark(R);
320  return R;
321  });
322  getAdvisor()->onSuccessfulInlining(*this, /*CalleeWasDeleted*/ true);
323 }
324 
326  const InlineResult &Result) {
327  ORE.emit([&]() {
328  OptimizationRemarkMissed R(DEBUG_TYPE, "InliningAttemptedAndUnsuccessful",
329  DLoc, Block);
330  reportContextForRemark(R);
331  return R;
332  });
333 }
335  ORE.emit([&]() {
336  OptimizationRemarkMissed R(DEBUG_TYPE, "IniningNotAttempted", DLoc, Block);
337  reportContextForRemark(R);
338  return R;
339  });
340 }
341 #endif // defined(LLVM_HAVE_TF_AOT) || defined(LLVM_HAVE_TF_API)
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm::MLInlineAdvisor::getLocalCalls
int64_t getLocalCalls(Function &F)
llvm::TargetIRAnalysis
Analysis pass providing the TargetTransformInfo.
Definition: TargetTransformInfo.h:2331
INLINE_COST_FEATURE_ITERATOR
#define INLINE_COST_FEATURE_ITERATOR(M)
Definition: InlineModelFeatureMaps.h:22
llvm::OptimizationRemarkMissed
Diagnostic information for missed-optimization remarks.
Definition: DiagnosticInfo.h:730
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::ISD::OR
@ OR
Definition: ISDOpcodes.h:633
llvm::inlineCostFeatureToMlFeature
constexpr FeatureIndex inlineCostFeatureToMlFeature(InlineCostFeatureIndex Feature)
Definition: InlineModelFeatureMaps.h:123
llvm::InlineAdvisor::M
Module & M
Definition: InlineAdvisor.h:166
SCCIterator.h
llvm::AnalysisManager::getResult
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:785
InstIterator.h
llvm::Function
Definition: Function.h:61
llvm::AnalysisManager::invalidate
void invalidate(IRUnitT &IR, const PreservedAnalyses &PA)
Invalidate cached analyses for an IR unit.
Definition: PassManagerImpl.h:89
llvm::MLInlineAdvisor::onSuccessfulInlining
void onSuccessfulInlining(const MLInlineAdvice &Advice, bool CalleeWasDeleted)
MLModelRunner.h
Path.h
OptimizationRemarkEmitter.h
llvm::CallGraph
The basic data container for the call graph of a Module of IR.
Definition: CallGraph.h:73
llvm::PreservedAnalyses::abandon
void abandon()
Mark an analysis as abandoned.
Definition: PassManager.h:209
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::RewardName
const char *const RewardName
llvm::InlineAdvisor::MandatoryInliningKind::Always
@ Always
llvm::ore::NV
DiagnosticInfoOptimizationBase::Argument NV
Definition: OptimizationRemarkEmitter.h:136
llvm::InlineAdvisor::MandatoryInliningKind::Never
@ Never
llvm::MLInlineAdvisor::ModelRunner
std::unique_ptr< MLModelRunner > ModelRunner
Definition: MLInlineAdvisor.h:53
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
llvm::CallBase::arg_begin
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
Definition: InstrTypes.h:1303
llvm::MLInlineAdvice::CalleeIRSize
const int64_t CalleeIRSize
Definition: MLInlineAdvisor.h:95
llvm::DiagnosticInfoOptimizationBase
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
Definition: DiagnosticInfo.h:409
llvm::DefaultDecisionName
const char *const DefaultDecisionName
new
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM ID Predecessors according to mbb< bb27, 0x8b0a7c0 > Note ADDri is not a two address instruction its result reg1037 is an operand of the PHI node in bb76 and its operand reg1039 is the result of the PHI node We should treat it as a two address code and make sure the ADDri is scheduled after any node that reads reg1039 Use info(i.e. register scavenger) to assign it a free register to allow reuse the collector could move the objects and invalidate the derived pointer This is bad enough in the first but safe points can crop up unpredictably **array_addr i32 n y store obj * new
Definition: README.txt:125
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:193
llvm::MLInlineAdvice::getCallee
Function * getCallee() const
Definition: MLInlineAdvisor.h:92
llvm::InlineAdvisor::getCallerORE
OptimizationRemarkEmitter & getCallerORE(CallBase &CB)
Definition: InlineAdvisor.cpp:514
llvm::MLInlineAdvice::recordUnattemptedInliningImpl
void recordUnattemptedInliningImpl() override
CommandLine.h
llvm::MLInlineAdvisor::getMandatoryAdvice
std::unique_ptr< InlineAdvice > getMandatoryAdvice(CallBase &CB, bool Advice) override
llvm::MLInlineAdvisor::onPassEntry
void onPassEntry() override
This must be called when the Inliner pass is entered, to allow the InlineAdvisor update internal stat...
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::InlineAdvice::ORE
OptimizationRemarkEmitter & ORE
Definition: InlineAdvisor.h:103
llvm::CallBase::getCalledFunction
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
Definition: InstrTypes.h:1393
MAM
ModuleAnalysisManager MAM
Definition: PassBuilderBindings.cpp:61
TargetLibraryInfo.h
llvm::InlineCostFeatureIndex
InlineCostFeatureIndex
Definition: InlineModelFeatureMaps.h:49
llvm::pdb::PDB_SymType::Caller
@ Caller
llvm::Instruction
Definition: Instruction.h:45
llvm::MLInlineAdvisor::getIRSize
int64_t getIRSize(const Function &F) const
Definition: MLInlineAdvisor.h:34
llvm::MLInlineAdvice::getCaller
Function * getCaller() const
Definition: MLInlineAdvisor.h:91
llvm::MLInlineAdvice::recordUnsuccessfulInliningImpl
void recordUnsuccessfulInliningImpl(const InlineResult &Result) override
llvm::CallBase::getCaller
Function * getCaller()
Helper to get the caller (the parent function).
Definition: Instructions.cpp:282
llvm::scc_begin
scc_iterator< T > scc_begin(const T &G)
Construct the begin iterator for a deduced graph type T.
Definition: SCCIterator.h:228
llvm::FeatureNameMap
const std::array< std::string, NumberOfFeatures > FeatureNameMap
llvm::cl::opt
Definition: CommandLine.h:1434
llvm::instructions
inst_range instructions(Function *F)
Definition: InstIterator.h:133
llvm::MLInlineAdvice::recordInliningWithCalleeDeletedImpl
void recordInliningWithCalleeDeletedImpl() override
llvm::AssumptionAnalysis
A function analysis which provides an AssumptionCache.
Definition: AssumptionCache.h:169
llvm::MLInlineAdvisor::MLInlineAdvisor
MLInlineAdvisor(Module &M, ModuleAnalysisManager &MAM, std::unique_ptr< MLModelRunner > ModelRunner)
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::InlineAdvice::Block
const BasicBlock *const Block
Definition: InlineAdvisor.h:102
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
llvm::MLInlineAdvice::CallerAndCalleeEdges
const int64_t CallerAndCalleeEdges
Definition: MLInlineAdvisor.h:96
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1605
llvm::OptimizationRemarkEmitter::emit
void emit(DiagnosticInfoOptimizationBase &OptDiag)
Output the remark via the diagnostic handler and to the optimization record file.
Definition: OptimizationRemarkEmitter.cpp:77
llvm::InlineAdvice::DLoc
const DebugLoc DLoc
Definition: InlineAdvisor.h:101
InlineCost.h
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::CallBase::arg_end
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
Definition: InstrTypes.h:1309
llvm::InlineAdvice::isInliningRecommended
bool isInliningRecommended() const
Get the inlining recommendation.
Definition: InlineAdvisor.h:83
llvm::FunctionPropertiesAnalysis
Definition: FunctionPropertiesAnalysis.h:63
DEBUG_TYPE
#define DEBUG_TYPE
Definition: BlockFrequencyInfoImpl.h:51
llvm::OptimizationRemarkEmitter
The optimization diagnostic interface.
Definition: OptimizationRemarkEmitter.h:33
llvm::AssumptionCache
A cache of @llvm.assume calls within a function.
Definition: AssumptionCache.h:41
llvm::InlineAdvisor
Interface for deciding whether to inline a call site or not.
Definition: InlineAdvisor.h:136
llvm::PICLevel::Level
Level
Definition: CodeGen.h:33
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:297
llvm::MLInlineAdvisor::getAdviceImpl
std::unique_ptr< InlineAdvice > getAdviceImpl(CallBase &CB) override
llvm::DecisionName
const char *const DecisionName
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:206
FunctionPropertiesAnalysis.h
llvm::MLInlineAdvice::recordInliningImpl
void recordInliningImpl() override
llvm::InlineAdvisor::FAM
FunctionAnalysisManager & FAM
Definition: InlineAdvisor.h:167
std
Definition: BitVector.h:838
llvm::PreservedAnalyses::all
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:161
llvm::getInliningCostFeatures
Optional< InlineCostFeatures > getInliningCostFeatures(CallBase &Call, TargetTransformInfo &CalleeTTI, function_ref< AssumptionCache &(Function &)> GetAssumptionCache, function_ref< BlockFrequencyInfo &(Function &)> GetBFI=nullptr, ProfileSummaryInfo *PSI=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
Get the expanded cost features.
Definition: InlineCost.cpp:2788
PassManager.h
llvm::MLInlineAdvice::CallerIRSize
const int64_t CallerIRSize
Definition: MLInlineAdvisor.h:94
llvm::InlineCostFeatureIndex::NumberOfFeatures
@ NumberOfFeatures
MLInlineAdvisor.h
CallGraph.h
llvm::InlineAdvisor::getMandatoryKind
static MandatoryInliningKind getMandatoryKind(CallBase &CB, FunctionAnalysisManager &FAM, OptimizationRemarkEmitter &ORE)
Definition: InlineAdvisor.cpp:482
llvm::MLInlineAdvisor::getMandatoryAdviceImpl
virtual std::unique_ptr< MLInlineAdvice > getMandatoryAdviceImpl(CallBase &CB)
llvm::getInliningCostEstimate
Optional< int > getInliningCostEstimate(CallBase &Call, TargetTransformInfo &CalleeTTI, function_ref< AssumptionCache &(Function &)> GetAssumptionCache, function_ref< BlockFrequencyInfo &(Function &)> GetBFI=nullptr, ProfileSummaryInfo *PSI=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
Get the cost estimate ignoring thresholds.
Definition: InlineCost.cpp:2763
llvm::OptimizationRemark
Diagnostic information for applied optimization remarks.
Definition: DiagnosticInfo.h:685
Instructions.h
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:340
TargetTransformInfo.h
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1161
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::InnerAnalysisManagerProxy
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
Definition: PassManager.h:942
llvm::MLInlineAdvisor::getAdviceFromModel
virtual std::unique_ptr< MLInlineAdvice > getAdviceFromModel(CallBase &CB, OptimizationRemarkEmitter &ORE)
llvm::cl::desc
Definition: CommandLine.h:414
llvm::NumberOfFeatures
constexpr size_t NumberOfFeatures
Definition: InlineModelFeatureMaps.h:127
INLINE_FEATURE_ITERATOR
#define INLINE_FEATURE_ITERATOR(M)
Definition: InlineModelFeatureMaps.h:81
llvm::MLInlineAdvice
InlineAdvice that tracks changes post inlining.
Definition: MLInlineAdvisor.h:71
llvm::OptimizationRemarkEmitterAnalysis
Definition: OptimizationRemarkEmitter.h:164
llvm::InlineResult
InlineResult is basically true or false.
Definition: InlineCost.h:159
llvm::InlineAdvice::Callee
Function *const Callee
Definition: InlineAdvisor.h:96