[llvm] [memprof] Fix typos in serializedSizeV0 and serializedSizeV2 (PR #88629)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 13 10:32:49 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/88629

The first field to serialize is the size of
IndexedMemProfRecord::AllocSites.  It has nothing to do with
GlobalValue::GUID.  This happens to work because of:

  using GUID = uint64_t;


>From 26278c7306793a468cc49331e4ab0a72bcf55ef2 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 13 Apr 2024 10:23:04 -0700
Subject: [PATCH] [memprof] Fix typos in serializedSizeV0 and serializedSizeV2

The first field to serialize is the size of
IndexedMemProfRecord::AllocSites.  It has nothing to do with
GlobalValue::GUID.  This happens to work because of:

  using GUID = uint64_t;
---
 llvm/lib/ProfileData/MemProf.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/ProfileData/MemProf.cpp b/llvm/lib/ProfileData/MemProf.cpp
index 96aeedf2e6913e..d856868ed2a461 100644
--- a/llvm/lib/ProfileData/MemProf.cpp
+++ b/llvm/lib/ProfileData/MemProf.cpp
@@ -42,7 +42,7 @@ size_t IndexedAllocationInfo::serializedSize(IndexedVersion Version) const {
 }
 
 static size_t serializedSizeV0(const IndexedMemProfRecord &Record) {
-  size_t Result = sizeof(GlobalValue::GUID);
+  size_t Result = sizeof(uint64_t);
   for (const IndexedAllocationInfo &N : Record.AllocSites)
     Result += N.serializedSize(Version0);
 
@@ -57,7 +57,7 @@ static size_t serializedSizeV0(const IndexedMemProfRecord &Record) {
 }
 
 static size_t serializedSizeV2(const IndexedMemProfRecord &Record) {
-  size_t Result = sizeof(GlobalValue::GUID);
+  size_t Result = sizeof(uint64_t);
   for (const IndexedAllocationInfo &N : Record.AllocSites)
     Result += N.serializedSize(Version2);
 



More information about the llvm-commits mailing list