aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-11-14 13:08:57 +0100
committerMartin Liska <marxin@gcc.gnu.org>2019-11-14 12:08:57 +0000
commit78a502caec5371cf5d107c3a6cf944bac0aaeb7c (patch)
tree7f84b73d1a7e066bac0f6790400d858ad8b34f20
parent4c4503bf8c538bdbd8db8940aae3d7000885776e (diff)
downloadgcc-78a502caec5371cf5d107c3a6cf944bac0aaeb7c.zip
gcc-78a502caec5371cf5d107c3a6cf944bac0aaeb7c.tar.gz
gcc-78a502caec5371cf5d107c3a6cf944bac0aaeb7c.tar.bz2
Add Optimization keyword for param_max_inline_insns_auto param.
2019-11-14 Martin Liska <mliska@suse.cz> * ipa-cp.c (devirtualization_time_bonus): Use opt_for_fn of a callee to get value of the param. * ipa-inline.c (inline_insns_auto): Use proper opt_for_fn. * opts.c (maybe_default_option): Do not overwrite param value if optimization level does not match. Note that params usually have default value set via Init() keyword. * params.opt: Remove -param=max-inline-insns-auto-O2. * cif-code.def (MAX_INLINE_INSNS_AUTO_O2_LIMIT): Remove. * doc/invoke.texi: Remove documentation of max-inline-insns-auto-O2. 2019-11-14 Martin Liska <mliska@suse.cz> * c-c++-common/asan/memcmp-1.c: Update expected backtrace. From-SVN: r278218
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/cif-code.def2
-rw-r--r--gcc/doc/invoke.texi11
-rw-r--r--gcc/ipa-cp.c8
-rw-r--r--gcc/ipa-inline.c18
-rw-r--r--gcc/opts.c6
-rw-r--r--gcc/params.opt6
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/c-c++-common/asan/memcmp-1.c4
9 files changed, 38 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6b77d87..7af5644 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,19 @@
2019-11-14 Martin Liska <mliska@suse.cz>
+ * ipa-cp.c (devirtualization_time_bonus): Use opt_for_fn
+ of a callee to get value of the param.
+ * ipa-inline.c (inline_insns_auto): Use proper
+ opt_for_fn.
+ * opts.c (maybe_default_option): Do not overwrite param
+ value if optimization level does not match. Note that
+ params usually have default value set via Init() keyword.
+ * params.opt: Remove -param=max-inline-insns-auto-O2.
+ * cif-code.def (MAX_INLINE_INSNS_AUTO_O2_LIMIT): Remove.
+ * doc/invoke.texi: Remove documentation of
+ max-inline-insns-auto-O2.
+
+2019-11-14 Martin Liska <mliska@suse.cz>
+
* tree-switch-conversion.c (switch_conversion::switch_conversion):
Do not initialize m_other_count.
(switch_conversion::collect): Do not count m_default_count and
diff --git a/gcc/cif-code.def b/gcc/cif-code.def
index a154f24..b4403c9 100644
--- a/gcc/cif-code.def
+++ b/gcc/cif-code.def
@@ -74,8 +74,6 @@ 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/doc/invoke.texi b/gcc/doc/invoke.texi
index 69f057e..fe79ca2 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -11283,16 +11283,11 @@ applied. In other cases @option{max-inline-insns-single-O2} is applied.
@item max-inline-insns-auto
-@item max-inline-insns-auto-O2
When you use @option{-finline-functions} (included in @option{-O3}),
a lot of functions that would otherwise not be considered for inlining
by the compiler are investigated. To those functions, a different
(more restrictive) limit compared to functions declared inline can
-be applied.
-
-For functions compiled with optimization levels
-@option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
-applied. In other cases @option{max-inline-insns-auto-O2} is applied.
+be applied (@option{--param max-inline-insns-auto}).
@item max-inline-insns-small
This is bound applied to calls which are considered relevant with
@@ -11313,8 +11308,8 @@ execute function prologue and epilogue
@item inline-heuristics-hint-percent
@item inline-heuristics-hint-percent-O2
The scale (in percents) applied to @option{inline-insns-single},
-@option{inline-insns-single-O2}, @option{inline-insns-auto},
-@option{inline-insns-auto-O2} when inline heuristics hints that inlining is
+@option{inline-insns-single-O2}, @option{inline-insns-auto}
+when inline heuristics hints that inlining is
very profitable (will enable later optimizations).
For functions compiled with optimization levels
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index f0d354b..86c6253 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -2936,11 +2936,13 @@ devirtualization_time_bonus (struct cgraph_node *node,
int size = ipa_size_summaries->get (callee)->size;
/* FIXME: The values below need re-considering and perhaps also
integrating into the cost metrics, at lest in some very basic way. */
- if (size <= param_max_inline_insns_auto / 4)
+ int max_inline_insns_auto
+ = opt_for_fn (callee->decl, param_max_inline_insns_auto);
+ if (size <= max_inline_insns_auto / 4)
res += 31 / ((int)speculative + 1);
- else if (size <= param_max_inline_insns_auto / 2)
+ else if (size <= max_inline_insns_auto / 2)
res += 15 / ((int)speculative + 1);
- else if (size <= param_max_inline_insns_auto
+ else if (size <= max_inline_insns_auto
|| DECL_DECLARED_INLINE_P (callee->decl))
res += 7 / ((int)speculative + 1);
}
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 78ec0ec..effb597 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -417,20 +417,10 @@ inline_insns_single (cgraph_node *n, bool hint)
static int
inline_insns_auto (cgraph_node *n, 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;
- }
+ int max_inline_insns_auto = opt_for_fn (n->decl, param_max_inline_insns_auto);
+ if (hint)
+ return max_inline_insns_auto * param_inline_heuristics_hint_percent / 100;
+ return max_inline_insns_auto;
}
/* Decide if we can inline the edge and possibly update
diff --git a/gcc/opts.c b/gcc/opts.c
index 74f05f1..addebf1 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,9 @@ 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_max_inline_insns_auto_, NULL, 30 },
+
/* -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 be0a3a1..d8a10b8 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -467,11 +467,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) Optimization Param
The maximum number of instructions when automatically inlining.
-param=max-inline-insns-recursive=
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 19aaa42..914f005 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2019-11-14 Martin Liska <mliska@suse.cz>
+
+ * c-c++-common/asan/memcmp-1.c: Update expected backtrace.
+
2019-11-14 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/gomp/declare-variant-11.c: Add "sse4.2" and "sse4.1"
diff --git a/gcc/testsuite/c-c++-common/asan/memcmp-1.c b/gcc/testsuite/c-c++-common/asan/memcmp-1.c
index 0a513c0..0403ad7 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)" } */