Lines Matching defs:I

94 bool hasProfMD(const Instruction &I) {
95 return I.hasMetadata(LLVMContext::MD_prof);
106 bool hasBranchWeightMD(const Instruction &I) {
107 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
111 bool hasCountTypeMD(const Instruction &I) {
112 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
118 return isa<CallBase>(I) && !isBranchWeightMD(ProfileData);
121 bool hasValidBranchWeightMD(const Instruction &I) {
122 return getValidBranchWeightMDNode(I);
125 bool hasBranchWeightOrigin(const Instruction &I) {
126 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
149 MDNode *getBranchWeightMDNode(const Instruction &I) {
150 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
156 MDNode *getValidBranchWeightMDNode(const Instruction &I) {
157 auto *ProfileData = getBranchWeightMDNode(I);
158 if (ProfileData && getNumBranchWeights(*ProfileData) == I.getNumSuccessors())
181 bool extractBranchWeights(const Instruction &I,
183 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
187 bool extractBranchWeights(const Instruction &I, uint64_t &TrueVal,
189 assert((I.getOpcode() == Instruction::Br ||
190 I.getOpcode() == Instruction::Select) &&
195 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
235 bool extractProfTotalWeight(const Instruction &I, uint64_t &TotalVal) {
236 return extractProfTotalWeight(I.getMetadata(LLVMContext::MD_prof), TotalVal);
239 void setBranchWeights(Instruction &I, ArrayRef<uint32_t> Weights,
241 MDBuilder MDB(I.getContext());
243 I.setMetadata(LLVMContext::MD_prof, BranchWeights);
246 void scaleProfData(Instruction &I, uint64_t S, uint64_t T) {
248 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof);
257 if (!hasCountTypeMD(I))
260 LLVMContext &C = I.getContext();
296 I.setMetadata(LLVMContext::MD_prof, MDNode::get(C, Vals));