[PATCH] D148876: [IndirectCallPromotion] Clear value profile metadata after the last run of indirect-call-promotion in a pipeline

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 20:48:59 PDT 2023


hoy added a comment.

Thanks for the illustration. For AutoFDO, I took a look at the debug info merger (https://github.com/llvm/llvm-project/blob/a17b71d17f853350dcd6c72ab141b196d7caec2a/llvm/lib/IR/DebugInfoMetadata.cpp#L114). Here is my understanding:

1. For two callsites that are originally from different lines of a function, the merged location will have a zero line number. This basically means the value profile for the merged callsite will be dropped by the sample loader.

2. For callsites originally from same location but ended up with different inline contexts in the caller function, the merger tries to reconcile their inline contexts by finding a common suffix of the contexts. If successful, the common suffix will be the debug location for the merged callsites. This may allow for the value profile to be shared by the two callsites (under a different inlining situation). E.g, for a callsite defined in function `D` at line 4, if somehow it gets inlined twice into function `A`:

  A:1 @ B:2 @ C:3 @ D:4
  
  A:2 @ B:3 @ C:3 @ D:4

Then my understanding is that the merged callsite will have ` C:3 @ D:4` as its debug string. If somehow in the next compilation `A` never inlines `B` but `B` inlines `C` twice, then the two callsites could end up sharing the same value profile.

#2 may sound uncommon, but #1 should be common. If that's the case, then we basically lose track of value profiles for merged callsites.

Please let me know if I miss anything.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148876



More information about the llvm-commits mailing list