aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/InstrProfReader.cpp
diff options
context:
space:
mode:
authormingmingl <mingmingl@google.com>2025-05-15 09:56:52 -0700
committermingmingl <mingmingl@google.com>2025-05-15 09:56:52 -0700
commitd15ae3e73589b50edeb2ab823976734eaa3806e5 (patch)
tree53f7fa084c3d06a60461fea2125e26ec0b07e771 /llvm/lib/ProfileData/InstrProfReader.cpp
parent6dd04e46542851b84bf26cd95245399204072085 (diff)
downloadllvm-users/mingmingl-llvm/test.zip
llvm-users/mingmingl-llvm/test.tar.gz
llvm-users/mingmingl-llvm/test.tar.bz2
Support reading and writing data access profiles in memprof v4.users/mingmingl-llvm/test
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfReader.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProfReader.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index e6c8343..78aba992 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -1551,6 +1551,20 @@ memprof::AllMemProfData IndexedMemProfReader::getAllMemProfData() const {
Pair.Record = std::move(*Record);
AllMemProfData.HeapProfileRecords.push_back(std::move(Pair));
}
+ // Populate the data access profiles for yaml output.
+ if (DataAccessProfileData != nullptr) {
+ for (const auto &[SymHandleRef, RecordRef] :
+ DataAccessProfileData->getRecords())
+ AllMemProfData.YamlifiedDataAccessProfiles.Records.push_back(
+ data_access_prof::DataAccessProfRecord(
+ SymHandleRef, RecordRef.AccessCount, RecordRef.Locations));
+ for (StringRef ColdSymbol : DataAccessProfileData->getKnownColdSymbols())
+ AllMemProfData.YamlifiedDataAccessProfiles.KnownColdSymbols.push_back(
+ ColdSymbol.str());
+ for (uint64_t Hash : DataAccessProfileData->getKnownColdHashes())
+ AllMemProfData.YamlifiedDataAccessProfiles.KnownColdHashes.push_back(
+ Hash);
+ }
return AllMemProfData;
}