[llvm] [memprof] Fix IndexedMemProfRecord::clear (PR #118533)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 11:22:28 PST 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/118533
This patch ensures that IndexedMemProfRecord::clear clears every field
of IndexedMemProfRecord.
This fix is not critical at the moment. The only use of this function
is in RecordWriterTrait::EmitData to release the memory we are done
with. That is, we never clear the data structure for the purpose of
reusing it.
>From 7ec7cd5d4fbb5b597f8180c6dda6f48122524aee Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 3 Dec 2024 11:07:42 -0800
Subject: [PATCH] [memprof] Fix IndexedMemProfRecord::clear
This patch ensures that IndexedMemProfRecord::clear clears every field
of IndexedMemProfRecord.
This fix is not critical at the moment. The only use of this function
is in RecordWriterTrait::EmitData to release the memory we are done
with. That is, we never clear the data structure for the purpose of
reusing it.
---
llvm/include/llvm/ProfileData/MemProf.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/llvm/include/llvm/ProfileData/MemProf.h b/llvm/include/llvm/ProfileData/MemProf.h
index 47487c9342594a..b05fc08e8aeaea 100644
--- a/llvm/include/llvm/ProfileData/MemProf.h
+++ b/llvm/include/llvm/ProfileData/MemProf.h
@@ -416,7 +416,10 @@ struct IndexedMemProfRecord {
// the last entry in the list with the same function GUID.
llvm::SmallVector<CallStackId> CallSiteIds;
- void clear() { AllocSites.clear(); }
+ void clear() {
+ AllocSites.clear();
+ CallSiteIds.clear();
+ }
void merge(const IndexedMemProfRecord &Other) {
// TODO: Filter out duplicates which may occur if multiple memprof
More information about the llvm-commits
mailing list