[llvm] [StaticDataLayout][PGO]Implement reader and writer change for data access profiles (PR #139997)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 16:06:30 PDT 2025


================
@@ -390,6 +419,14 @@ Error IndexedMemProfReader::deserializeRadixTreeBased(
       /*Payload=*/Start + RecordPayloadOffset,
       /*Base=*/Start, memprof::RecordLookupTrait(Version, Schema)));
 
+  if (DataAccessProfOffset > RecordTableOffset) {
----------------
mingmingl-llvm wrote:

The idea to tighten the check resonates with me.

Maybe I can record both DAP offset and DAP length in the memprof header, and handle empty input in the `deserialize` method like the diff shows. How does this sound?

```

-Error DataAccessProfData::deserialize(const unsigned char *&Ptr) {
+Error DataAccessProfData::deserialize(const unsigned char *&Ptr, uint64_t Len) {
+  if (Len == 0)
+    return Error::success();

```


https://github.com/llvm/llvm-project/pull/139997


More information about the llvm-commits mailing list