forked from OSchip/llvm-project
parent
a3ebcfe5a6
commit
e0fa2689de
|
@ -630,8 +630,8 @@ struct OverlapStats {
|
||||||
FuncHash = Hash;
|
FuncHash = Hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error accumuateCounts(const std::string &BaseFilename,
|
Error accumulateCounts(const std::string &BaseFilename,
|
||||||
const std::string &TestFilename, bool IsCS);
|
const std::string &TestFilename, bool IsCS);
|
||||||
void addOneMismatch(const CountSumOrPercent &MismatchFunc);
|
void addOneMismatch(const CountSumOrPercent &MismatchFunc);
|
||||||
void addOneUnique(const CountSumOrPercent &UniqueFunc);
|
void addOneUnique(const CountSumOrPercent &UniqueFunc);
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ struct InstrProfRecord {
|
||||||
void clearValueData() { ValueData = nullptr; }
|
void clearValueData() { ValueData = nullptr; }
|
||||||
|
|
||||||
/// Compute the sums of all counts and store in Sum.
|
/// Compute the sums of all counts and store in Sum.
|
||||||
void accumuateCounts(CountSumOrPercent &Sum) const;
|
void accumulateCounts(CountSumOrPercent &Sum) const;
|
||||||
|
|
||||||
/// Compute the overlap b/w this IntrprofRecord and Other.
|
/// Compute the overlap b/w this IntrprofRecord and Other.
|
||||||
void overlap(InstrProfRecord &Other, OverlapStats &Overlap,
|
void overlap(InstrProfRecord &Other, OverlapStats &Overlap,
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
virtual InstrProfSymtab &getSymtab() = 0;
|
virtual InstrProfSymtab &getSymtab() = 0;
|
||||||
|
|
||||||
/// Compute the sum of counts and return in Sum.
|
/// Compute the sum of counts and return in Sum.
|
||||||
void accumuateCounts(CountSumOrPercent &Sum, bool IsCS);
|
void accumulateCounts(CountSumOrPercent &Sum, bool IsCS);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<InstrProfSymtab> Symtab;
|
std::unique_ptr<InstrProfSymtab> Symtab;
|
||||||
|
|
|
@ -478,7 +478,7 @@ Error readPGOFuncNameStrings(StringRef NameStrings, InstrProfSymtab &Symtab) {
|
||||||
return Error::success();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstrProfRecord::accumuateCounts(CountSumOrPercent &Sum) const {
|
void InstrProfRecord::accumulateCounts(CountSumOrPercent &Sum) const {
|
||||||
uint64_t FuncSum = 0;
|
uint64_t FuncSum = 0;
|
||||||
Sum.NumEntries += Counts.size();
|
Sum.NumEntries += Counts.size();
|
||||||
for (size_t F = 0, E = Counts.size(); F < E; ++F)
|
for (size_t F = 0, E = Counts.size(); F < E; ++F)
|
||||||
|
@ -552,7 +552,7 @@ void InstrProfRecord::overlap(InstrProfRecord &Other, OverlapStats &Overlap,
|
||||||
uint64_t ValueCutoff) {
|
uint64_t ValueCutoff) {
|
||||||
// FuncLevel CountSum for other should already computed and nonzero.
|
// FuncLevel CountSum for other should already computed and nonzero.
|
||||||
assert(FuncLevelOverlap.Test.CountSum >= 1.0f);
|
assert(FuncLevelOverlap.Test.CountSum >= 1.0f);
|
||||||
accumuateCounts(FuncLevelOverlap.Base);
|
accumulateCounts(FuncLevelOverlap.Base);
|
||||||
bool Mismatch = (Counts.size() != Other.Counts.size());
|
bool Mismatch = (Counts.size() != Other.Counts.size());
|
||||||
|
|
||||||
// Check if the value profiles mismatch.
|
// Check if the value profiles mismatch.
|
||||||
|
@ -1164,9 +1164,9 @@ void createProfileFileNameVar(Module &M, StringRef InstrProfileOutput) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Error OverlapStats::accumuateCounts(const std::string &BaseFilename,
|
Error OverlapStats::accumulateCounts(const std::string &BaseFilename,
|
||||||
const std::string &TestFilename,
|
const std::string &TestFilename,
|
||||||
bool IsCS) {
|
bool IsCS) {
|
||||||
auto getProfileSum = [IsCS](const std::string &Filename,
|
auto getProfileSum = [IsCS](const std::string &Filename,
|
||||||
CountSumOrPercent &Sum) -> Error {
|
CountSumOrPercent &Sum) -> Error {
|
||||||
auto ReaderOrErr = InstrProfReader::create(Filename);
|
auto ReaderOrErr = InstrProfReader::create(Filename);
|
||||||
|
@ -1174,7 +1174,7 @@ Error OverlapStats::accumuateCounts(const std::string &BaseFilename,
|
||||||
return E;
|
return E;
|
||||||
}
|
}
|
||||||
auto Reader = std::move(ReaderOrErr.get());
|
auto Reader = std::move(ReaderOrErr.get());
|
||||||
Reader->accumuateCounts(Sum, IsCS);
|
Reader->accumulateCounts(Sum, IsCS);
|
||||||
return Error::success();
|
return Error::success();
|
||||||
};
|
};
|
||||||
auto Ret = getProfileSum(BaseFilename, Base);
|
auto Ret = getProfileSum(BaseFilename, Base);
|
||||||
|
|
|
@ -907,7 +907,7 @@ Error IndexedInstrProfReader::readNextRecord(NamedInstrProfRecord &Record) {
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstrProfReader::accumuateCounts(CountSumOrPercent &Sum, bool IsCS) {
|
void InstrProfReader::accumulateCounts(CountSumOrPercent &Sum, bool IsCS) {
|
||||||
uint64_t NumFuncs = 0;
|
uint64_t NumFuncs = 0;
|
||||||
for (const auto &Func : *this) {
|
for (const auto &Func : *this) {
|
||||||
if (isIRLevelProfile()) {
|
if (isIRLevelProfile()) {
|
||||||
|
@ -915,7 +915,7 @@ void InstrProfReader::accumuateCounts(CountSumOrPercent &Sum, bool IsCS) {
|
||||||
if (FuncIsCS != IsCS)
|
if (FuncIsCS != IsCS)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Func.accumuateCounts(Sum);
|
Func.accumulateCounts(Sum);
|
||||||
++NumFuncs;
|
++NumFuncs;
|
||||||
}
|
}
|
||||||
Sum.NumEntries = NumFuncs;
|
Sum.NumEntries = NumFuncs;
|
||||||
|
|
|
@ -193,7 +193,7 @@ void InstrProfWriter::overlapRecord(NamedInstrProfRecord &&Other,
|
||||||
const OverlapFuncFilters &FuncFilter) {
|
const OverlapFuncFilters &FuncFilter) {
|
||||||
auto Name = Other.Name;
|
auto Name = Other.Name;
|
||||||
auto Hash = Other.Hash;
|
auto Hash = Other.Hash;
|
||||||
Other.accumuateCounts(FuncLevelOverlap.Test);
|
Other.accumulateCounts(FuncLevelOverlap.Test);
|
||||||
if (FunctionData.find(Name) == FunctionData.end()) {
|
if (FunctionData.find(Name) == FunctionData.end()) {
|
||||||
Overlap.addOneUnique(FuncLevelOverlap.Test);
|
Overlap.addOneUnique(FuncLevelOverlap.Test);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -682,7 +682,7 @@ static void overlapInstrProfile(const std::string &BaseFilename,
|
||||||
WriterContext Context(false, ErrorLock, WriterErrorCodes);
|
WriterContext Context(false, ErrorLock, WriterErrorCodes);
|
||||||
WeightedFile WeightedInput{BaseFilename, 1};
|
WeightedFile WeightedInput{BaseFilename, 1};
|
||||||
OverlapStats Overlap;
|
OverlapStats Overlap;
|
||||||
Error E = Overlap.accumuateCounts(BaseFilename, TestFilename, IsCS);
|
Error E = Overlap.accumulateCounts(BaseFilename, TestFilename, IsCS);
|
||||||
if (E)
|
if (E)
|
||||||
exitWithError(std::move(E), "Error in getting profile count sums");
|
exitWithError(std::move(E), "Error in getting profile count sums");
|
||||||
if (Overlap.Base.CountSum < 1.0f) {
|
if (Overlap.Base.CountSum < 1.0f) {
|
||||||
|
|
Loading…
Reference in New Issue