[compiler-rt] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 14:13:37 PDT 2024


================
@@ -30,7 +30,16 @@ void InsertOrMerge(const uptr Id, const MemInfoBlock &Block, MIBMapTy &Map) {
   } else {
     LockedMemInfoBlock *lmib = *h;
     SpinMutexLock lock(&lmib->mutex);
+    uintptr_t ShorterHistogram;
+    if (Block.AccessHistogramSize > lmib->mib.AccessHistogramSize)
+      ShorterHistogram = lmib->mib.AccessHistogram;
+    else
+      ShorterHistogram = Block.AccessHistogram;
+
     lmib->mib.Merge(Block);
+    // Free only the shorter Histogram
----------------
teresajohnson wrote:

Expand on why

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


More information about the llvm-commits mailing list