28 : F(F), BFI(nullptr) {
29 if (!F->getContext().getDiagnosticsHotnessRequested())
44 OwnedBFI = std::make_unique<BlockFrequencyInfo>(*F, BPI, LI);
50 FunctionAnalysisManager::Invalidator &Inv) {
64std::optional<uint64_t>
65OptimizationRemarkEmitter::computeHotness(
const Value *V) {
72void OptimizationRemarkEmitter::computeHotness(
82 computeHotness(OptDiag);
86 F->getContext().getDiagnosticsHotnessThreshold()) {
90 F->getContext().diagnose(OptDiag);
100 if (Context.getDiagnosticsHotnessRequested()) {
103 if (Context.isDiagnosticsHotnessThresholdSetFromPSI()) {
106 Context.setDiagnosticsHotnessThreshold(
107 PSI->getOrCompHotCountThreshold());
112 ORE = std::make_unique<OptimizationRemarkEmitter>(&Fn, BFI);
129 auto &Context =
F.getContext();
131 if (Context.getDiagnosticsHotnessRequested()) {
134 if (Context.isDiagnosticsHotnessThresholdSetFromPSI()) {
138 Context.setDiagnosticsHotnessThreshold(
139 PSI->getOrCompHotCountThreshold());
148static const char ore_name[] =
"Optimization Remark Emitter";
149#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)
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...
LLVM_ABI 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 BasicBlock * 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.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
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.
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
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.
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A special type used by analysis passes to provide an address that identifies that particular analysis...