9#ifndef LLVM_ANALYSIS_MLINLINEADVISOR_H
10#define LLVM_ANALYSIS_MLINLINEADVISOR_H
23class DiagnosticInfoOptimizationBase;
26class ProfileSummaryInfo;
43 bool CalleeWasDeleted);
54 bool Advice)
override;
58 virtual std::unique_ptr<MLInlineAdvice>
70 int64_t getModuleIRSize()
const;
71 std::unique_ptr<InlineAdvice>
72 getSkipAdviceIfUnreachableCallsite(
CallBase &CB);
78 mutable std::map<const Function *, FunctionPropertiesInfo> FPICache;
82 int64_t NodeCount = 0;
83 int64_t EdgeCount = 0;
84 int64_t EdgesOfLastSeenNodes = 0;
86 std::map<const LazyCallGraph::Node *, unsigned> FunctionLevels;
87 const int32_t InitialIRSize = 0;
88 int32_t CurrentIRSize = 0;
92 bool ForceStop =
false;
125 std::optional<FunctionPropertiesUpdater> FPU;
Implements a lazy call graph analysis and related passes for the new pass manager.
Machine Check Debug Module
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
This header defines various interfaces for pass management in LLVM.
A container for analyses that lazily runs them and caches their results.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Implements a dense probed hash-table based set.
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
int64_t TotalInstructionCount
Capture state between an inlining decision having had been made, and its impact being observable.
Function *const Caller
Caller and Callee are pre-inlining.
OptimizationRemarkEmitter & ORE
InlineAdvisor *const Advisor
Interface for deciding whether to inline a call site or not.
InlineResult is basically true or false.
An SCC of the call graph.
A lazily constructed view of the call graph of a module.
InlineAdvice that tracks changes post inlining.
void updateCachedCallerFPI(FunctionAnalysisManager &FAM) const
virtual ~MLInlineAdvice()=default
const int64_t CallerIRSize
const int64_t CalleeIRSize
void recordInliningImpl() override
Function * getCaller() const
const int64_t CallerAndCalleeEdges
void recordUnsuccessfulInliningImpl(const InlineResult &Result) override
Function * getCallee() const
void recordInliningWithCalleeDeletedImpl() override
void recordUnattemptedInliningImpl() override
std::unique_ptr< MLModelRunner > ModelRunner
FunctionPropertiesInfo & getCachedFPI(Function &) const
void onPassExit(LazyCallGraph::SCC *SCC) override
This must be called when the Inliner pass is exited, as function passes may be run subsequently.
const MLModelRunner & getModelRunner() const
void onSuccessfulInlining(const MLInlineAdvice &Advice, bool CalleeWasDeleted)
virtual std::unique_ptr< MLInlineAdvice > getMandatoryAdviceImpl(CallBase &CB)
void onPassEntry(LazyCallGraph::SCC *SCC) override
This must be called when the Inliner pass is entered, to allow the InlineAdvisor update internal stat...
int64_t getLocalCalls(Function &F)
virtual std::unique_ptr< MLInlineAdvice > getAdviceFromModel(CallBase &CB, OptimizationRemarkEmitter &ORE)
int64_t getIRSize(Function &F) const
std::function< bool(CallBase &)> GetDefaultAdvice
std::unique_ptr< InlineAdvice > getAdviceImpl(CallBase &CB) override
std::unique_ptr< InlineAdvice > getMandatoryAdvice(CallBase &CB, bool Advice) override
virtual ~MLInlineAdvisor()=default
bool isForcedToStop() const
unsigned getInitialFunctionLevel(const Function &F) const
MLModelRunner interface: abstraction of a mechanism for evaluating a ML model.
A Module instance is used to store all the information related to an LLVM module.
Analysis providing profile information.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.