Remove params for a specific optimization option.
diff mbox series

Message ID 83a843f2-1bf9-e467-0795-33a492fd3683@suse.cz
State New
Headers show
Series
  • Remove params for a specific optimization option.
Related show

Commit Message

Martin Liška Nov. 13, 2019, 8:15 a.m. UTC
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

The param_max_inline_insns_auto_o2 version is used with an optimization level smaller then -O3
in ipa-inline.c (but not in ipa-cp.c and ipa-split.c). That's very inconsistent hack.
That's why I needed to adjust an asan test, where the expected backtrace has changed.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-11-12  Martin Liska  <mliska@suse.cz>

	* cif-code.def (MAX_INLINE_INSNS_SINGLE_O2_LIMIT): Remove.
	(MAX_INLINE_INSNS_AUTO_O2_LIMIT): Remove.
	* ipa-inline.c (inline_insns_single): Remove n argument
	and do not use *_o2 parameters.
	(inline_insns_auto): Likewise.
	(can_inline_edge_by_limits_p): Do not use *_o2 parameters.
	(want_early_inline_function_p): Likewise.
	(big_speedup_p): Likewise.
	(want_inline_small_function_p): Likewise.
	(edge_badness): Likewise.
	* opts.c (maybe_default_option): Do not drop default value
	for parameters.
	(default_options_table): Add -O3+ changes for parameters.
	* params.opt: Remove all *-O2 params.

gcc/testsuite/ChangeLog:

2019-11-12  Martin Liska  <mliska@suse.cz>

	* g++.dg/tree-ssa/pr53844.C: Remove all *-O2 params.
	* g++.dg/tree-ssa/pr61034.C: Likewise.
	* g++.dg/tree-ssa/pr8781.C: Likewise.
	* g++.dg/warn/Wstringop-truncation-1.C: Likewise.
	* gcc.dg/ipa/pr63416.c: Likewise.
	* gcc.dg/tree-ssa/ssa-thread-12.c: Likewise.
	* gcc.dg/vect/pr66142.c: Likewise.
	* gcc.dg/winline-3.c: Likewise.
	* gcc.target/powerpc/pr72804.c: Likewise.

gcc/testsuite/ChangeLog:

2019-11-12  Martin Liska  <mliska@suse.cz>

	* c-c++-common/asan/memcmp-1.c: Update expected backtrace.
---
  gcc/cif-code.def                              |   4 -
  gcc/ipa-inline.c                              | 104 ++++++------------
  gcc/opts.c                                    |  11 +-
  gcc/params.opt                                |  32 +-----
  gcc/testsuite/c-c++-common/asan/memcmp-1.c    |   4 +-
  gcc/testsuite/g++.dg/tree-ssa/pr53844.C       |   2 +-
  gcc/testsuite/g++.dg/tree-ssa/pr61034.C       |   2 +-
  gcc/testsuite/g++.dg/tree-ssa/pr8781.C        |   2 +-
  .../g++.dg/warn/Wstringop-truncation-1.C      |   2 +-
  gcc/testsuite/gcc.dg/ipa/pr63416.c            |   2 +-
  gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c |   2 +-
  gcc/testsuite/gcc.dg/vect/pr66142.c           |   2 +-
  gcc/testsuite/gcc.dg/winline-3.c              |   2 +-
  gcc/testsuite/gcc.target/powerpc/pr72804.c    |   2 +-
  14 files changed, 58 insertions(+), 115 deletions(-)

Comments

Jan Hubicka Nov. 13, 2019, 8:20 a.m. UTC | #1
> 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
Martin Liška Nov. 13, 2019, 8:30 a.m. UTC | #2
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.
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
>
Richard Biener Nov. 13, 2019, 1:36 p.m. UTC | #3
On Wed, Nov 13, 2019 at 9:30 AM Martin Liška <mliska@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
> >
>

Patch
diff mbox series

diff --git a/gcc/cif-code.def b/gcc/cif-code.def
index a154f24f13d..ac773c1134c 100644
--- a/gcc/cif-code.def
+++ b/gcc/cif-code.def
@@ -70,12 +70,8 @@  DEFCIFCODE(LARGE_STACK_FRAME_GROWTH_LIMIT, CIF_FINAL_NORMAL,
 	   N_("--param large-stack-frame-growth limit reached"))
 DEFCIFCODE(MAX_INLINE_INSNS_SINGLE_LIMIT, CIF_FINAL_NORMAL,
 	   N_("--param max-inline-insns-single limit reached"))
-DEFCIFCODE(MAX_INLINE_INSNS_SINGLE_O2_LIMIT, CIF_FINAL_NORMAL,
-	   N_("--param max-inline-insns-single-O2 limit reached"))
 DEFCIFCODE(MAX_INLINE_INSNS_AUTO_LIMIT, CIF_FINAL_NORMAL,
 	   N_("--param max-inline-insns-auto limit reached"))
-DEFCIFCODE(MAX_INLINE_INSNS_AUTO_O2_LIMIT, CIF_FINAL_NORMAL,
-	   N_("--param max-inline-insns-auto-O2 limit reached"))
 DEFCIFCODE(INLINE_UNIT_GROWTH_LIMIT, CIF_FINAL_NORMAL,
 	   N_("--param inline-unit-growth limit reached"))
 
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;
 }
 
 /* Return inlining_insns_auto limit for function N. If HINT is true
    scale up the bound.   */
 
 static int
-inline_insns_auto (cgraph_node *n, bool hint)
+inline_insns_auto (bool hint)
 {
-  if (opt_for_fn (n->decl, optimize) >= 3)
-    {
-      if (hint)
-	return param_max_inline_insns_auto
-	       * param_inline_heuristics_hint_percent / 100;
-      return param_max_inline_insns_auto;
-    }
-  else
-    {
-      if (hint)
-	return param_max_inline_insns_auto_o2
-	       * param_inline_heuristics_hint_percent_o2 / 100;
-      return param_max_inline_insns_auto_o2;
-    }
+  if (hint)
+    return param_max_inline_insns_auto
+      * param_inline_heuristics_hint_percent / 100;
+  return param_max_inline_insns_auto;
 }
 
 /* Decide if we can inline the edge and possibly update
@@ -575,8 +555,8 @@  can_inline_edge_by_limits_p (struct cgraph_edge *e, bool report,
 	  int growth = estimate_edge_growth (e);
 	  if (growth > param_max_inline_insns_size
 	      && (!DECL_DECLARED_INLINE_P (callee->decl)
-		  && growth >= MAX (inline_insns_single (caller, false),
-				    inline_insns_auto (caller, false))))
+		  && growth >= MAX (inline_insns_single (false),
+				    inline_insns_auto (false))))
 	    {
 	      e->inline_failed = CIF_OPTIMIZATION_MISMATCH;
 	      inlinable = false;
@@ -684,10 +664,7 @@  want_early_inline_function_p (struct cgraph_edge *e)
     {
       int growth = estimate_edge_growth (e);
       int n;
-      int early_inlining_insns = opt_for_fn (e->caller->decl, optimize) >= 3
-				 ? param_early_inlining_insns
-				 : param_early_inlining_insns_o2;
-
+      int early_inlining_insns = param_early_inlining_insns;
 
       if (growth <= param_max_inline_insns_size)
 	;
@@ -789,12 +766,7 @@  big_speedup_p (struct cgraph_edge *e)
   sreal freq = e->sreal_frequency ();
   sreal time = compute_uninlined_call_time (e, unspec_time, freq);
   sreal inlined_time = compute_inlined_call_time (e, spec_time, freq);
-  cgraph_node *caller = (e->caller->inlined_to
-			 ? e->caller->inlined_to
-			 : e->caller);
-  int limit = opt_for_fn (caller->decl, optimize) >= 3
-	      ? param_inline_min_speedup
-	      : param_inline_min_speedup_o2;
+  int limit = param_inline_min_speedup;
 
   if ((time - inlined_time) * 100 > time * limit)
     return true;
@@ -828,28 +800,20 @@  want_inline_small_function_p (struct cgraph_edge *e, bool report)
 	   && (!e->count.ipa ().initialized_p () || !e->maybe_hot_p ()))
 	   && ipa_fn_summaries->get (callee)->min_size
 		- ipa_call_summaries->get (e)->call_stmt_size
-	      > inline_insns_auto (e->caller, true))
+	      > inline_insns_auto (true))
     {
-      if (opt_for_fn (e->caller->decl, optimize) >= 3)
-        e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
-      else
-        e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_O2_LIMIT;
+      e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
       want_inline = false;
     }
   else if ((DECL_DECLARED_INLINE_P (callee->decl)
 	    || e->count.ipa ().nonzero_p ())
 	   && ipa_fn_summaries->get (callee)->min_size
 		- ipa_call_summaries->get (e)->call_stmt_size
-	      > inline_insns_single (e->caller, true))
+	      > inline_insns_single (true))
     {
-      if (opt_for_fn (e->caller->decl, optimize) >= 3)
-	e->inline_failed = (DECL_DECLARED_INLINE_P (callee->decl)
-			    ? CIF_MAX_INLINE_INSNS_SINGLE_LIMIT
-			    : CIF_MAX_INLINE_INSNS_AUTO_LIMIT);
-      else
-	e->inline_failed = (DECL_DECLARED_INLINE_P (callee->decl)
-			    ? CIF_MAX_INLINE_INSNS_SINGLE_O2_LIMIT
-			    : CIF_MAX_INLINE_INSNS_AUTO_O2_LIMIT);
+      e->inline_failed = (DECL_DECLARED_INLINE_P (callee->decl)
+			  ? CIF_MAX_INLINE_INSNS_SINGLE_LIMIT
+			  : CIF_MAX_INLINE_INSNS_AUTO_LIMIT);
       want_inline = false;
     }
   else
@@ -868,15 +832,12 @@  want_inline_small_function_p (struct cgraph_edge *e, bool report)
 	 Avoid computation of big_speedup_p when not necessary to change
 	 outcome of decision.  */
       else if (DECL_DECLARED_INLINE_P (callee->decl)
-	       && growth >= inline_insns_single (e->caller, apply_hints)
+	       && growth >= inline_insns_single (apply_hints)
 	       && (apply_hints
-		   || growth >= inline_insns_single (e->caller, true)
+		   || growth >= inline_insns_single (true)
 		   || !big_speedup_p (e)))
 	{
-	  if (opt_for_fn (e->caller->decl, optimize) >= 3)
-            e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT;
-	  else
-            e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_O2_LIMIT;
+	  e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT;
 	  want_inline = false;
 	}
       else if (!DECL_DECLARED_INLINE_P (callee->decl)
@@ -884,7 +845,7 @@  want_inline_small_function_p (struct cgraph_edge *e, bool report)
 	       && growth >= param_max_inline_insns_small)
 	{
 	  /* growth_positive_p is expensive, always test it last.  */
-          if (growth >= inline_insns_single (e->caller, false)
+	  if (growth >= inline_insns_single (false)
 	      || growth_positive_p (callee, e, growth))
 	    {
               e->inline_failed = CIF_NOT_DECLARED_INLINED;
@@ -894,25 +855,22 @@  want_inline_small_function_p (struct cgraph_edge *e, bool report)
       /* Apply param_max_inline_insns_auto limit for functions not declared
 	 inline.  Bypass the limit when speedup seems big.  */
       else if (!DECL_DECLARED_INLINE_P (callee->decl)
-	       && growth >= inline_insns_auto (e->caller, apply_hints)
+	       && growth >= inline_insns_auto (apply_hints)
 	       && (apply_hints
-		   || growth >= inline_insns_auto (e->caller, true)
+		   || growth >= inline_insns_auto (true)
 		   || !big_speedup_p (e)))
 	{
 	  /* growth_positive_p is expensive, always test it last.  */
-          if (growth >= inline_insns_single (e->caller, false)
+	  if (growth >= inline_insns_single (false)
 	      || growth_positive_p (callee, e, growth))
 	    {
-	      if (opt_for_fn (e->caller->decl, optimize) >= 3)
-		e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
-	      else
-		e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_O2_LIMIT;
+	      e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
 	      want_inline = false;
  	    }
 	}
       /* If call is cold, do not inline when function body would grow. */
       else if (!e->maybe_hot_p ()
-	       && (growth >= inline_insns_single (e->caller, false)
+	       && (growth >= inline_insns_single (false)
 		   || growth_positive_p (callee, e, growth)))
 	{
           e->inline_failed = CIF_UNLIKELY_CALL;
@@ -1220,8 +1178,8 @@  edge_badness (struct cgraph_edge *edge, bool dump)
 	      && caller_info->inlinable
 	      && ipa_size_summaries->get (caller)->size
 		 < (DECL_DECLARED_INLINE_P (caller->decl)
-		    ? inline_insns_single (caller, false)
-		    : inline_insns_auto (caller, false)))
+		    ? inline_insns_single (false)
+		    : inline_insns_auto (false)))
 	    {
 	      if (dump)
 		fprintf (dump_file,
diff --git a/gcc/opts.c b/gcc/opts.c
index 74f05f1b58d..1840be976da 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -388,7 +388,8 @@  maybe_default_option (struct gcc_options *opts,
 			     lang_mask, DK_UNSPECIFIED, loc,
 			     handlers, true, dc);
   else if (default_opt->arg == NULL
-	   && !option->cl_reject_negative)
+	   && !option->cl_reject_negative
+	   && !(option->flags & CL_PARAMS))
     handle_generated_option (opts, opts_set, default_opt->opt_index,
 			     default_opt->arg, !default_opt->value,
 			     lang_mask, DK_UNSPECIFIED, loc,
@@ -541,6 +542,14 @@  static const struct default_options default_options_table[] =
     { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_DYNAMIC },
     { OPT_LEVELS_3_PLUS, OPT_fversion_loops_for_strides, NULL, 1 },
 
+    /* -O3 parameters.  */
+    { OPT_LEVELS_3_PLUS, OPT__param_early_inlining_insns_, NULL, 14 },
+    { OPT_LEVELS_3_PLUS, OPT__param_inline_heuristics_hint_percent_, NULL,
+      600 },
+    { OPT_LEVELS_3_PLUS, OPT__param_inline_min_speedup_, NULL, 15},
+    { OPT_LEVELS_3_PLUS, OPT__param_max_inline_insns_auto_, NULL, 30 },
+    { OPT_LEVELS_3_PLUS, OPT__param_max_inline_insns_single_, NULL, 200 },
+
     /* -Ofast adds optimizations to -O3.  */
     { OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 },
     { OPT_LEVELS_FAST, OPT_fallow_store_data_races, NULL, 1 },
diff --git a/gcc/params.opt b/gcc/params.opt
index be0a3a15598..2e88ba21a2a 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -99,12 +99,8 @@  Common Joined UInteger Var(param_dse_max_object_size) Init(256) Param
 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
 
 -param=early-inlining-insns=
-Common Joined UInteger Var(param_early_inlining_insns) Init(14) Param
-Maximal estimated growth of function body caused by early inlining of single call with -O3 and -Ofast.
-
--param=early-inlining-insns-O2=
-Common Joined UInteger Var(param_early_inlining_insns_o2) Init(6) Param
-Maximal estimated growth of function body caused by early inlining of single call with -O1 and -O2.
+Common Joined UInteger Var(param_early_inlining_insns) Init(6) Param
+Maximal estimated growth of function body caused by early inlining of single call.
 
 -param=fsm-maximum-phi-arguments=
 Common Joined UInteger Var(param_fsm_maximum_phi_arguments) Init(100) IntegerRange(1, 999999) Param
@@ -179,19 +175,11 @@  Common Joined UInteger Var(param_hsa_gen_debug_stores) IntegerRange(0, 1) Param
 Level of hsa debug stores verbosity.
 
 -param=inline-heuristics-hint-percent=
-Common Joined UInteger Var(param_inline_heuristics_hint_percent) Init(600) IntegerRange(100, 1000000) Param
-The scale (in percents) applied to inline-insns-single and auto limits when heuristics hints that inlining is very profitable with -O3 and -Ofast.
-
--param=inline-heuristics-hint-percent-O2=
-Common Joined UInteger Var(param_inline_heuristics_hint_percent_o2) Init(200) IntegerRange(100, 1000000) Param
+Common Joined UInteger Var(param_inline_heuristics_hint_percent) Init(200) IntegerRange(100, 1000000) Param
 The scale (in percents) applied to inline-insns-single and auto limits when heuristics hints that inlining is very profitable.
 
 -param=inline-min-speedup=
-Common Joined UInteger Var(param_inline_min_speedup) Init(15) IntegerRange(0, 100) Param
-The minimal estimated speedup allowing inliner to ignore inline-insns-single and inline-insns-auto with -O3 and -Ofast.
-
--param=inline-min-speedup-O2=
-Common Joined UInteger Var(param_inline_min_speedup_o2) Init(30) IntegerRange(0, 100) Param
+Common Joined UInteger Var(param_inline_min_speedup) Init(30) IntegerRange(0, 100) Param
 The minimal estimated speedup allowing inliner to ignore inline-insns-single and inline-insns-auto.
 
 -param=inline-unit-growth=
@@ -467,11 +455,7 @@  Common Joined UInteger Var(param_max_hoist_depth) Init(30) Param
 Maximum depth of search in the dominator tree for expressions to hoist.
 
 -param=max-inline-insns-auto=
-Common Joined UInteger Var(param_max_inline_insns_auto) Init(30) Param
-The maximum number of instructions when automatically inlining with -O3 and -Ofast.
-
--param=max-inline-insns-auto-O2=
-Common Joined UInteger Var(param_max_inline_insns_auto_o2) Init(15) Param
+Common Joined UInteger Var(param_max_inline_insns_auto) Init(15) Param
 The maximum number of instructions when automatically inlining.
 
 -param=max-inline-insns-recursive=
@@ -483,11 +467,7 @@  Common Joined UInteger Var(param_max_inline_insns_recursive_auto) Init(450) Para
 The maximum number of instructions non-inline function can grow to via recursive inlining.
 
 -param=max-inline-insns-single=
-Common Joined UInteger Var(param_max_inline_insns_single) Init(200) Param
-The maximum number of instructions in a single function eligible for inlining with -O3 and -Ofast.
-
--param=max-inline-insns-single-O2=
-Common Joined UInteger Var(param_max_inline_insns_single_o2) Init(30) Param
+Common Joined UInteger Var(param_max_inline_insns_single) Init(30) Param
 The maximum number of instructions in a single function eligible for inlining.
 
 -param=max-inline-insns-size=
diff --git a/gcc/testsuite/c-c++-common/asan/memcmp-1.c b/gcc/testsuite/c-c++-common/asan/memcmp-1.c
index 0a513c05ee1..0403ad78945 100644
--- a/gcc/testsuite/c-c++-common/asan/memcmp-1.c
+++ b/gcc/testsuite/c-c++-common/asan/memcmp-1.c
@@ -16,5 +16,5 @@  main ()
 }
 
 /* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow.*(\n|\r\n|\r)" } */
-/* { dg-output "    #1 0x\[0-9a-f\]+ +(in _*(interceptor_|wrap_|)memcmp|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "    #2 0x\[0-9a-f\]+ +(in _*main|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #\[1-9\] 0x\[0-9a-f\]+ +(in _*(interceptor_|wrap_|)memcmp|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "    #\[2-9\] 0x\[0-9a-f\]+ +(in _*main|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr53844.C b/gcc/testsuite/g++.dg/tree-ssa/pr53844.C
index ab9879f6a18..74027e0a1fd 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr53844.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr53844.C
@@ -1,5 +1,5 @@ 
 // { dg-do compile }
-// { dg-options "-O2 -fdump-tree-optimized-vops -fno-inline-functions --param max-inline-insns-single-O2=200" }
+// { dg-options "-O2 -fdump-tree-optimized-vops -fno-inline-functions --param max-inline-insns-single=200" }
 
 struct VBase;
 
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr61034.C b/gcc/testsuite/g++.dg/tree-ssa/pr61034.C
index 6a76adb5b80..1e8168ab4f4 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr61034.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr61034.C
@@ -1,5 +1,5 @@ 
 // { dg-do compile }
-// { dg-options "-O2 -fdump-tree-fre3 -fdump-tree-optimized -fdelete-null-pointer-checks --param early-inlining-insns-O2=14 --param max-inline-insns-single-O2=200" }
+// { dg-options "-O2 -fdump-tree-fre3 -fdump-tree-optimized -fdelete-null-pointer-checks --param early-inlining-insns=14 --param max-inline-insns-single=200" }
 
 #define assume(x) if(!(x))__builtin_unreachable()
 
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr8781.C b/gcc/testsuite/g++.dg/tree-ssa/pr8781.C
index 5bc1ef03520..b9f636b6083 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr8781.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr8781.C
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O -fno-tree-sra -fdump-tree-fre1 --param early-inlining-insns-O2=14" } */
+/* { dg-options "-O -fno-tree-sra -fdump-tree-fre1 --param early-inlining-insns=14" } */
 
 int f();
 
diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-truncation-1.C b/gcc/testsuite/g++.dg/warn/Wstringop-truncation-1.C
index 49dde0a65ba..8f5e7da2c2e 100644
--- a/gcc/testsuite/g++.dg/warn/Wstringop-truncation-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wstringop-truncation-1.C
@@ -1,7 +1,7 @@ 
 /* PR/tree-optimization/84480 - bogus -Wstringop-truncation despite
    assignment with an inlined string literal
    { dg-do compile }
-   { dg-options "-O2 -Wstringop-truncation --param early-inlining-insns-O2=14" }  */
+   { dg-options "-O2 -Wstringop-truncation --param early-inlining-insns=14" }  */
 
 #include <string.h>
 
diff --git a/gcc/testsuite/gcc.dg/ipa/pr63416.c b/gcc/testsuite/gcc.dg/ipa/pr63416.c
index 5873954fba3..c7bc97e0bb1 100644
--- a/gcc/testsuite/gcc.dg/ipa/pr63416.c
+++ b/gcc/testsuite/gcc.dg/ipa/pr63416.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized --param early-inlining-insns-O2=14"  } */
+/* { dg-options "-O2 -fdump-tree-optimized --param early-inlining-insns=14"  } */
 #define _UNUSED_ __attribute__((__unused__))
 
 typedef int TEST_F30 (int *v);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
index fff731e8cfc..fb9840e95d5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread2-details -fdump-tree-thread3-details -fdump-tree-thread4-details -fno-finite-loops --param early-inlining-insns-O2=14 -fno-inline-functions" } */
+/* { dg-options "-O2 -fdump-tree-thread2-details -fdump-tree-thread3-details -fdump-tree-thread4-details -fno-finite-loops --param early-inlining-insns=14 -fno-inline-functions" } */
 /* { dg-final { scan-tree-dump "FSM" "thread2" } } */
 /* { dg-final { scan-tree-dump "FSM" "thread3" } } */
 /* { dg-final { scan-tree-dump "FSM" "thread4" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr66142.c b/gcc/testsuite/gcc.dg/vect/pr66142.c
index a0316f1f01e..7abd00ca85a 100644
--- a/gcc/testsuite/gcc.dg/vect/pr66142.c
+++ b/gcc/testsuite/gcc.dg/vect/pr66142.c
@@ -1,6 +1,6 @@ 
 /* PR middle-end/66142 */
 /* { dg-do compile } */
-/* { dg-additional-options "-ffast-math -fopenmp-simd --param early-inlining-insns-O2=14" } */
+/* { dg-additional-options "-ffast-math -fopenmp-simd --param early-inlining-insns=14" } */
 /* { dg-additional-options "-mavx" { target avx_runtime } } */
 
 struct A { float x, y; };
diff --git a/gcc/testsuite/gcc.dg/winline-3.c b/gcc/testsuite/gcc.dg/winline-3.c
index 7043a276025..7b7c8c5b9eb 100644
--- a/gcc/testsuite/gcc.dg/winline-3.c
+++ b/gcc/testsuite/gcc.dg/winline-3.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-Winline -O2 --param max-inline-insns-single-O2=1 --param inline-min-speedup-O2=100 -fgnu89-inline" } */
+/* { dg-options "-Winline -O2 --param max-inline-insns-single=1 --param inline-min-speedup=100 -fgnu89-inline" } */
 
 void big (void);
 inline int q(void) /* { dg-warning "max-inline-insns-single" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr72804.c b/gcc/testsuite/gcc.target/powerpc/pr72804.c
index 10e37caed6b..56a2452885e 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr72804.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr72804.c
@@ -1,7 +1,7 @@ 
 /* { dg-do compile { target { lp64 } } } */
 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
 /* { dg-require-effective-target powerpc_vsx_ok } */
-/* { dg-options "-O2 -mvsx -fno-inline-functions --param max-inline-insns-single-O2=200" } */
+/* { dg-options "-O2 -mvsx -fno-inline-functions --param max-inline-insns-single=200" } */
 
 __int128_t
 foo (__int128_t *src)