On Wed, Nov 13, 2019 at 9:30 AM Martin Liška <mli...@suse.cz> wrote:
>
> On 11/13/19 9:20 AM, Jan Hubicka wrote:
> >> Hello.
> >>
> >> The patch is about removal of special *-O2 parameters that Honza added 
> >> some time
> >> ago. Right now, we have a better mechanism how to have a different default 
> >> value
> >> for a parameter. I'm planning to send a patch that will decorate some 
> >> params
> >> with Optimization attribute and so that one can sensitively use them 
> >> per-function.
> >>
> >> The patch is not a NOP, mainly because of param_max_inline_insns_auto 
> >> params.
> >> As one can see:
> >>
> >> gcc/ipa-cp.c:      if (size <= param_max_inline_insns_auto / 4)
> >> gcc/ipa-cp.c:      else if (size <= param_max_inline_insns_auto / 2)
> >> gcc/ipa-cp.c:      else if (size <= param_max_inline_insns_auto
> >> gcc/ipa-inline.c:inline_insns_auto (cgraph_node *n, bool hint)
> >> gcc/ipa-inline.c:       return param_max_inline_insns_auto
> >> gcc/ipa-inline.c:      return param_max_inline_insns_auto;
> >> gcc/ipa-inline.c:       return param_max_inline_insns_auto_o2
> >> gcc/ipa-inline.c:      return param_max_inline_insns_auto_o2;
> >> gcc/ipa-inline.c:                                   inline_insns_auto 
> >> (caller, false))))
> >> gcc/ipa-inline.c:             > inline_insns_auto (e->caller, true))
> >> gcc/ipa-inline.c:      /* Apply param_max_inline_insns_auto limit for 
> >> functions not declared
> >> gcc/ipa-inline.c:              && growth >= inline_insns_auto (e->caller, 
> >> apply_hints)
> >> gcc/ipa-inline.c:                  || growth >= inline_insns_auto 
> >> (e->caller, true)
> >> gcc/ipa-inline.c:                   : inline_insns_auto (caller, false)))
> >> gcc/ipa-split.c:                        : param_max_inline_insns_auto) + 
> >> 10)
> >> gcc/ipa-split.c:      && current->split_size >= (unsigned int) 
> >> param_max_inline_insns_auto + 10)
> >> gcc/opts.c:      SET_OPTION_IF_UNSET (opts, opts_set, 
> >> param_max_inline_insns_auto,
> >> gcc/params.opt:Common Joined UInteger Var(param_max_inline_insns_auto) 
> >> Init(30) Param
> >> gcc/params.opt:Common Joined UInteger Var(param_max_inline_insns_auto_o2) 
> >> Init(15) Param
> >>
> >> diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
> >> index df6f991ad79..9b96ca66137 100644
> >> --- a/gcc/ipa-inline.c
> >> +++ b/gcc/ipa-inline.c
> >> @@ -393,44 +393,24 @@ can_inline_edge_p (struct cgraph_edge *e, bool 
> >> report,
> >>      scale up the bound.  */
> >>
> >>   static int
> >> -inline_insns_single (cgraph_node *n, bool hint)
> >> +inline_insns_single (bool hint)
> >>   {
> >> -  if (opt_for_fn (n->decl, optimize) >= 3)
> >> -    {
> >> -      if (hint)
> >> -    return param_max_inline_insns_single
> >> -           * param_inline_heuristics_hint_percent / 100;
> >> -      return param_max_inline_insns_single;
> >> -    }
> >> -  else
> >> -    {
> >> -      if (hint)
> >> -    return param_max_inline_insns_single_o2
> >> -           * param_inline_heuristics_hint_percent_o2 / 100;
> >> -      return param_max_inline_insns_single_o2;
> >> -    }
> >> +  if (hint)
> >> +    return param_max_inline_insns_single
> >> +      * param_inline_heuristics_hint_percent / 100;
> >> +  return param_max_inline_insns_single;
> >
> > I do not see how this can be nop for LTO where you combine -O2 and -O3
> > sources? With removing the N parameter there is no way to say what
> > value should be used here.
>
> Ah, I see, you are right. So let's do it the other way around and let's
> start with the Optimization keyword first.
>
> >
> > I think we need to decorate them with Optimization first and
> > then do something like param_for_fn and use it here?
>
> No, we'll use opt_for_fn and it will all work as expected.
>
> I'm sending draft of the patch where I add Optimization keyword.

Hmm, can you please - as exercise - add Optimization only for
the "formerly" _o2 params you remove in the other patch to see
if with this you indeed get at a NOP effect?

Thanks,
Richard.

> I put the keyword on params that affect behavior of a function
> optimizations (TREE/RTL). I skipped GGC params, ASAN params and basically
> all params that influence IPA optimization. I know that most of the inliner
> parameters should become Optimization and I'm leaving that to Martin and
> Honza.
>
> Martin
>
> >
> > Honza
> >
>

Reply via email to