From: Richard Biener Date: Mon, 14 Oct 2019 14:03:35 +0000 (+0000) Subject: re PR middle-end/92046 (Command line options (that are per-functions) are affecting... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc2d730302da5cdf340a5100882337a807097f47;p=gcc.git re PR middle-end/92046 (Command line options (that are per-functions) are affecting --params which are global.) 2019-10-14 Richard Biener PR middle-end/92046 * dse.c (scan_insn): Use param max_active_local_stores. (dse_step1): Get PARAM_MAX_DSE_ACTIVE_LOCAL_STORES and adjust based on optimization level. * loop-invariant.c (move_loop_invariants): Adjust LOOP_INVARIANT_MAX_BBS_IN_LOOP based on optimization level. * opts.c (default_options_optimization): Do not adjust PARAM_MAX_DSE_ACTIVE_LOCAL_STORES and LOOP_INVARIANT_MAX_BBS_IN_LOOP here. From-SVN: r276963 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 176c0d21979..5db905719ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-10-14 Richard Biener + + PR middle-end/92046 + * dse.c (scan_insn): Use param max_active_local_stores. + (dse_step1): Get PARAM_MAX_DSE_ACTIVE_LOCAL_STORES and adjust + based on optimization level. + * loop-invariant.c (move_loop_invariants): Adjust + LOOP_INVARIANT_MAX_BBS_IN_LOOP based on optimization level. + * opts.c (default_options_optimization): Do not adjust + PARAM_MAX_DSE_ACTIVE_LOCAL_STORES and + LOOP_INVARIANT_MAX_BBS_IN_LOOP here. + 2019-10-14 Wilco Dijkstra * config/arm/arm.c (arm_legitimize_address): Remove Thumb-2 bailout. diff --git a/gcc/dse.c b/gcc/dse.c index c03b922bdf9..5d8c6f990ec 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -2401,7 +2401,7 @@ copy_fixed_regs (const_bitmap in) non-register target. */ static void -scan_insn (bb_info_t bb_info, rtx_insn *insn) +scan_insn (bb_info_t bb_info, rtx_insn *insn, int max_active_local_stores) { rtx body; insn_info_type *insn_info = insn_info_type_pool.allocate (); @@ -2523,8 +2523,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn) fprintf (dump_file, "handling memset as BLKmode store\n"); if (mems_found == 1) { - if (active_local_stores_len++ - >= PARAM_VALUE (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES)) + if (active_local_stores_len++ >= max_active_local_stores) { active_local_stores_len = 1; active_local_stores = NULL; @@ -2584,8 +2583,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn) it as cannot delete. This simplifies the processing later. */ if (mems_found == 1) { - if (active_local_stores_len++ - >= PARAM_VALUE (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES)) + if (active_local_stores_len++ >= max_active_local_stores) { active_local_stores_len = 1; active_local_stores = NULL; @@ -2657,6 +2655,12 @@ dse_step1 (void) bitmap_set_bit (all_blocks, ENTRY_BLOCK); bitmap_set_bit (all_blocks, EXIT_BLOCK); + /* For -O1 reduce the maximum number of active local stores for RTL DSE + since this can consume huge amounts of memory (PR89115). */ + int max_active_local_stores = PARAM_VALUE (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES); + if (optimize < 2) + max_active_local_stores /= 10; + FOR_ALL_BB_FN (bb, cfun) { insn_info_t ptr; @@ -2684,7 +2688,7 @@ dse_step1 (void) FOR_BB_INSNS (bb, insn) { if (INSN_P (insn)) - scan_insn (bb_info, insn); + scan_insn (bb_info, insn, max_active_local_stores); cselib_process_insn (insn); if (INSN_P (insn)) df_simulate_one_insn_forwards (bb, insn, regs_live); diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index d54cca41737..ef46c8aea22 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -2276,9 +2276,13 @@ move_loop_invariants (void) FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { curr_loop = loop; - /* move_single_loop_invariants for very large loops - is time consuming and might need a lot of memory. */ - if (loop->num_nodes <= (unsigned) LOOP_INVARIANT_MAX_BBS_IN_LOOP) + /* move_single_loop_invariants for very large loops is time consuming + and might need a lot of memory. For -O1 only do loop invariant + motion for very small loops. */ + unsigned max_bbs = LOOP_INVARIANT_MAX_BBS_IN_LOOP; + if (optimize < 2) + max_bbs /= 10; + if (loop->num_nodes <= max_bbs) move_single_loop_invariants (loop); } diff --git a/gcc/opts.c b/gcc/opts.c index 32869ca4919..ff95853845e 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -671,21 +671,6 @@ default_options_optimization (struct gcc_options *opts, opt2 ? 100 : default_param_value (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE), opts->x_param_values, opts_set->x_param_values); - /* For -O1 only do loop invariant motion for very small loops. */ - maybe_set_param_value - (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP, - opt2 ? default_param_value (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP) - : default_param_value (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP) / 10, - opts->x_param_values, opts_set->x_param_values); - - /* For -O1 reduce the maximum number of active local stores for RTL DSE - since this can consume huge amounts of memory (PR89115). */ - maybe_set_param_value - (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES, - opt2 ? default_param_value (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES) - : default_param_value (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES) / 10, - opts->x_param_values, opts_set->x_param_values); - /* At -Ofast, allow store motion to introduce potential race conditions. */ maybe_set_param_value (PARAM_ALLOW_STORE_DATA_RACES,