[PATCH] D109551: [AutoFDO][llvm-profgen] Profile generation for LBR(non-CS) sample

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 10 11:22:51 PDT 2021


hoy added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:253
+    if (Ret.second) {
+      Ret.first->second.setName(FrameVec[I].CallerName);
+    }
----------------
nit: use `setContext`. It's also consistent with `getTopLevelFunctionProfile`.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:280
+    // can be Addr1+1 to Addr2-1. We should ignore such range.
+    if (IP.Address > RangeEnd)
+      continue;
----------------
This is covered by the following while loop?


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:308
+    StringRef CalleeName = FunctionSamples::getCanonicalFnName(
+        Binary->getFuncFromStartOffset(TargetOffset));
+    if (CalleeName.size() == 0)
----------------
I just noticed that this call may result in empty entries populated in `FuncStartAddrMap`. Maybe refactor it to use `find`?

     StringRef getFuncFromStartOffset(uint64_t Offset) {
        return FuncStartAddrMap[Offset];
     }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109551



More information about the llvm-commits mailing list