diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -169,7 +169,7 @@ uint64_t Size; // The index indicating the location of the current entry in // SectionHdrLayout table. - uint32_t LayoutIndex; + uint64_t LayoutIndex; }; // Flags common for all sections are defined here. In SecHdrTableEntry::Flags, diff --git a/llvm/include/llvm/ProfileData/SampleProfReader.h b/llvm/include/llvm/ProfileData/SampleProfReader.h --- a/llvm/include/llvm/ProfileData/SampleProfReader.h +++ b/llvm/include/llvm/ProfileData/SampleProfReader.h @@ -170,7 +170,7 @@ // Number of samples to get to the desrired percentile. // // NAME TABLE -// SIZE (uint32_t) +// SIZE (uint64_t) // Number of entries in the name table. // NAMES // A NUL-separated list of SIZE strings. @@ -182,7 +182,7 @@ // NOTE: This field should only be present for top-level functions // (i.e., not inlined into any caller). Inlined function calls // have no prologue, so they don't need this. -// NAME_IDX (uint32_t) +// NAME_IDX (uint64_t) // Index into the name table indicating the function name. // SAMPLES (uint64_t) // Total number of samples collected in this function. @@ -204,7 +204,7 @@ // represent all the actual functions called at runtime. // CALL_TARGETS // A list of NUM_CALLS entries for each called function: -// NAME_IDX (uint32_t) +// NAME_IDX (uint64_t) // Index into the name table with the callee name. // SAMPLES (uint64_t) // Number of samples collected at the call site. @@ -623,7 +623,7 @@ ErrorOr readString(); /// Read the string index and check whether it overflows the table. - template inline ErrorOr readStringIndex(T &Table); + template inline ErrorOr readStringIndex(T &Table); /// Return true if we've reached the end of file. bool at_eof() const { return Data >= End; } @@ -704,7 +704,7 @@ protected: std::vector SecHdrTable; - std::error_code readSecHdrTableEntry(uint32_t Idx); + std::error_code readSecHdrTableEntry(uint64_t Idx); std::error_code readSecHdrTable(); std::error_code readFuncMetadata(bool ProfileHasAttribute); diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp --- a/llvm/lib/ProfileData/SampleProfReader.cpp +++ b/llvm/lib/ProfileData/SampleProfReader.cpp @@ -515,9 +515,9 @@ } template -inline ErrorOr SampleProfileReaderBinary::readStringIndex(T &Table) { +inline ErrorOr SampleProfileReaderBinary::readStringIndex(T &Table) { std::error_code EC; - auto Idx = readNumber(); + auto Idx = readNumber(); if (std::error_code EC = Idx.getError()) return EC; if (*Idx >= Table.size()) @@ -696,7 +696,7 @@ ErrorOr SampleProfileReaderExtBinaryBase::readContextFromTable() { - auto ContextIdx = readNumber(); + auto ContextIdx = readNumber(); if (std::error_code EC = ContextIdx.getError()) return EC; if (*ContextIdx >= CSNameTable->size()) @@ -1066,11 +1066,11 @@ } std::error_code SampleProfileReaderBinary::readNameTable() { - auto Size = readNumber(); + auto Size = readNumber(); if (std::error_code EC = Size.getError()) return EC; NameTable.reserve(*Size + NameTable.size()); - for (uint32_t I = 0; I < *Size; ++I) { + for (size_t I = 0; I < *Size; ++I) { auto Name(readString()); if (std::error_code EC = Name.getError()) return EC; @@ -1121,14 +1121,14 @@ // underlying raw function names that are stored in the name table, as well as // a callsite identifier that only makes sense for non-leaf frames. std::error_code SampleProfileReaderExtBinaryBase::readCSNameTableSec() { - auto Size = readNumber(); + auto Size = readNumber(); if (std::error_code EC = Size.getError()) return EC; std::vector *PNameVec = new std::vector(); PNameVec->reserve(*Size); - for (uint32_t I = 0; I < *Size; ++I) { + for (size_t I = 0; I < *Size; ++I) { PNameVec->emplace_back(SampleContextFrameVector()); auto ContextSize = readNumber(); if (std::error_code EC = ContextSize.getError()) @@ -1249,7 +1249,7 @@ } std::error_code -SampleProfileReaderExtBinaryBase::readSecHdrTableEntry(uint32_t Idx) { +SampleProfileReaderExtBinaryBase::readSecHdrTableEntry(uint64_t Idx) { SecHdrTableEntry Entry; auto Type = readUnencodedNumber(); if (std::error_code EC = Type.getError())