23#define DEBUG_TYPE "pgo-icall-prom-analysis"
31 cl::desc(
"The percentage threshold against remaining unpromoted indirect "
32 "call count for the promotion"));
39 cl::desc(
"The percentage threshold against total "
40 "count for the promotion"));
46 cl::desc(
"Minimum absolute count for promotion candidate"));
52 cl::desc(
"Max number of promotions for a single indirect "
57 cl::desc(
"Max number of vtables annotated for a vtable load instruction."));
61bool ICallPromotionAnalysis::isPromotionProfitable(
uint64_t Count,
72uint32_t ICallPromotionAnalysis::getProfitablePromotionCandidates(
75 <<
" Num_targets: " << ValueDataArray.size() <<
"\n");
78 uint64_t RemainingCount = TotalCount;
80 uint64_t
Count = ValueDataArray[
I].Count;
83 <<
" Target_func: " << ValueDataArray[
I].
Value <<
"\n");
85 if (!isPromotionProfitable(
Count, TotalCount, RemainingCount)) {
89 RemainingCount -=
Count;
99 if (ValueDataArray.empty()) {
103 NumCandidates = getProfitablePromotionCandidates(
I, TotalCount);
104 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
cl::opt< unsigned > MaxNumVTableAnnotations("icp-max-num-vtables", cl::init(6), cl::Hidden, cl::desc("Max number of vtables annotated for a vtable load instruction."))
static cl::opt< unsigned > ICPMinimumCountThreshold("icp-minimum-count-threshold", cl::init(0), cl::Hidden, cl::desc("Minimum absolute count for promotion candidate"))
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 >
static cl::opt< unsigned > ICPRemainingPercentThreshold("icp-remaining-percent-threshold", cl::init(30), cl::Hidden, cl::desc("The percentage threshold against remaining unpromoted indirect " "call count for the promotion"))
static cl::opt< unsigned > MaxNumPromotions("icp-max-prom", cl::init(3), cl::Hidden, cl::desc("Max number of promotions for a single indirect " "call callsite"))
static cl::opt< uint64_t > ICPTotalPercentThreshold("icp-total-percent-threshold", cl::init(5), cl::Hidden, cl::desc("The percentage threshold against total " "count for the promotion"))