[PATCH] D136180: [FuncSpec] Compute specialisation gain even when forcing specialisation
Momchil Velikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 03:13:12 PDT 2022
chill added a comment.
In D136180#3867775 <https://reviews.llvm.org/D136180#3867775>, @ChuanqiXu wrote:
> In D136180#3867731 <https://reviews.llvm.org/D136180#3867731>, @chill wrote:
>
>> I don't think it's a problem at all, it's just what is, for a call site with n constants, there are 2^n-1 possible specialisations, that match the call.
For a callsite `foo(1, 2)`, in what case it will be better to specialize it as `foo_1(2)` than `foo_1_2()`?
I don't think there is such a case where `foo_1(2)` would be better than `foo_1_2()`. As explained in my comment above, `foo_1(2)` is specialised over a subset
of the constants over which `foo_1_2()` is specialised, thus `foo_1_2()` must have better cost, will appear first in the list and will be used to rewrite the call site.
Note that these considerations pertain for the case when we have already created several matching specialisations *from several call sites* and must choose which ones to apply.
It is a separate question given an individual call site, which specialisation to create. And we create the one over the greatest number of constants, as any other one would have worse gain.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136180/new/
https://reviews.llvm.org/D136180
More information about the llvm-commits
mailing list