This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove params for a specific optimization option.


> 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.

I think we need to decorate them with Optimization first and
then do something like param_for_fn and use it here?

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]