Re: Creating a wrapper around a function at compile time

2022-07-15 Thread Erick Ochoa via Gcc
Awesome! Thanks! Let's go a little bit into the transformation mechanics itself. I am somewhat familiar with LTO but I am always confused about the transformations scheduled during WPA. Let's assume that: 1. we have the profiling pass, which profiles each argument in each callsite. 2. we are now

Re: Creating a wrapper around a function at compile time

2022-07-15 Thread Martin Liška
On 7/14/22 16:25, Erick Ochoa wrote: > > > On Thu, 14 Jul 2022 at 16:10, Martin Liška > wrote: > > On 7/14/22 16:08, Erick Ochoa via Gcc wrote: > > Last time I checked, value profiling can only track a single value per > > statement. > > Hi. > > Take

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Erick Ochoa via Gcc
On Thu, 14 Jul 2022 at 16:10, Martin Liška wrote: > On 7/14/22 16:08, Erick Ochoa via Gcc wrote: > > Last time I checked, value profiling can only track a single value per > > statement. > > Hi. > > Take a look at HIST_TYPE_INDIR_CALL which we use for tracking at maximum 32 > (#define GCOV_TOPN_M

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Martin Liška
On 7/14/22 16:08, Erick Ochoa via Gcc wrote: > Last time I checked, value profiling can only track a single value per > statement. Hi. Take a look at HIST_TYPE_INDIR_CALL which we use for tracking at maximum 32 (#define GCOV_TOPN_MAXIMUM_TRACKED_VALUES 32) and we use for indirect call speculative

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Erick Ochoa via Gcc
On Thu, 14 Jul 2022 at 15:51, Richard Biener wrote: > With a value-profile it would be per call site and IPA-CP can use that > to direct the cloning. I'm not sure how many > values a value histogram can track reliably here. > Last time I checked, value profiling can only track a single value pe

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Richard Biener via Gcc
On Thu, Jul 14, 2022 at 3:42 PM Erick Ochoa wrote: > > Hi Richard, > > >> > >> > So instead of wrapping the function why not transform the original function >> > to have a prologue doing a runtime check for the compile-time specialized >> > versions and perform tail-calls to them? >> > >> > What I

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Erick Ochoa via Gcc
Hi Richard, > > > So instead of wrapping the function why not transform the original > function > > to have a prologue doing a runtime check for the compile-time specialized > > versions and perform tail-calls to them? > > > > What I'm missing is who would call mul_test_param in your case? > The

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Richard Biener via Gcc
On Thu, Jul 14, 2022 at 3:27 PM Richard Biener wrote: > > On Thu, Jul 14, 2022 at 2:35 PM Erick Ochoa via Gcc wrote: > > > > Hello, > > > > I'm looking for some help in how to create a new function at compile time / > > link time. The idea is an alternative form of constant propagation. > > > > T

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Richard Biener via Gcc
On Thu, Jul 14, 2022 at 2:35 PM Erick Ochoa via Gcc wrote: > > Hello, > > I'm looking for some help in how to create a new function at compile time / > link time. The idea is an alternative form of constant propagation. > > The current implementation of ipa-cp, may specialize functions for which >