LLVM 20.0.0git
|
Public Member Functions | |
void | setInitVals (MachineDominatorTree *MDT, MachinePostDominatorTree *MPDT, MachineLoopInfo *MLI, MachineBlockFrequencyInfo *MBFI, MachineOptimizationRemarkEmitter *MORE) |
void | setFSPass (FSDiscriminatorPass Pass) |
MIRProfileLoader (StringRef Name, StringRef RemapName, IntrusiveRefCntPtr< vfs::FileSystem > FS) | |
void | setBranchProbs (MachineFunction &F) |
bool | runOnFunction (MachineFunction &F) |
bool | doInitialization (Module &M) |
bool | isValid () const |
Public Member Functions inherited from llvm::SampleProfileLoaderBaseImpl< MachineFunction > | |
SampleProfileLoaderBaseImpl (std::string Name, std::string RemapName, IntrusiveRefCntPtr< vfs::FileSystem > FS) | |
void | dump () |
Protected Member Functions | |
ErrorOr< uint64_t > | getInstWeight (const MachineInstr &MI) override |
Protected Member Functions inherited from llvm::SampleProfileLoaderBaseImpl< MachineFunction > | |
~SampleProfileLoaderBaseImpl ()=default | |
Function & | getFunction (FunctionT &F) |
const BasicBlockT * | getEntryBB (const FunctionT *F) |
PredRangeT | getPredecessors (BasicBlockT *BB) |
SuccRangeT | getSuccessors (BasicBlockT *BB) |
unsigned | getFunctionLoc (FunctionT &Func) |
Get the line number for the function header. | |
virtual ErrorOr< uint64_t > | getInstWeight (const InstructionT &Inst) |
Get the weight for an instruction. | |
ErrorOr< uint64_t > | getInstWeightImpl (const InstructionT &Inst) |
virtual ErrorOr< uint64_t > | getProbeWeight (const InstructionT &Inst) |
ErrorOr< uint64_t > | getBlockWeight (const BasicBlockT *BB) |
Compute the weight of a basic block. | |
virtual const FunctionSamples * | findFunctionSamples (const InstructionT &I) const |
Get the FunctionSamples for an instruction. | |
void | printEdgeWeight (raw_ostream &OS, Edge E) |
Print the weight of edge E on stream OS . | |
void | printBlockWeight (raw_ostream &OS, const BasicBlockT *BB) const |
Print the weight of block BB on stream OS . | |
void | printBlockEquivalence (raw_ostream &OS, const BasicBlockT *BB) |
Print the equivalence class of block BB on stream OS . | |
bool | computeBlockWeights (FunctionT &F) |
Compute and store the weights of every basic block. | |
void | findEquivalenceClasses (FunctionT &F) |
Find equivalence classes. | |
void | findEquivalencesFor (BasicBlockT *BB1, ArrayRef< BasicBlockT * > Descendants, PostDominatorTreeT *DomTree) |
Find equivalence classes for the given block. | |
void | propagateWeights (FunctionT &F) |
Propagate weights into edges. | |
void | applyProfi (FunctionT &F, BlockEdgeMap &Successors, BlockWeightMap &SampleBlockWeights, BlockWeightMap &BlockWeights, EdgeWeightMap &EdgeWeights) |
uint64_t | visitEdge (Edge E, unsigned *NumUnknownEdges, Edge *UnknownEdge) |
Visit the given edge to decide if it has a valid weight. | |
void | buildEdges (FunctionT &F) |
Build in/out edge lists for each basic block in the CFG. | |
bool | propagateThroughEdges (FunctionT &F, bool UpdateBlockCount) |
Propagate weights through incoming/outgoing edges. | |
void | clearFunctionData (bool ResetDT=true) |
Clear all the per-function data used to load samples and propagate weights. | |
void | computeDominanceAndLoopInfo (FunctionT &F) |
void | computeDominanceAndLoopInfo (MachineFunction &F) |
void | computeDominanceAndLoopInfo (Function &F) |
bool | computeAndPropagateWeights (FunctionT &F, const DenseSet< GlobalValue::GUID > &InlinedGUIDs) |
Generate branch weight metadata for all branches in F . | |
void | initWeightPropagation (FunctionT &F, const DenseSet< GlobalValue::GUID > &InlinedGUIDs) |
void | finalizeWeightPropagation (FunctionT &F, const DenseSet< GlobalValue::GUID > &InlinedGUIDs) |
void | emitCoverageRemarks (FunctionT &F) |
Protected Attributes | |
MachineBlockFrequencyInfo * | BFI |
Hold the information of the basic block frequency. | |
FSDiscriminatorPass | P |
PassNum is the sequence number this pass is called, start from 1. | |
unsigned | LowBit |
unsigned | HighBit |
bool | ProfileIsValid = true |
Protected Attributes inherited from llvm::SampleProfileLoaderBaseImpl< MachineFunction > | |
DenseMap< const DILocation *, const FunctionSamples * > | DILocation2SampleMap |
BlockWeightMap | BlockWeights |
Map basic blocks to their computed weights. | |
EdgeWeightMap | EdgeWeights |
Map edges to their computed weights. | |
SmallPtrSet< const BasicBlockT *, 32 > | VisitedBlocks |
Set of visited blocks during propagation. | |
SmallSet< Edge, 32 > | VisitedEdges |
Set of visited edges during propagation. | |
EquivalenceClassMap | EquivalenceClass |
Equivalence classes for block weights. | |
DominatorTreePtrT | DT |
Dominance, post-dominance and loop information. | |
PostDominatorTreePtrT | PDT |
LoopInfoPtrT | LI |
BlockEdgeMap | Predecessors |
Predecessors for each basic block in the CFG. | |
BlockEdgeMap | Successors |
Successors for each basic block in the CFG. | |
SampleCoverageTracker | CoverageTracker |
Profile coverage tracker. | |
std::unique_ptr< SampleProfileReader > | Reader |
Profile reader object. | |
std::map< SampleContext, FunctionSamples > | OutlineFunctionSamples |
Synthetic samples created by duplicating the samples of inlined functions from the original profile as if they were top level sample profiles. | |
std::unique_ptr< PseudoProbeManager > | ProbeManager |
FunctionSamples * | Samples |
Samples collected for the body of this function. | |
std::string | Filename |
Name of the profile file to load. | |
std::string | RemappingFilename |
Name of the profile remapping file to load. | |
IntrusiveRefCntPtr< vfs::FileSystem > | FS |
VirtualFileSystem to load profile files from. | |
ProfileSummaryInfo * | PSI |
Profile Summary Info computed from sample profile. | |
OptRemarkEmitterT * | ORE |
Optimization Remark Emitter used to emit diagnostic remarks. | |
Friends | |
class | SampleCoverageTracker |
Definition at line 146 of file MIRSampleProfile.cpp.
|
inline |
Definition at line 165 of file MIRSampleProfile.cpp.
References string.
Definition at line 288 of file MIRSampleProfile.cpp.
References llvm::sampleprof::SampleProfileReader::create(), llvm::SampleProfileLoaderBaseImpl< MachineFunction >::Filename, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::FS, P, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::ProbeManager, ProfileIsValid, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::Reader, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::RemappingFilename, and llvm::success.
|
inlineoverrideprotected |
Definition at line 192 of file MIRSampleProfile.cpp.
References llvm::SampleProfileLoaderBaseImpl< MachineFunction >::getInstWeightImpl(), llvm::SampleProfileLoaderBaseImpl< MachineFunction >::getProbeWeight(), llvm::ImprovedFSDiscriminator, MI, and llvm::sampleprof::FunctionSamples::ProfileIsProbeBased.
|
inline |
Definition at line 173 of file MIRSampleProfile.cpp.
References ProfileIsValid.
bool llvm::MIRProfileLoader::runOnFunction | ( | MachineFunction & | F | ) |
Definition at line 314 of file MIRSampleProfile.cpp.
References llvm::SampleProfileLoaderBaseImpl< MachineFunction >::clearFunctionData(), llvm::SampleProfileLoaderBaseImpl< MachineFunction >::computeAndPropagateWeights(), llvm::sampleprof::FunctionSamples::empty(), llvm::MachineFunction::getFunction(), llvm::SampleProfileLoaderBaseImpl< MachineFunction >::getFunctionLoc(), llvm::SampleProfileLoaderBaseImpl< MachineFunction >::ProbeManager, llvm::sampleprof::FunctionSamples::ProfileIsProbeBased, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::Reader, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::Samples, and setBranchProbs().
void llvm::MIRProfileLoader::setBranchProbs | ( | MachineFunction & | F | ) |
Definition at line 205 of file MIRSampleProfile.cpp.
References assert(), BFI, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::BlockWeights, llvm::dbgs(), E, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::EdgeWeights, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::EquivalenceClass, F, llvm::MachineBasicBlock::findBranchDebugLoc(), FSProfileDebugBWThreshold, FSProfileDebugProbDiffThreshold, llvm::MachineBranchProbabilityInfo::getEdgeProbability(), llvm::MachineBlockFrequencyInfo::getMBPI(), llvm::MachineBasicBlock::getNumber(), LLVM_DEBUG, llvm::MachineBasicBlock::setSuccProbability(), ShowFSBranchProb, llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::succ_end(), llvm::MachineBasicBlock::succ_size(), and llvm::MachineBasicBlock::successors().
Referenced by runOnFunction().
|
inline |
Definition at line 158 of file MIRSampleProfile.cpp.
References assert(), llvm::getFSPassBitBegin(), llvm::getFSPassBitEnd(), HighBit, LowBit, and P.
|
inline |
Definition at line 149 of file MIRSampleProfile.cpp.
References BFI, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::DT, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::LI, MORE, llvm::SampleProfileLoaderBaseImpl< MachineFunction >::ORE, and llvm::SampleProfileLoaderBaseImpl< MachineFunction >::PDT.
|
friend |
Definition at line 176 of file MIRSampleProfile.cpp.
|
protected |
Hold the information of the basic block frequency.
Definition at line 179 of file MIRSampleProfile.cpp.
Referenced by setBranchProbs(), and setInitVals().
|
protected |
Definition at line 189 of file MIRSampleProfile.cpp.
Referenced by setFSPass().
|
protected |
Definition at line 186 of file MIRSampleProfile.cpp.
Referenced by setFSPass().
|
protected |
PassNum is the sequence number this pass is called, start from 1.
Definition at line 182 of file MIRSampleProfile.cpp.
Referenced by doInitialization(), and setFSPass().
Definition at line 191 of file MIRSampleProfile.cpp.
Referenced by doInitialization(), and isValid().