[llvm] [StaticDataLayout][PGO]Implement reader and writer change for data access profiles (PR #139997)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed May 21 11:10:25 PDT 2025
================
@@ -10,14 +10,20 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ProfileData/DataAccessProf.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/ProfileData/MemProf.h"
+#include <functional>
+#include <optional>
+
namespace llvm {
// Write the MemProf data to OS.
-Error writeMemProf(ProfOStream &OS, memprof::IndexedMemProfData &MemProfData,
- memprof::IndexedVersion MemProfVersionRequested,
- bool MemProfFullSchema);
+Error writeMemProf(
+ ProfOStream &OS, memprof::IndexedMemProfData &MemProfData,
+ memprof::IndexedVersion MemProfVersionRequested, bool MemProfFullSchema,
+ std::optional<std::reference_wrapper<data_access_prof::DataAccessProfData>>
----------------
snehasish wrote:
I think there is no need for the DataAccessProf record object to be valid after `writeMemProf` is called. How about just use `std::unique_ptr<DataAccessProfData>` as the param and move the contents here if valid. Then we can check if the pointer is not null inside. Wdyt?
If you change the namespace to memprof then you won't need this extra qualification here.
https://github.com/llvm/llvm-project/pull/139997
More information about the llvm-commits
mailing list