[llvm] [SHT_LLVM_BB_ADDR_MAP] Add a new PGOAnalysisMap feature to emit dynamic instruction count (PR #119303)

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 11:21:41 PST 2025


wlei-llvm wrote:

> > Another question to answer is if one or the other modes/formats needs to be extended in some way, will it require the behaviour to be duplicated in both formats?
> 
> Sorry for the delay in response. This is basically my concern. PGO-analysis-map was merged into SHT_LLVM_BB_ADDR_MAP because they both describe the MachineBasicBlocks within a function. However, the proposed use-case is about a function-level information which may as well be extended with other information (e.g., number of loads/stores/calls within a function) later. Even if we ever need to join this information with BBAddrMap we can still do so by joining the two section's data.
> 
> > Though if we go this way, I would make it more general use(perhaps name it SHT_LLVM_PGO_FUNC_ANALYSIS_MAP indicating it's for all function-level PGO feature
> 
> I would say even more general like SHT_LLVM_FUNC_ADDR_MAP or simply SHT_LLVM_FUNC_MAP is appropriate. You don't want to limit it to PGO information.

@rlavaee  Here is a draft patch to use the new extension approach https://github.com/llvm/llvm-project/pull/123804 (will add more test/doc before publishing for review), please take a look. As you can find, It's mostly duplicated from the BB_ADDR_MAP code, but I guess it should be ok for maintenance too and good for other feature extensions. I don't have strong option, will follow your advice on which one to go, I really appreciate it!

cc @jh7370 too, in case you have more feedback on this, thank you!




https://github.com/llvm/llvm-project/pull/119303


More information about the llvm-commits mailing list