27 : F(F),
BFI(nullptr) {
44 OwnedBFI = llvm::make_unique<BlockFrequencyInfo>(*F, BPI, LI);
88 else if (io.
mapTag(
"!AnalysisFPCommute",
92 else if (io.
mapTag(
"!AnalysisAliasing",
129 static const bool flow =
true;
149 const Value *V = OptDiag.getCodeRegion();
151 OptDiag.setHotness(computeHotness(V));
154 void OptimizationRemarkEmitter::emit(
156 auto &OptDiag = cast<DiagnosticInfoIROptimization>(OptDiagBase);
157 computeHotness(OptDiag);
160 if (OptDiag.getHotness() &&
161 *OptDiag.getHotness() <
173 if (!OptDiag.isVerbose() || shouldEmitVerbose())
187 BFI = &getAnalysis<LazyBlockFrequencyInfoPass>().getBFI();
191 ORE = llvm::make_unique<OptimizationRemarkEmitter>(&Fn,
BFI);
201 AnalysisKey OptimizationRemarkEmitterAnalysis::Key;
217 static const char ore_name[] =
"Optimization Remark Emitter";
218 #define ORE_NAME "opt-remark-emitter"
const char * PassName
Name of the pass that triggers this report.
static void mapping(IO &io, DiagnosticInfoOptimizationBase::Argument &A)
StringRef getFilename() const
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void mapOptional(const char *Key, T &Val)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
This class represents an incoming formal argument to a Function.
void calculate(const Function &F, const LoopInfo &LI, const TargetLibraryInfo *TLI=nullptr)
void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry &)
bool getDiagnosticsHotnessRequested() const
Return if a code hotness metric should be included in optimization diagnostics.
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML sequence...
INITIALIZE_PASS_BEGIN(OptimizationRemarkEmitterWrapperPass, ORE_NAME, ore_name, false, true) INITIALIZE_PASS_END(OptimizationRemarkEmitterWrapperPass
StringRef getName() const
Return a constant reference to the value's name.
#define INITIALIZE_PASS_DEPENDENCY(depName)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
void getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const
Return location information for this diagnostic in three parts: the source file name, line number and column.
This class should be specialized by any type that needs to be converted to/from a YAML mapping...
StringRef RemarkName
Textual identifier for the remark (single-word, camel-case).
virtual bool mapTag(StringRef Tag, bool Default=false)=0
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
yaml::Output * getDiagnosticsOutputFile()
Return the YAML file used by the backend to save optimization diagnostics.
const Function & getFunction() const
SmallVector< Argument, 4 > Args
Arguments collected via the streaming interface.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
A set of analyses that are preserved following a run of a transformation pass.
void analyze(const DominatorTreeBase< BlockT, false > &DomTree)
Create the loop forest using a stable algorithm.
Represent the analysis usage information of a pass.
Common features for diagnostics dealing with optimization remarks that are used by IR passes...
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
FunctionPass class - This class is used to implement most global optimizations.
unsigned getColumn() const
The Output class is used to generate a yaml document from in-memory structs and vectors.
Used in the streaming interface as the general argument type.
uint64_t getDiagnosticsHotnessThreshold() const
Return the minimum hotness value a diagnostic would need in order to be included in optimization diag...
static void mapping(IO &io, DiagnosticLocation &DL)
Analysis pass which computes BlockFrequencyInfo.
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1', drop it.
void setPreservesAll()
Set by analyses that do not transform their input at all.
static void getLazyBFIAnalysisUsage(AnalysisUsage &AU)
Helper for client passes to set up the analysis usage on behalf of this pass.
llvm_unreachable("Unknown RegBank!")
Analysis providing branch probability information.
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
static const char ore_name[]
virtual bool outputting()=0
API to communicate dependencies between analyses during invalidation.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Optional< uint64_t > Hotness
If profile information is available, this is the number of times the corresponding code was executed ...
void recalculate(FT &F)
recalculate - compute a dominator tree for the given function
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
void mapRequired(const char *Key, T &Val)
Optional< uint64_t > getBlockProfileCount(const BasicBlock *BB) const
Returns the estimated profile count of BB.
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 special type used by analysis passes to provide an address that identifies that particular analysis...