[PATCH] D126827: [llvm-profgen] Fix a loading address bug for pseudo probe profile

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 10:53:52 PDT 2022


hoy added inline comments.


================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:1195
+  // preferred loading address in order to match pseduo probe address correctly.
+  Binary->setBaseAddress(Binary->getPreferredBaseAddress());
+
----------------
wenlei wrote:
> Where do we use getBaseAddress in probe queries? Can we use getPreferredBaseAddress directly there? Ideally there should be one definition for base address which is the actual executable segment load address, and changing it here makes it inconsistent. 
Agreed that `setBaseAddress` should be called once to be consistent. Pseudo probe decoding is based on the preferred address. I think a reasonable fix could be 

1) make the decoding offset-based. This will require a change to the bolt code. base; or
2) do an offset to preferred addr translation for every probe look up in llvm-profgen. This is being done in some places, eg, `extractPrefixContextStack`. 

#2 sounds more practical. WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126827



More information about the llvm-commits mailing list