[PATCH] D110466: [llvm-profgen][CSSPGO] On-demand function size computation for preinliner

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 26 21:00:18 PDT 2021


wenlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:443
+void CSProfileGenerator::computeFuncSizeForSampleHitFunction() {
+  std::unordered_map<uint64_t, uint64_t> FuncRanges;
+  for (const auto &CI : SampleCounters) {
----------------
Some comment here would be helpful. Specifically what's in the map, and what computeFuncSizeForRange does..  I think probably computeInlinedContextSizeForRange is probably better name for computeFuncSizeForRange. (saying this because if the map contains start and end offset for a function, then compute size from given start and end offset seems weird..)


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.h:231
                                bool WasLeafInlined = false);
+  void computeFuncSizeForSampleHitFunction();
   // Post processing for profiles before writing out, such as mermining
----------------
nit: computeSizeForProfiledFunctions


================
Comment at: llvm/tools/llvm-profgen/ProfiledBinary.cpp:554
+  InstructionPointer IP(this, StartAddr, true);
+  while (IP.Address < EndAddr) {
+    uint64_t Offset = virtualAddrToOffset(IP.Address);
----------------
Is the EndAddr inclusive for function end? What is we have a 1-byte instr at EndAddr?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110466



More information about the llvm-commits mailing list