Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

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.

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.
@llvmbot llvmbot added the PGO Profile Guided Optimizations label Dec 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 3, 2024

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/118533.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ProfileData/MemProf.h (+4-1)
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

Copy link

@snehasish snehasish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kazutakahirata kazutakahirata merged commit a93b77c into llvm:main Dec 4, 2024
8 checks passed
@kazutakahirata kazutakahirata deleted the memprof_clear branch December 4, 2024 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PGO Profile Guided Optimizations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants