From de2e08355aa51eb1596cfe674bf1ab1a8fc83976 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Fri, 10 Jan 2020 10:57:59 +0100 Subject: [PATCH] IPA-CP: Always access param_ipa_max_agg_items through opt_for_fn 2020-01-10 Martin Jambor * params.opt (param_ipa_max_agg_items): Mark as Optimization * ipa-cp.c (merge_agg_lats_step): New parameter max_agg_items, use instead of param_ipa_max_agg_items. (merge_aggregate_lattices): Extract param_ipa_max_agg_items from optimization info for the callee. From-SVN: r280098 --- gcc/ChangeLog | 8 ++++++++ gcc/ipa-cp.c | 14 +++++++++----- gcc/ipa-prop.c | 7 ++++--- gcc/params.opt | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7250b0d1ded..712541d41da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2020-01-10 Martin Jambor + + * params.opt (param_ipa_max_agg_items): Mark as Optimization + * ipa-cp.c (merge_agg_lats_step): New parameter max_agg_items, use + instead of param_ipa_max_agg_items. + (merge_aggregate_lattices): Extract param_ipa_max_agg_items from + optimization info for the callee. + 2020-01-09 Kwok Cheung Yeung * lto-streamer-in.c (input_function): Remove streamed-in inline debug diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 64bbf7f2513..9131c6acf38 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2479,13 +2479,13 @@ set_check_aggs_by_ref (class ipcp_param_lattices *dest_plats, unless there are too many already. If there are two many, return false. If there are overlaps turn whole DEST_PLATS to bottom and return false. If any skipped lattices were newly marked as containing variable, set *CHANGE to - true. */ + true. MAX_AGG_ITEMS is the maximum number of lattices. */ static bool merge_agg_lats_step (class ipcp_param_lattices *dest_plats, HOST_WIDE_INT offset, HOST_WIDE_INT val_size, struct ipcp_agg_lattice ***aglat, - bool pre_existing, bool *change) + bool pre_existing, bool *change, int max_agg_items) { gcc_checking_assert (offset >= 0); @@ -2520,7 +2520,7 @@ merge_agg_lats_step (class ipcp_param_lattices *dest_plats, set_agg_lats_to_bottom (dest_plats); return false; } - if (dest_plats->aggs_count == param_ipa_max_agg_items) + if (dest_plats->aggs_count == max_agg_items) return false; dest_plats->aggs_count++; new_al = ipcp_agg_lattice_pool.allocate (); @@ -2574,6 +2574,8 @@ merge_aggregate_lattices (struct cgraph_edge *cs, ret |= set_agg_lats_contain_variable (dest_plats); dst_aglat = &dest_plats->aggs; + int max_agg_items = opt_for_fn (cs->callee->function_symbol ()->decl, + param_ipa_max_agg_items); for (struct ipcp_agg_lattice *src_aglat = src_plats->aggs; src_aglat; src_aglat = src_aglat->next) @@ -2583,7 +2585,7 @@ merge_aggregate_lattices (struct cgraph_edge *cs, if (new_offset < 0) continue; if (merge_agg_lats_step (dest_plats, new_offset, src_aglat->size, - &dst_aglat, pre_existing, &ret)) + &dst_aglat, pre_existing, &ret, max_agg_items)) { struct ipcp_agg_lattice *new_al = *dst_aglat; @@ -2763,6 +2765,8 @@ propagate_aggs_across_jump_function (struct cgraph_edge *cs, if (set_check_aggs_by_ref (dest_plats, jfunc->agg.by_ref)) return true; + int max_agg_items = opt_for_fn (cs->callee->function_symbol ()->decl, + param_ipa_max_agg_items); FOR_EACH_VEC_ELT (*jfunc->agg.items, i, item) { HOST_WIDE_INT val_size; @@ -2772,7 +2776,7 @@ propagate_aggs_across_jump_function (struct cgraph_edge *cs, val_size = tree_to_shwi (TYPE_SIZE (item->type)); if (merge_agg_lats_step (dest_plats, item->offset, val_size, - &aglat, pre_existing, &ret)) + &aglat, pre_existing, &ret, max_agg_items)) { ret |= propagate_aggregate_lattice (cs, item, *aglat); aglat = &(*aglat)->next; diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index ddb3c9b21bc..6dc3cf6b355 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1852,8 +1852,9 @@ determine_known_aggregate_parts (struct ipa_func_body_info *fbi, tree arg_base; bool check_ref, by_ref; ao_ref r; + int max_agg_items = opt_for_fn (fbi->node->decl, param_ipa_max_agg_items); - if (param_ipa_max_agg_items == 0) + if (max_agg_items == 0) return; /* The function operates in three stages. First, we prepare check_ref, r, @@ -1951,14 +1952,14 @@ determine_known_aggregate_parts (struct ipa_func_body_info *fbi, operands, whose definitions can finally reach the call. */ add_to_agg_contents_list (&list, (*copy = *content, copy)); - if (++value_count == param_ipa_max_agg_items) + if (++value_count == max_agg_items) break; } /* Add to the list consisting of all dominating virtual operands. */ add_to_agg_contents_list (&all_list, content); - if (++item_count == 2 * param_ipa_max_agg_items) + if (++item_count == 2 * max_agg_items) break; } dom_vuse = gimple_vuse (stmt); diff --git a/gcc/params.opt b/gcc/params.opt index 6ce7dd94e90..46e891362ca 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -227,7 +227,7 @@ Common Joined UInteger Var(param_ipa_max_aa_steps) Init(25000) Param Optimizatio Maximum number of statements that will be visited by IPA formal parameter analysis based on alias analysis in any given function. -param=ipa-max-agg-items= -Common Joined UInteger Var(param_ipa_max_agg_items) Init(16) Param +Common Joined UInteger Var(param_ipa_max_agg_items) Init(16) Param Optimization Maximum number of aggregate content items for a parameter in jump functions and lattices. -param=ipa-max-param-expr-ops= -- 2.30.2