From 247afa98ba2512c7d90f3e9e05af41067ef756a3 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 10 Oct 2019 14:02:25 +0000 Subject: [PATCH] re PR middle-end/92046 (Command line options (that are per-functions) are affecting --params which are global.) 2019-10-10 Richard Biener PR middle-end/92046 * opts.c (finish_options): Do not influence global --params from options that are adjustable per function. * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Apply --param adjustment based on active cost-model. * tree-ssa-phiopt.c (cond_if_else_store_replacement): Disable further store-sinking when vectorization or if-conversion are not enabled. From-SVN: r276807 --- gcc/ChangeLog | 11 +++++++++++ gcc/opts.c | 18 ------------------ gcc/tree-ssa-phiopt.c | 6 +++++- gcc/tree-vect-data-refs.c | 23 ++++++++++++++--------- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e97db14..e70eb1d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2019-10-10 Richard Biener + + PR middle-end/92046 + * opts.c (finish_options): Do not influence global --params + from options that are adjustable per function. + * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): + Apply --param adjustment based on active cost-model. + * tree-ssa-phiopt.c (cond_if_else_store_replacement): Disable + further store-sinking when vectorization or if-conversion + are not enabled. + 2019-10-10 Jan Hubicka PR middle-end/92037 diff --git a/gcc/opts.c b/gcc/opts.c index 2df0351..83d8a87 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1123,24 +1123,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, && !opts_set->x_flag_reorder_functions) opts->x_flag_reorder_functions = 1; - /* Tune vectorization related parametees according to cost model. */ - if (opts->x_flag_vect_cost_model == VECT_COST_MODEL_CHEAP) - { - maybe_set_param_value (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS, - 6, opts->x_param_values, opts_set->x_param_values); - maybe_set_param_value (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS, - 0, opts->x_param_values, opts_set->x_param_values); - maybe_set_param_value (PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT, - 0, opts->x_param_values, opts_set->x_param_values); - } - - /* Set PARAM_MAX_STORES_TO_SINK to 0 if either vectorization or if-conversion - is disabled. */ - if ((!opts->x_flag_tree_loop_vectorize && !opts->x_flag_tree_slp_vectorize) - || !opts->x_flag_tree_loop_if_convert) - maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0, - opts->x_param_values, opts_set->x_param_values); - /* The -gsplit-dwarf option requires -ggnu-pubnames. */ if (opts->x_dwarf_split_debug_info) opts->x_debug_generate_pub_sections = 2; diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index b64bde6..38bb8b2 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -2467,7 +2467,11 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, then_assign, else_assign); } - if (MAX_STORES_TO_SINK == 0) + /* If either vectorization or if-conversion is disabled then do + not sink any stores. */ + if (MAX_STORES_TO_SINK == 0 + || (!flag_tree_loop_vectorize && !flag_tree_slp_vectorize) + || !flag_tree_loop_if_convert) return false; /* Find data references. */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 6390b19..e2baeb0 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2075,6 +2075,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) { unsigned max_allowed_peel = PARAM_VALUE (PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT); + if (flag_vect_cost_model == VECT_COST_MODEL_CHEAP) + max_allowed_peel = 0; if (max_allowed_peel != (unsigned)-1) { unsigned max_peel = npeel; @@ -2168,15 +2170,16 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) /* (2) Versioning to force alignment. */ /* Try versioning if: - 1) optimize loop for speed + 1) optimize loop for speed and the cost-model is not cheap 2) there is at least one unsupported misaligned data ref with an unknown misalignment, and 3) all misaligned data refs with a known misalignment are supported, and 4) the number of runtime alignment checks is within reason. */ - do_versioning = - optimize_loop_nest_for_speed_p (loop) - && (!loop->inner); /* FORNOW */ + do_versioning + = (optimize_loop_nest_for_speed_p (loop) + && !loop->inner /* FORNOW */ + && flag_vect_cost_model > VECT_COST_MODEL_CHEAP); if (do_versioning) { @@ -3641,13 +3644,15 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo) dump_printf_loc (MSG_NOTE, vect_location, "improved number of alias checks from %d to %d\n", may_alias_ddrs.length (), count); - if ((int) count > PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS)) + unsigned limit = PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS); + if (flag_simd_cost_model == VECT_COST_MODEL_CHEAP) + limit = default_param_value + (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS) * 6 / 10; + if (count > limit) return opt_result::failure_at (vect_location, - "number of versioning for alias " - "run-time tests exceeds %d " - "(--param vect-max-version-for-alias-checks)\n", - PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS)); + "number of versioning for alias run-time tests exceeds %d " + "(--param vect-max-version-for-alias-checks)\n", limit); return opt_result::success (); } -- 2.7.4