> Hi, > > On Fri, Jan 03 2020, Martin Liška wrote: > > Hi. > > > > This is similar transformation for IPA passes. This time, > > one needs to use opt_for_fn in order to get the right > > parameter values. > > > > @Martin, Honza: > > There are last few remaining parameters which should use > > opt_for_fn: > > > > param_ipa_max_agg_items > > > IPA-CP: Always access param_ipa_max_agg_items through opt_for_fn > > 2020-01-07 Martin Jambor <mjam...@suse.cz> > > * 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. OK, thanks (to both Martins) for working on this
Honza > --- > gcc/ipa-cp.c | 14 +++++++++----- > gcc/ipa-prop.c | 8 +++++--- > gcc/params.opt | 2 +- > 3 files changed, 15 insertions(+), 9 deletions(-) > > diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c > index 4381b35a809..9e20e278eff 100644 > --- a/gcc/ipa-cp.c > +++ b/gcc/ipa-cp.c > @@ -2458,13 +2458,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); > > @@ -2499,7 +2499,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 (); > @@ -2553,6 +2553,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) > @@ -2562,7 +2564,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; > > @@ -2742,6 +2744,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; > @@ -2751,7 +2755,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 fcb13dfbac4..1ccdbbfb8c0 100644 > --- a/gcc/ipa-prop.c > +++ b/gcc/ipa-prop.c > @@ -1852,8 +1852,10 @@ determine_known_aggregate_parts (struct > ipa_func_body_info *fbi, > tree arg_base; > bool check_ref, by_ref; > ao_ref r; > + unsigned 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 +1953,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 6f05b29a929..d5f0d9a69ce 100644 > --- a/gcc/params.opt > +++ b/gcc/params.opt > @@ -223,7 +223,7 @@ Common Joined UInteger Var(param_ipa_max_aa_steps) > Init(25000) Param > 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.24.1 >