From: Jan Hubicka Date: Mon, 11 Nov 2019 19:11:02 +0000 (+0000) Subject: ipa-prop.c (ipa_propagate_indirect_call_infos): Remove ipcp summary. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=98aad294705ac35aec058e020867d736d841dad0;p=gcc.git ipa-prop.c (ipa_propagate_indirect_call_infos): Remove ipcp summary. * ipa-prop.c (ipa_propagate_indirect_call_infos): Remove ipcp summary. (ipcp_transformation_t::duplicate): Break out from ... (ipa_node_params_t::duplicate): ... here; add copying of agg replacements. * ipa-prop.h (ipcp_transformation): Add constructor and destructor. (ipcp_transformation_t): Add duplicate. From-SVN: r278062 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9bb85136725..72d1e3d672d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2019-11-11 Jan Hubicka + + * ipa-prop.c (ipa_propagate_indirect_call_infos): Remove ipcp + summary. + (ipcp_transformation_t::duplicate): Break out from ... + (ipa_node_params_t::duplicate): ... here; add copying of agg + replacements. + * ipa-prop.h (ipcp_transformation): Add constructor and destructor. + (ipcp_transformation_t): Add duplicate. + 2019-11-11 Janne Blomqvist PR fortran/91828 diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 71fbf192ffd..a6c135f242b 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3746,6 +3746,8 @@ ipa_propagate_indirect_call_infos (struct cgraph_edge *cs, if (ok) ipa_edge_args_sum->remove (cs); } + if (ipcp_transformation_sum) + ipcp_transformation_sum->remove (cs->callee); return changed; } @@ -3986,27 +3988,28 @@ ipa_node_params_t::duplicate(cgraph_node *src, cgraph_node *dst, } ipa_set_node_agg_value_chain (dst, new_av); } +} - ipcp_transformation *src_trans = ipcp_get_transformation_summary (src); - - if (src_trans) - { - ipcp_transformation_initialize (); - src_trans = ipcp_transformation_sum->get_create (src); - ipcp_transformation *dst_trans - = ipcp_transformation_sum->get_create (dst); - - dst_trans->bits = vec_safe_copy (src_trans->bits); +/* Duplication of ipcp transformation summaries. */ - const vec *src_vr = src_trans->m_vr; - vec *&dst_vr - = ipcp_get_transformation_summary (dst)->m_vr; - if (vec_safe_length (src_trans->m_vr) > 0) - { - vec_safe_reserve_exact (dst_vr, src_vr->length ()); - for (unsigned i = 0; i < src_vr->length (); ++i) - dst_vr->quick_push ((*src_vr)[i]); - } +void +ipcp_transformation_t::duplicate(cgraph_node *, cgraph_node *dst, + ipcp_transformation *src_trans, + ipcp_transformation *dst_trans) +{ + /* Avoid redundant work of duplicating vectors we will never use. */ + if (dst->inlined_to) + return; + dst_trans->bits = vec_safe_copy (src_trans->bits); + dst_trans->m_vr = vec_safe_copy (src_trans->m_vr); + ipa_agg_replacement_value *agg = src_trans->agg_values, + **aggptr = &dst_trans->agg_values; + while (agg) + { + *aggptr = ggc_alloc (); + **aggptr = *agg; + agg = agg->next; + aggptr = &(*aggptr)->next; } } diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 952c01209f5..3422cb2ddb9 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -639,6 +639,25 @@ struct GTY(()) ipcp_transformation vec *bits; /* Value range information. */ vec *m_vr; + + /* Default constructor. */ + ipcp_transformation () + : agg_values (NULL), bits (NULL), m_vr (NULL) + { } + + /* Default destructor. */ + ~ipcp_transformation () + { + ipa_agg_replacement_value *agg = agg_values; + while (agg) + { + ipa_agg_replacement_value *next = agg->next; + ggc_free (agg); + agg = next; + } + vec_free (bits); + vec_free (m_vr); + } }; void ipa_set_node_agg_value_chain (struct cgraph_node *node, @@ -759,6 +778,11 @@ public: ipcp_transformation_t (symtab, true); return summary; } + /* Hook that is called by summary when a node is duplicated. */ + virtual void duplicate (cgraph_node *node, + cgraph_node *node2, + ipcp_transformation *data, + ipcp_transformation *data2); }; /* Function summary where the IPA CP transformations are actually stored. */