28 :
F(
F), BFI(nullptr) {
29 if (!
F->getContext().getDiagnosticsHotnessRequested())
44 OwnedBFI = std::make_unique<BlockFrequencyInfo>(*
F, BPI, LI);
64std::optional<uint64_t>
65OptimizationRemarkEmitter::computeHotness(
const Value *V) {
72void OptimizationRemarkEmitter::computeHotness(
81 auto &OptDiag = cast<DiagnosticInfoIROptimization>(OptDiagBase);
82 computeHotness(OptDiag);
103 if (Context.getDiagnosticsHotnessRequested()) {
104 BFI = &getAnalysis<LazyBlockFrequencyInfoPass>().getBFI();
106 if (Context.isDiagnosticsHotnessThresholdSetFromPSI()) {
108 &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI())
109 Context.setDiagnosticsHotnessThreshold(
110 PSI->getOrCompHotCountThreshold());
115 ORE = std::make_unique<OptimizationRemarkEmitter>(&Fn, BFI);
132 auto &Context =
F.getContext();
134 if (Context.getDiagnosticsHotnessRequested()) {
137 if (Context.isDiagnosticsHotnessThresholdSetFromPSI()) {
141 Context.setDiagnosticsHotnessThreshold(
142 PSI->getOrCompHotCountThreshold());
151static const char ore_name[] =
"Optimization Remark Emitter";
152#define ORE_NAME "opt-remark-emitter"
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
API to communicate dependencies between analyses during invalidation.
bool invalidate(IRUnitT &IR, const PreservedAnalyses &PA)
Trigger the invalidation of some other analysis pass if not already handled and return whether it was...
A container for analyses that lazily runs them and caches their results.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
Analysis pass which computes BlockFrequencyInfo.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
std::optional< uint64_t > getBlockProfileCount(const BasicBlock *BB, bool AllowSynthetic=false) const
Returns the estimated profile count of BB.
Analysis providing branch probability information.
Common features for diagnostics dealing with optimization remarks that are used by IR passes.
const Value * getCodeRegion() const
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
void setHotness(std::optional< uint64_t > H)
std::optional< uint64_t > getHotness() const
void recalculate(ParentType &Func)
recalculate - compute a dominator tree for the given function
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
FunctionPass class - This class is used to implement most global optimizations.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
uint64_t getDiagnosticsHotnessThreshold() const
Return the minimum hotness value a diagnostic would need in order to be included in optimization diag...
static void getLazyBFIAnalysisUsage(AnalysisUsage &AU)
Helper for client passes to set up the analysis usage on behalf of this pass.
void analyze(const DominatorTreeBase< BlockT, false > &DomTree)
Create the loop forest using a stable algorithm.
An analysis over an "inner" IR unit that provides access to an analysis manager over a "outer" IR uni...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A set of analyses that are preserved following a run of a transformation pass.
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
Analysis providing profile information.
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry &)
A special type used by analysis passes to provide an address that identifies that particular analysis...