diff options
Diffstat (limited to 'llvm/lib/ProfileData/SampleProfReader.cpp')
-rw-r--r-- | llvm/lib/ProfileData/SampleProfReader.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp index e309d5b..f6b33d9 100644 --- a/llvm/lib/ProfileData/SampleProfReader.cpp +++ b/llvm/lib/ProfileData/SampleProfReader.cpp @@ -486,12 +486,40 @@ SampleProfileReaderExtBinary::readOneSection(const uint8_t *Start, return EC; } break; + case SecProfileSymbolList: + if (std::error_code EC = readProfileSymbolList()) + return EC; + break; default: break; } return sampleprof_error::success; } +std::error_code SampleProfileReaderExtBinary::readProfileSymbolList() { + auto UncompressSize = readNumber<uint64_t>(); + if (std::error_code EC = UncompressSize.getError()) + return EC; + + auto CompressSize = readNumber<uint64_t>(); + if (std::error_code EC = CompressSize.getError()) + return EC; + + if (!ProfSymList) + ProfSymList = std::make_unique<ProfileSymbolList>(); + + if (std::error_code EC = + ProfSymList->read(*CompressSize, *UncompressSize, Data)) + return EC; + + // CompressSize is zero only when ProfileSymbolList is not compressed. + if (*CompressSize == 0) + Data = Data + *UncompressSize; + else + Data = Data + *CompressSize; + return sampleprof_error::success; +} + std::error_code SampleProfileReaderExtBinaryBase::read() { const uint8_t *BufStart = reinterpret_cast<const uint8_t *>(Buffer->getBufferStart()); |