[PATCH] D147954: [SimplifyCFG] Merge branch_weights for direct callsites and introduce options to preserve value profile for indirect callsites

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 07:08:18 PDT 2023


tejohnson added a comment.

> In D147954#4277744 <https://reviews.llvm.org/D147954#4277744>, @mingmingl wrote:
>
>> In D147954#4276844 <https://reviews.llvm.org/D147954#4276844>, @nikic wrote:
>>
>>> Could you please start by implementing metadata merging, and then return to this patch only if strictly necessary? I'd rather not have another SimplifyCFG option for such a niche use case, if it's possible to get most of the benefit via standard metadata merging.
>>
>> (quick reply to describe the plan) okay, let me implement something as described and see how it works for this use case
>>
>> 1. do metadata merging for direct callsites 2) conservatively not hoisting/sinking indirect callsites for indirect callsites if `!prof` presents -> indirect-call-promotion pass will clear `!prof` for indirect-callsite (since there are no other uses of  this type of value profiles) so the SimplifyCFG pass after indirect-call-promotion should be able to do a full cleanup if the indirect-call is still in the IR but not speculatively devirtualized.
>
> Actually merging two different virtual calls with the same counters could be counterproductive, and ICP pass preserves `!prof` when not all information is used so I kept the option.

I thought per our offline chat that you were going to try merging the !prof VP metadata. When is it counterproductive?


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

https://reviews.llvm.org/D147954



More information about the llvm-commits mailing list