+2019-11-11 Jan Hubicka <hubcika@ucw.cz>
+
+ * 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 <jb@gcc.gnu.org>
PR fortran/91828
if (ok)
ipa_edge_args_sum->remove (cs);
}
+ if (ipcp_transformation_sum)
+ ipcp_transformation_sum->remove (cs->callee);
return changed;
}
}
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<ipa_vr, va_gc> *src_vr = src_trans->m_vr;
- vec<ipa_vr, va_gc> *&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<ipa_agg_replacement_value> ();
+ **aggptr = *agg;
+ agg = agg->next;
+ aggptr = &(*aggptr)->next;
}
}
vec<ipa_bits *, va_gc> *bits;
/* Value range information. */
vec<ipa_vr, va_gc> *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,
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. */