[llvm] [MemProf] Print full context hash when reporting hinted bytes (PR #114465)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 16:07:55 PDT 2024


================
@@ -4404,6 +4410,24 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
     Stream.EmitRecord(bitc::FS_STACK_IDS, Index->stackIds(), StackIdAbbvId);
   }
 
+  SmallVector<uint64_t, 64> NameVals;
+  if (!Index->contextSizeInfos().empty()) {
+    auto ContextSizeInfoAbbv = std::make_shared<BitCodeAbbrev>();
+    ContextSizeInfoAbbv->Add(BitCodeAbbrevOp(bitc::FS_CONTEXT_SIZE_INFOS));
+    // numids x (fullStackid, totalsize)
+    ContextSizeInfoAbbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+    ContextSizeInfoAbbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
+    unsigned ContextSizeInfoAbbvId =
+        Stream.EmitAbbrev(std::move(ContextSizeInfoAbbv));
+    for (const auto &Info : Index->contextSizeInfos()) {
----------------
snehasish wrote:

Can use a structured binding here.

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


More information about the llvm-commits mailing list