aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/SampleProfReader.cpp
diff options
context:
space:
mode:
authorHongtao Yu <hoy@fb.com>2021-01-31 22:31:51 -0800
committerHongtao Yu <hoy@fb.com>2021-02-01 13:56:40 -0800
commit224fee8219bb3aed34f13ce40935e1b3ede90a0f (patch)
tree43f3113e2d05c98b26b2fb163acda519d76ec3e4 /llvm/lib/ProfileData/SampleProfReader.cpp
parent772eb24e00629faaae0244aa0d6d6204542c579b (diff)
downloadllvm-224fee8219bb3aed34f13ce40935e1b3ede90a0f.zip
llvm-224fee8219bb3aed34f13ce40935e1b3ede90a0f.tar.gz
llvm-224fee8219bb3aed34f13ce40935e1b3ede90a0f.tar.bz2
[CSSPGO] Tweaking inlining with pseudo probes.
Fixing up a couple places where `getCallSiteIdentifier` is needed to support pseudo-probe-based callsites. Also fixing an issue in the extbinary profile reader where the metadata section is not fully scanned based on the number of profiles loaded only for the current module. Reviewed By: wmi, wenlei Differential Revision: https://reviews.llvm.org/D95791
Diffstat (limited to 'llvm/lib/ProfileData/SampleProfReader.cpp')
-rw-r--r--llvm/lib/ProfileData/SampleProfReader.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index c9f4168..370ffc8 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -883,7 +883,7 @@ std::error_code SampleProfileReaderExtBinaryBase::readNameTableSec(bool IsMD5) {
std::error_code SampleProfileReaderExtBinaryBase::readFuncMetadata() {
if (!ProfileIsProbeBased)
return sampleprof_error::success;
- for (unsigned I = 0; I < Profiles.size(); ++I) {
+ while (Data < End) {
auto FName(readStringFromTable());
if (std::error_code EC = FName.getError())
return EC;
@@ -893,8 +893,13 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncMetadata() {
return EC;
SampleContext FContext(*FName);
- Profiles[FContext].setFunctionHash(*Checksum);
+ // No need to load metadata for profiles that are not loaded in the current
+ // module.
+ if (Profiles.count(FContext))
+ Profiles[FContext].setFunctionHash(*Checksum);
}
+
+ assert(Data == End && "More data is read than expected");
return sampleprof_error::success;
}