LLVM 20.0.0git
|
The optimization diagnostic interface. More...
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
Public Member Functions | |
OptimizationRemarkEmitter (const Function *F, BlockFrequencyInfo *BFI) | |
OptimizationRemarkEmitter (const Function *F) | |
This variant can be used to generate ORE on demand (without the analysis pass). | |
OptimizationRemarkEmitter (OptimizationRemarkEmitter &&Arg) | |
OptimizationRemarkEmitter & | operator= (OptimizationRemarkEmitter &&RHS) |
bool | invalidate (Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv) |
Handle invalidation events in the new pass manager. | |
bool | enabled () const |
Return true iff at least some remarks are enabled. | |
void | emit (DiagnosticInfoOptimizationBase &OptDiag) |
Output the remark via the diagnostic handler and to the optimization record file. | |
template<typename T > | |
void | emit (T RemarkBuilder, decltype(RemarkBuilder()) *=nullptr) |
Take a lambda that returns a remark which will be emitted. | |
bool | allowExtraAnalysis (StringRef PassName) const |
Whether we allow for extra compile-time budget to perform more analysis to produce fewer false positives. | |
Static Public Member Functions | |
static bool | allowExtraAnalysis (const Function &F, StringRef PassName) |
static bool | allowExtraAnalysis (LLVMContext &Ctx, StringRef PassName) |
The optimization diagnostic interface.
It allows reporting when optimizations are performed and when they are not along with the reasons for it. Hotness information of the corresponding code region can be included in the remark if DiagnosticsHotnessRequested is enabled in the LLVM context.
Definition at line 34 of file OptimizationRemarkEmitter.h.
|
inline |
Definition at line 36 of file OptimizationRemarkEmitter.h.
References F.
This variant can be used to generate ORE on demand (without the analysis pass).
Note that this ctor has a very different cost depending on whether F->getContext().getDiagnosticsHotnessRequested() is on or not. If it's off the operation is free.
Whereas if DiagnosticsHotnessRequested is on, it is fairly expensive operation since BFI and all its required analyses are computed. This is for example useful for CGSCC passes that can't use function analyses passes in the old PM.
Definition at line 27 of file OptimizationRemarkEmitter.cpp.
References llvm::LoopInfoBase< BlockT, LoopT >::analyze(), F, and llvm::DominatorTreeBase< NodeT, IsPostDom >::recalculate().
|
inline |
Definition at line 52 of file OptimizationRemarkEmitter.h.
|
inlinestatic |
Definition at line 102 of file OptimizationRemarkEmitter.h.
References allowExtraAnalysis(), F, and PassName.
|
inlinestatic |
Definition at line 105 of file OptimizationRemarkEmitter.h.
References llvm::LLVMContext::getDiagHandlerPtr(), llvm::LLVMContext::getLLVMRemarkStreamer(), llvm::DiagnosticHandler::isAnyRemarkEnabled(), and PassName.
Whether we allow for extra compile-time budget to perform more analysis to produce fewer false positives.
This is useful when reporting missed optimizations. In this case we can use the extra analysis (1) to filter trivial false positives or (2) to provide more context so that non-trivial false positives can be quickly detected by the user.
Definition at line 99 of file OptimizationRemarkEmitter.h.
References allowExtraAnalysis(), and PassName.
Referenced by allowExtraAnalysis(), llvm::LoopVectorizationLegality::canVectorize(), convertAnnotation2Metadata(), llvm::LoopVectorizePass::processLoop(), and runImpl().
void OptimizationRemarkEmitter::emit | ( | DiagnosticInfoOptimizationBase & | OptDiag | ) |
Output the remark via the diagnostic handler and to the optimization record file.
Definition at line 79 of file OptimizationRemarkEmitter.cpp.
References llvm::LLVMContext::diagnose(), llvm::Function::getContext(), llvm::LLVMContext::getDiagnosticsHotnessThreshold(), and llvm::DiagnosticInfoOptimizationBase::getHotness().
Referenced by llvm::LoopVectorizeHints::allowVectorization(), llvm::canSinkOrHoistInst(), checkMixedPrecision(), llvm::computeUnrollCount(), createFunctionClones(), deleteLoopIfDead(), DoFlattenLoopPair(), EmitAndPrintRemark(), llvm::emitInlinedInto(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), emitRemark(), llvm::LoopVectorizeHints::emitRemarkWithHints(), expandToSwitch(), llvm::BasicTTIImplBase< T >::getUnrollingPreferences(), hoist(), isSafeToExecuteUnconditionally(), markTails(), llvm::LoopVectorizePass::processLoop(), llvm::pgo::promoteIndirectCall(), llvm::promoteLoopAccessesToScalars(), llvm::MLInlineAdvice::recordInliningImpl(), llvm::MLInlineAdvice::recordInliningWithCalleeDeletedImpl(), llvm::MLInlineAdvice::recordUnattemptedInliningImpl(), llvm::MLInlineAdvice::recordUnsuccessfulInliningImpl(), reportFastISelFailure(), reportLoadElim(), reportMayClobberedLoad(), llvm::reportVectorization(), llvm::reportVectorizationFailure(), llvm::SSPLayoutAnalysis::requiresStackProtector(), runImpl(), llvm::setProfMetadata(), llvm::SITargetLowering::shouldExpandAtomicRMWInIR(), llvm::shouldInline(), sink(), tryToUnrollLoop(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), verifyFuncBFI(), and warnAboutLeftoverTransformations().
|
inline |
Take a lambda that returns a remark which will be emitted.
Second argument is only used to restrict this to functions.
Definition at line 78 of file OptimizationRemarkEmitter.h.
|
inline |
Return true iff at least some remarks are enabled.
Definition at line 66 of file OptimizationRemarkEmitter.h.
References llvm::Function::getContext(), llvm::LLVMContext::getDiagHandlerPtr(), llvm::LLVMContext::getLLVMRemarkStreamer(), and llvm::DiagnosticHandler::isAnyRemarkEnabled().
Referenced by emit().
bool OptimizationRemarkEmitter::invalidate | ( | Function & | F, |
const PreservedAnalyses & | PA, | ||
FunctionAnalysisManager::Invalidator & | Inv | ||
) |
Handle invalidation events in the new pass manager.
Definition at line 48 of file OptimizationRemarkEmitter.cpp.
References F, and llvm::AnalysisManager< IRUnitT, ExtraArgTs >::Invalidator::invalidate().
|
inline |
Definition at line 55 of file OptimizationRemarkEmitter.h.
References RHS.