19 cl::desc(
"Enable the profile guided size optimizations. "));
23 cl::desc(
"Apply the profile guided size optimizations only "
24 "if the working set size is large (except for cold code.)"));
28 cl::desc(
"Apply the profile guided size optimizations only "
33 cl::desc(
"Apply the profile guided size optimizations only "
34 "to cold code under instrumentation PGO."));
38 cl::desc(
"Apply the profile guided size optimizations only "
39 "to cold code under sample PGO."));
43 cl::desc(
"Apply the profile guided size optimizations only "
44 "to cold code under partial-profile sample PGO."));
48 cl::desc(
"Force the (profiled-guided) size optimizations. "));
52 cl::desc(
"The profile guided size optimization profile summary cutoff "
53 "for instrumentation profile."));
57 cl::desc(
"The profile guided size optimization profile summary cutoff "
58 "for sample profile."));
61struct BasicBlockBFIAdapter {
62 static bool isFunctionColdInCallGraph(
const Function *
F,
67 static bool isFunctionHotInCallGraphNthPercentile(
int CutOff,
73 static bool isFunctionColdInCallGraphNthPercentile(
int CutOff,
84 static bool isHotBlockNthPercentile(
int CutOff,
90 static bool isColdBlockNthPercentile(
int CutOff,
const BasicBlock *BB,
101 return shouldFuncOptimizeForSizeImpl<BasicBlockBFIAdapter>(
F, PSI, BFI,
109 return shouldOptimizeForSizeImpl<BasicBlockBFIAdapter>(BB, PSI, BFI,
static bool isColdBlock(const MachineBasicBlock &MBB, const MachineBlockFrequencyInfo *MBFI, ProfileSummaryInfo *PSI)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Basic Block Representation.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Analysis providing profile information.
bool isHotBlockNthPercentile(int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const
Returns true if BasicBlock BB is considered hot with regard to a given hot percentile cutoff value.
bool isColdBlockNthPercentile(int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const
Returns true if BasicBlock BB is considered cold with regard to a given cold percentile cutoff value.
bool isFunctionColdInCallGraphNthPercentile(int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const
Returns true if F contains cold code with regard to a given cold percentile cutoff value.
bool isFunctionHotInCallGraphNthPercentile(int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const
Returns true if F contains hot code with regard to a given hot percentile cutoff value.
bool isColdBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) const
Returns true if BasicBlock BB is considered cold.
bool isFunctionColdInCallGraph(const Function *F, BlockFrequencyInfo &BFI) const
Returns true if F contains only cold code.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
cl::opt< bool > PGSOColdCodeOnlyForSamplePGO
cl::opt< bool > PGSOColdCodeOnlyForInstrPGO
bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI, const MachineBlockFrequencyInfo *BFI, PGSOQueryType QueryType=PGSOQueryType::Other)
Returns true if machine function MF is suggested to be size-optimized based on the profile.
cl::opt< int > PgsoCutoffSampleProf
cl::opt< bool > EnablePGSO
cl::opt< bool > PGSOColdCodeOnlyForPartialSamplePGO
cl::opt< int > PgsoCutoffInstrProf
cl::opt< bool > ForcePGSO
cl::opt< bool > PGSOLargeWorkingSetSizeOnly
cl::opt< bool > PGSOColdCodeOnly