===================================================================
@@ -3746,6 +3746,8 @@ ipa_propagate_indirect_call_infos (struc
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
}
ipa_set_node_agg_value_chain (dst, new_av);
}
+}
- ipcp_transformation *src_trans = ipcp_get_transformation_summary (src);
+/* Duplication of ipcp transformation summaries. */
- if (src_trans)
+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)
{
- 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);
-
- 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]);
- }
+ *aggptr = ggc_alloc<ipa_agg_replacement_value> ();
+ **aggptr = *agg;
+ agg = agg->next;
+ aggptr = &(*aggptr)->next;
}
}
===================================================================
@@ -639,6 +639,25 @@ struct GTY(()) ipcp_transformation
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,
@@ -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. */