[llvm] r256113 - Minor clean up -- move large single use method out of header(NFC)
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 19 21:15:45 PST 2015
Author: davidxl
Date: Sat Dec 19 23:15:45 2015
New Revision: 256113
URL: http://llvm.org/viewvc/llvm-project?rev=256113&view=rev
Log:
Minor clean up -- move large single use method out of header(NFC)
Modified:
llvm/trunk/include/llvm/ProfileData/InstrProf.h
llvm/trunk/lib/ProfileData/InstrProf.cpp
Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=256113&r1=256112&r2=256113&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Sat Dec 19 23:15:45 2015
@@ -306,34 +306,7 @@ struct InstrProfValueSiteRecord {
/// Merge data from another InstrProfValueSiteRecord
/// Optionally scale merged counts by \p Weight.
instrprof_error mergeValueData(InstrProfValueSiteRecord &Input,
- uint64_t Weight = 1) {
- this->sortByTargetValues();
- Input.sortByTargetValues();
- auto I = ValueData.begin();
- auto IE = ValueData.end();
- instrprof_error Result = instrprof_error::success;
- for (auto J = Input.ValueData.begin(), JE = Input.ValueData.end(); J != JE;
- ++J) {
- while (I != IE && I->Value < J->Value)
- ++I;
- if (I != IE && I->Value == J->Value) {
- uint64_t JCount = J->Count;
- bool Overflowed;
- if (Weight > 1) {
- JCount = SaturatingMultiply(JCount, Weight, &Overflowed);
- if (Overflowed)
- Result = instrprof_error::counter_overflow;
- }
- I->Count = SaturatingAdd(I->Count, JCount, &Overflowed);
- if (Overflowed)
- Result = instrprof_error::counter_overflow;
- ++I;
- continue;
- }
- ValueData.insert(I, *J);
- }
- return Result;
- }
+ uint64_t Weight = 1);
};
/// Profiling information for a single function.
Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=256113&r1=256112&r2=256113&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp Sat Dec 19 23:15:45 2015
@@ -162,6 +162,37 @@ GlobalVariable *createPGOFuncNameVar(Fun
return createPGOFuncNameVar(*F.getParent(), F.getLinkage(), FuncName);
}
+instrprof_error
+InstrProfValueSiteRecord::mergeValueData(InstrProfValueSiteRecord &Input,
+ uint64_t Weight) {
+ this->sortByTargetValues();
+ Input.sortByTargetValues();
+ auto I = ValueData.begin();
+ auto IE = ValueData.end();
+ instrprof_error Result = instrprof_error::success;
+ for (auto J = Input.ValueData.begin(), JE = Input.ValueData.end(); J != JE;
+ ++J) {
+ while (I != IE && I->Value < J->Value)
+ ++I;
+ if (I != IE && I->Value == J->Value) {
+ uint64_t JCount = J->Count;
+ bool Overflowed;
+ if (Weight > 1) {
+ JCount = SaturatingMultiply(JCount, Weight, &Overflowed);
+ if (Overflowed)
+ Result = instrprof_error::counter_overflow;
+ }
+ I->Count = SaturatingAdd(I->Count, JCount, &Overflowed);
+ if (Overflowed)
+ Result = instrprof_error::counter_overflow;
+ ++I;
+ continue;
+ }
+ ValueData.insert(I, *J);
+ }
+ return Result;
+}
+
// Merge Value Profile data from Src record to this record for ValueKind.
// Scale merged value counts by \p Weight.
instrprof_error InstrProfRecord::mergeValueProfData(uint32_t ValueKind,
More information about the llvm-commits
mailing list