23#define DEBUG_TYPE "pgo-icall-prom-analysis"
29 cl::desc(
"The percentage threshold against remaining unpromoted indirect "
30 "call count for the promotion"));
37 cl::desc(
"The percentage threshold against total "
38 "count for the promotion"));
44 cl::desc(
"Minimum absolute count for promotion candidate"));
50 cl::desc(
"Max number of promotions for a single indirect "
55 cl::desc(
"Max number of vtables annotated for a vtable load instruction."));
57bool ICallPromotionAnalysis::isPromotionProfitable(
uint64_t Count,
68uint32_t ICallPromotionAnalysis::getProfitablePromotionCandidates(
71 <<
" Num_targets: " << ValueDataArray.size() <<
"\n");
74 uint64_t RemainingCount = TotalCount;
76 uint64_t
Count = ValueDataArray[
I].Count;
79 <<
" Target_func: " << ValueDataArray[
I].
Value <<
"\n");
81 if (!isPromotionProfitable(
Count, TotalCount, RemainingCount)) {
85 RemainingCount -=
Count;
95 if (ValueDataArray.empty()) {
99 NumCandidates = getProfitablePromotionCandidates(
I, TotalCount);
100 return ValueDataArray;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FunctionAddr VTableAddr Count
LLVM_ABI SmallVector< InstrProfValueData, 4 > getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind, uint32_t MaxNumValueData, uint64_t &TotalC, bool GetNoICPValue=false)
Extract the value profile data from Inst and returns them if Inst is annotated with value profile dat...
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >