LLVM: lib/Analysis/IndirectCallPromotionAnalysis.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

20

21using namespace llvm;

22

23#define DEBUG_TYPE "pgo-icall-prom-analysis"

24

25

26

29 cl::desc("The percentage threshold against remaining unpromoted indirect "

30 "call count for the promotion"));

31

32

33

37 cl::desc("The percentage threshold against total "

38 "count for the promotion"));

39

40

41

44 cl::desc("Max number of promotions for a single indirect "

45 "call callsite"));

46

49 cl::desc("Max number of vtables annotated for a vtable load instruction."));

50

51bool ICallPromotionAnalysis::isPromotionProfitable(uint64_t Count,

56}

57

58

59

60

61uint32_t ICallPromotionAnalysis::getProfitablePromotionCandidates(

64 << " Num_targets: " << ValueDataArray.size() << "\n");

65

67 uint64_t RemainingCount = TotalCount;

69 uint64_t Count = ValueDataArray[I].Count;

70 assert(Count <= RemainingCount);

71 LLVM_DEBUG(dbgs() << " Candidate " << I << " Count=" << Count

72 << " Target_func: " << ValueDataArray[I].Value << "\n");

73

74 if (!isPromotionProfitable(Count, TotalCount, RemainingCount)) {

76 return I;

77 }

78 RemainingCount -= Count;

79 }

80 return I;

81}

82

88 if (ValueDataArray.empty()) {

89 NumCandidates = 0;

91 }

92 NumCandidates = getProfitablePromotionCandidates(I, TotalCount);

93 return ValueDataArray;

94}

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...

LLVM Value Representation.

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

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...