[llvm] [memprof] Omit the key/data lengths for the frame table (PR #89711)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 13:01:26 PDT 2024


================
@@ -470,17 +470,19 @@ static uint64_t writeMemProfRecords(
 // Serialize MemProfFrameData.  Return FrameTableOffset.
 static uint64_t writeMemProfFrames(
     ProfOStream &OS,
-    llvm::MapVector<memprof::FrameId, memprof::Frame> &MemProfFrameData) {
+    llvm::MapVector<memprof::FrameId, memprof::Frame> &MemProfFrameData,
+    memprof::IndexedVersion Version) {
+  memprof::FrameWriterTrait FrameWriter(Version);
   OnDiskChainedHashTableGenerator<memprof::FrameWriterTrait>
       FrameTableGenerator;
   for (auto &[FrameId, Frame] : MemProfFrameData) {
     // Insert the key (frame id) and value (frame contents).
-    FrameTableGenerator.insert(FrameId, Frame);
+    FrameTableGenerator.insert(FrameId, Frame, FrameWriter);
----------------
kazutakahirata wrote:

> Are there changes needed in this patch to the insert() and Emit() methods of OnDiskChainedHashTableGenerator to take the writer trait?

Yes, `FrameWriter` carries the version, so we need to pass `FrameWriter` to both `insert` and `Emit`.

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


More information about the llvm-commits mailing list