33 #define DEBUG_TYPE "pgo-icall-prom-analysis"
40 cl::desc(
"The minimum count to the direct call target "
41 "for the promotion"));
48 cl::desc(
"The percentage threshold for the promotion"));
54 cl::desc(
"Max number of promotions for a single indirect "
61 bool ICallPromotionAnalysis::isPromotionProfitable(uint64_t Count,
62 uint64_t TotalCount) {
66 unsigned Percentage = (Count * 100) / TotalCount;
73 uint32_t ICallPromotionAnalysis::getProfitablePromotionCandidates(
77 DEBUG(
dbgs() <<
" \nWork on callsite " << *Inst <<
" Num_targets: " << NumVals
82 uint64_t Count = ValueDataRef[
I].Count;
83 assert(Count <= TotalCount);
84 DEBUG(
dbgs() <<
" Candidate " << I <<
" Count=" << Count
85 <<
" Target_func: " << ValueDataRef[I].
Value <<
"\n");
87 if (!isPromotionProfitable(Count, TotalCount)) {
88 DEBUG(
dbgs() <<
" Not promote: Cold target.\n");
102 ValueDataArray.get(), NumVals, TotalCount);
107 NumCandidates = getProfitablePromotionCandidates(I, NumVals, TotalCount);
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
initializer< Ty > init(const Ty &Val)
bool getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind, uint32_t MaxNumValueData, InstrProfValueData ValueData[], uint32_t &ActualNumValueData, uint64_t &TotalC)
Extract the value profile data from Inst which is annotated with value profile meta data...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.