80bool isFunctionColdInCallGraph(
87 for (
const auto &
MBB : *MF)
95bool isFunctionHotInCallGraphNthPercentile(
102 FunctionCount->getCount()))
104 for (
const auto &
MBB : *MF)
110bool isFunctionColdInCallGraphNthPercentile(
115 FunctionCount->getCount()))
117 for (
const auto &
MBB : *MF)
124struct MachineBasicBlockBFIAdapter {
128 return machine_size_opts_detail::isFunctionColdInCallGraph(MF, PSI, MBFI);
130 static bool isFunctionHotInCallGraphNthPercentile(
135 return machine_size_opts_detail::isFunctionHotInCallGraphNthPercentile(
136 CutOff, MF, PSI, MBFI);
138 static bool isFunctionColdInCallGraphNthPercentile(
141 return machine_size_opts_detail::isFunctionColdInCallGraphNthPercentile(
142 CutOff, MF, PSI, MBFI);
147 return machine_size_opts_detail::isColdBlock(
MBB, PSI, MBFI);
152 return machine_size_opts_detail::isColdBlock(BlockFreq, PSI, MBFI);
154 static bool isHotBlockNthPercentile(
int CutOff,
158 return machine_size_opts_detail::isHotBlockNthPercentile(
159 CutOff,
MBB, PSI, MBFI);
161 static bool isHotBlockNthPercentile(
int CutOff,
165 return machine_size_opts_detail::isHotBlockNthPercentile(
166 CutOff, BlockFreq, PSI, MBFI);
171 return machine_size_opts_detail::isColdBlockNthPercentile(CutOff,
MBB, PSI,
174 static bool isColdBlockNthPercentile(
int CutOff,
BlockFrequency BlockFreq,
177 return machine_size_opts_detail::isColdBlockNthPercentile(CutOff, BlockFreq,
187 return shouldFuncOptimizeForSizeImpl<MachineBasicBlockBFIAdapter>(
188 MF, PSI, MBFI, QueryType);
196 return shouldOptimizeForSizeImpl<MachineBasicBlockBFIAdapter>(
197 MBB, PSI, MBFI, QueryType);
208 return shouldOptimizeForSizeImpl<MachineBasicBlockBFIAdapter>(
209 BlockFreq, PSI, &MBFIW->
getMBFI(), QueryType);
static bool isColdBlock(const MachineBasicBlock &MBB, const MachineBlockFrequencyInfo *MBFI, ProfileSummaryInfo *PSI)
static cl::opt< unsigned > PercentileCutoff("mfs-psi-cutoff", cl::desc("Percentile profile summary cutoff used to " "determine cold blocks. Unused if set to zero."), cl::init(999950), cl::Hidden)
cl::opt< bool > PGSOLargeWorkingSetSizeOnly
cl::opt< bool > ForcePGSO
cl::opt< int > PgsoCutoffSampleProf
cl::opt< bool > EnablePGSO
cl::opt< int > PgsoCutoffInstrProf
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint64_t getFrequency() const
Returns the frequency as a fixpoint number scaled by the entry frequency.
std::optional< ProfileCount > getEntryCount(bool AllowSynthetic=false) const
Get the entry count for this function.
const MachineBlockFrequencyInfo & getMBFI()
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
std::optional< uint64_t > getBlockProfileCount(const MachineBasicBlock *MBB) const
std::optional< uint64_t > getProfileCountFromFreq(uint64_t Freq) const
Function & getFunction()
Return the LLVM function that this machine code represents.
Analysis providing profile information.
bool isColdCount(uint64_t C) const
Returns true if count C is considered cold.
bool isColdCountNthPercentile(int PercentileCutoff, uint64_t C) const
Returns true if count C is considered cold with regard to a given cold percentile cutoff value.
bool isHotCountNthPercentile(int PercentileCutoff, uint64_t C) const
Returns true if count C is considered hot with regard to a given hot percentile cutoff value.
This is an optimization pass for GlobalISel generic memory operations.
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.