[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 16:13:22 PDT 2023

hoy added a comment.

I see. Merging could cause the loss of flow-sensitivity for PGO, but not merging doesn't give optimal code quality.

Here are my thoughts about what could happen with @mingmingl's approach that allows merging only after ICP.

1. For the training build that does not use a profile, my intuition is that we will always merge the indirect callsites, which will lead to a merged !VP profile.
2. Then for the next build that uses the profile, the callsites will first be promoted in separate, and then the leftover unpromoted callsites will be merged. That merged callsite will lead to a merged !VP profile. The already promoted callsites, if not merged, will lead to separate !VP profiles.
3. For all subsequent builds, the separate !VP profiles will be dominant, the leftover merged profile shouldn't be important as they represent non-typical paths.

The questions is, in #2, whether promoted callsites can be merged or not. I'm not quite sure but since their promotion is based on the same profile from #1, the resulting direct calls will all look the same which might be good candidates to merge. If merged, the generated profile based on this build will still lose flow-sensitivity.

There's also another possibility which is no callsites can be merged after ICP,  because of the conditional code introduced during ICP.  If this is common, then it sounds like just letting indirect callsites be merged (#1) as is isn't a deal breaker.


  rG LLVM Github Monorepo



More information about the llvm-commits mailing list