[PATCH] D109934: [llvm-profgen] Add duplication factor for line-number based profile

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 16:20:30 PDT 2021


hoy added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:400
     if (!FrameVec.empty()) {
+      Count *= getDuplicationFactor(FrameVec.back().Callsite.Discriminator);
       FunctionSamples &FunctionProfile =
----------------
wenlei wrote:
> It looks like we get all duplication factors from callsite duplication factor, which is a bit weird given duplication factor applies to normal locations too. However this is a confusion cause by misleading naming. The name SampleContextFrame::Callsite is misleading because when used to represent leaf, there's no call site. It's FuncName/Location, rather than CallerName/Callsite.. I think the struct name was rename from Callsite into SampleContextFrame, but member names were kept as call site. Perhaps we should rename too, Hongtao?
Agreed. `CallerName/Callsite` is misleading as a field in SampleContextFrame. `FuncName/Location` sounds better. There are probably a lot places using them. Refactoring can be done in a separate change.

```

struct SampleContextFrame {
  StringRef CallerName;
  LineLocation Callsite;

  SampleContextFrame() : Callsite(0, 0) {}

  SampleContextFrame(StringRef CallerName, LineLocation Callsite)
      : CallerName(CallerName), Callsite(Callsite) {}
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109934



More information about the llvm-commits mailing list