> On Thu, 3 Oct 2019, Jan Hubicka wrote:
>
> > -/* Return inlining_insns_single limit for function N */
> > +/* Return inlining_insns_single limit for function N. If HINT is true
> > + scale up the bound. */
> >
> > static int
> > -inline_insns_single (cgraph_node *n)
> > +inline_insns_single (cgraph_node *n, bool hint)
> > {
> > if (opt_for_fn (n->decl, optimize >= 3))
> > - return PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE);
> > + {
> > + if (hint)
> > + return PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE)
> > + * PARAM_VALUE (PARAM_INLINE_HEURISTICS_HINT_PERCENT) / 100;
> > + return PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE);
> > + }
> > else
> > - return PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE_O2);
> > + {
> > + if (hint)
> > + return PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE_O2)
> > + * PARAM_VALUE (PARAM_INLINE_HEURISTICS_HINT_PERCENT_O2) / 100;
> > + return PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE_O2);
> > + }
> > }
>
> Hello,
>
> I don't really understand the purpose of having 2 params where one is used
> for -O2 and the other for -O3 (I didn't check -Os), instead of a single
> param whose default value depends on -On (what we had before?). Is it so
> that we can more easily mix some functions compiled at -O3 with other
> functions compiled at -O2 and thus using a different param?
The point is that the auto-inlining we want to do at -O3 is too much for
what we want to do at -O2. For C++ codebases it is really important to
auto-inline and thus I have enabled it by default for -O2+ while previously
we auto-inlined only with -O3 unless the resulting code was expected to
shrink. Making all -O2 code suddenly 30-50% bigger is not a good idea.
So for inliner (and some other optimizations) we really want to have
conservative and agressive tuning options.
Honza