[PATCH] D127031: [CSSPGO][llvm-profgen] Reimplement SampleContextTracker using context trie

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 12:13:00 PDT 2022


hoy added inline comments.


================
Comment at: llvm/include/llvm/Transforms/IPO/SampleContextTracker.h:154
+  // Free the memory of FSamples which are created in llvm-profgen.
+  void freeFSamplesAfterPreInliner();
+  void freeFSamples();
----------------
PreInliner is a llvm-profgen concept, thus it should not be exposed here.


Also the deallocation should be done by the original allocator, i.e, llvm-profgen. 


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:1008
+    } else {
+      ContextTracker.freeFSamples();
+    }
----------------
I'm wondering if these two deallocations can be combined. Maybe in `buildProfileMap` we could exclude merged contexts there and then we don't need to do `Node->setFunctionSamples(nullptr);` inside `CSPreInliner::run`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127031/new/

https://reviews.llvm.org/D127031



More information about the llvm-commits mailing list