23#define DEBUG_TYPE "pgo-icall-prom-analysis"
29bool ICallPromotionAnalysis::isPromotionProfitable(
const AnalysisOptions &Opts,
33 return Count >= Opts.icp_minimum_count_threshold &&
34 Count * 100 >= Opts.icp_remaining_percent_threshold * RemainingCount &&
35 Count * 100 >= Opts.icp_total_percent_threshold * TotalCount;
41uint32_t ICallPromotionAnalysis::getProfitablePromotionCandidates(
44 <<
" Num_targets: " << ValueDataArray.size() <<
"\n");
47 uint64_t RemainingCount = TotalCount;
48 for (;
I < Opts.icp_max_prom &&
I < ValueDataArray.size();
I++) {
52 <<
" Target_func: " << ValueDataArray[
I].
Value <<
"\n");
54 if (!isPromotionProfitable(Opts,
Count, TotalCount, RemainingCount)) {
58 RemainingCount -=
Count;
66 unsigned MaxNumValueData) {
70 if (Opts.icp_max_prom > MaxNumValueData)
71 MaxNumValueData = Opts.icp_max_prom;
73 MaxNumValueData, TotalCount);
74 if (ValueDataArray.empty()) {
78 NumCandidates = getProfitablePromotionCandidates(Opts,
I, TotalCount);
79 return ValueDataArray;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This is an important class for using LLVM in a threaded context.
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
const AnalysisOptions & getAnalysisOptions(const LLVMContext &C)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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 >
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
LLVM_ABI unsigned getMaxNumVTableAnnotations(const LLVMContext &C)
Return -icp-max-num-vtables.