diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/ProfileData/InstrProfReader.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/ProfileData/InstrProfWriter.cpp | 14 |
2 files changed, 17 insertions, 10 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index 58dbeef6531..66fd961c84f 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -483,8 +483,9 @@ std::error_code IndexedInstrProfReader::readHeader() { return success(); } -ErrorOr<InstrProfRecord> IndexedInstrProfReader::getInstrProfRecord( - StringRef FuncName, uint64_t FuncHash) { +ErrorOr<InstrProfRecord> +IndexedInstrProfReader::getInstrProfRecord(StringRef FuncName, + uint64_t FuncHash) { ArrayRef<InstrProfRecord> Data; std::error_code EC = Index.getRecords(FuncName, Data); if (EC != instrprof_error::success) return EC; @@ -498,10 +499,12 @@ ErrorOr<InstrProfRecord> IndexedInstrProfReader::getInstrProfRecord( return error(instrprof_error::hash_mismatch); } -std::error_code IndexedInstrProfReader::getFunctionCounts( - StringRef FuncName, uint64_t FuncHash, std::vector<uint64_t> &Counts) { +std::error_code +IndexedInstrProfReader::getFunctionCounts(StringRef FuncName, uint64_t FuncHash, + std::vector<uint64_t> &Counts) { ErrorOr<InstrProfRecord> Record = getInstrProfRecord(FuncName, FuncHash); - if (std::error_code EC = Record.getError()) return EC; + if (std::error_code EC = Record.getError()) + return EC; Counts = Record.get().Counts; return success(); diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp index 33386539576..b073d8df918 100644 --- a/llvm/lib/ProfileData/InstrProfWriter.cpp +++ b/llvm/lib/ProfileData/InstrProfWriter.cpp @@ -54,14 +54,15 @@ public: M += sizeof(uint64_t); // Number of value kinds with value sites. for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind) { uint32_t NumValueSites = ProfRecord.getNumValueSites(Kind); - if (NumValueSites == 0) continue; + if (NumValueSites == 0) + continue; M += sizeof(uint64_t); // Value kind M += sizeof(uint64_t); // The number of value sites for given value kind for (uint32_t I = 0; I < NumValueSites; I++) { M += sizeof(uint64_t); // Number of value data pairs at a value site uint64_t NumValueDataForSite = ProfRecord.getNumValueDataForSite(Kind, I); - M += 2 * sizeof(uint64_t) * NumValueDataForSite; // Value data pairs + M += 2 * sizeof(uint64_t) * NumValueDataForSite; // Value data pairs } } } @@ -83,7 +84,8 @@ public: LE.write<uint64_t>(ProfileData.first); // Function hash LE.write<uint64_t>(ProfRecord.Counts.size()); - for (uint64_t I : ProfRecord.Counts) LE.write<uint64_t>(I); + for (uint64_t I : ProfRecord.Counts) + LE.write<uint64_t>(I); // Compute the number of value kinds with value sites. uint64_t NumValueKinds = ProfRecord.getNumValueKinds(); @@ -92,7 +94,8 @@ public: // Write value data for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind) { uint32_t NumValueSites = ProfRecord.getNumValueSites(Kind); - if (NumValueSites == 0) continue; + if (NumValueSites == 0) + continue; LE.write<uint64_t>(Kind); // Write value kind // Write number of value sites for current value kind LE.write<uint64_t>(NumValueSites); @@ -134,7 +137,8 @@ static std::error_code combineInstrProfRecords(InstrProfRecord &Dest, } for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind) { - if (std::error_code EC = Dest.mergeValueProfData(Kind, Source)) return EC; + if (std::error_code EC = Dest.mergeValueProfData(Kind, Source)) + return EC; } // We keep track of the max function count as we go for simplicity. |