@@ -96,7 +96,7 @@ bool isBranchWeightMD(const MDNode *ProfileData) {
96
96
return isTargetMD (ProfileData, " branch_weights" , MinBWOps);
97
97
}
98
98
99
- bool isValueProfileMD (const MDNode *ProfileData) {
99
+ static bool isValueProfileMD (const MDNode *ProfileData) {
100
100
return isTargetMD (ProfileData, " VP" , MinVPOps);
101
101
}
102
102
@@ -105,7 +105,7 @@ bool hasBranchWeightMD(const Instruction &I) {
105
105
return isBranchWeightMD (ProfileData);
106
106
}
107
107
108
- bool hasCountTypeMD (const Instruction &I) {
108
+ static bool hasCountTypeMD (const Instruction &I) {
109
109
auto *ProfileData = I.getMetadata (LLVMContext::MD_prof);
110
110
// Value profiles record count-type information.
111
111
if (isValueProfileMD (ProfileData))
@@ -271,16 +271,16 @@ void scaleProfData(Instruction &I, uint64_t S, uint64_t T) {
271
271
Vals.push_back (MDB.createConstant (ConstantInt::get (
272
272
Type::getInt32Ty (C), Val.udiv (APT).getLimitedValue (UINT32_MAX))));
273
273
} else if (ProfDataName->getString () == " VP" )
274
- for (unsigned i = 1 ; i < ProfileData->getNumOperands (); i += 2 ) {
274
+ for (unsigned Idx = 1 ; Idx < ProfileData->getNumOperands (); Idx += 2 ) {
275
275
// The first value is the key of the value profile, which will not change.
276
- Vals.push_back (ProfileData->getOperand (i ));
276
+ Vals.push_back (ProfileData->getOperand (Idx ));
277
277
uint64_t Count =
278
- mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand (i + 1 ))
278
+ mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand (Idx + 1 ))
279
279
->getValue ()
280
280
.getZExtValue ();
281
281
// Don't scale the magic number.
282
282
if (Count == NOMORE_ICP_MAGICNUM) {
283
- Vals.push_back (ProfileData->getOperand (i + 1 ));
283
+ Vals.push_back (ProfileData->getOperand (Idx + 1 ));
284
284
continue ;
285
285
}
286
286
// Using APInt::div may be expensive, but most cases should fit 64 bits.
0 commit comments