@@ -96,7 +96,7 @@ bool isBranchWeightMD(const MDNode *ProfileData) {
9696 return isTargetMD (ProfileData, " branch_weights" , MinBWOps);
9797}
9898
99- bool isValueProfileMD (const MDNode *ProfileData) {
99+ static bool isValueProfileMD (const MDNode *ProfileData) {
100100 return isTargetMD (ProfileData, " VP" , MinVPOps);
101101}
102102
@@ -105,7 +105,7 @@ bool hasBranchWeightMD(const Instruction &I) {
105105 return isBranchWeightMD (ProfileData);
106106}
107107
108- bool hasCountTypeMD (const Instruction &I) {
108+ static bool hasCountTypeMD (const Instruction &I) {
109109 auto *ProfileData = I.getMetadata (LLVMContext::MD_prof);
110110 // Value profiles record count-type information.
111111 if (isValueProfileMD (ProfileData))
@@ -271,16 +271,16 @@ void scaleProfData(Instruction &I, uint64_t S, uint64_t T) {
271271 Vals.push_back (MDB.createConstant (ConstantInt::get (
272272 Type::getInt32Ty (C), Val.udiv (APT).getLimitedValue (UINT32_MAX))));
273273 } 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 ) {
275275 // 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 ));
277277 uint64_t Count =
278- mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand (i + 1 ))
278+ mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand (Idx + 1 ))
279279 ->getValue ()
280280 .getZExtValue ();
281281 // Don't scale the magic number.
282282 if (Count == NOMORE_ICP_MAGICNUM) {
283- Vals.push_back (ProfileData->getOperand (i + 1 ));
283+ Vals.push_back (ProfileData->getOperand (Idx + 1 ));
284284 continue ;
285285 }
286286 // Using APInt::div may be expensive, but most cases should fit 64 bits.
0 commit comments