diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb2fa8a93ae..9f67a4c0e91 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-09-21 Jan Hubicka + + * ipa-cp.c (ipcp_estimate_growth): Check recursive calls. + (ipcp_insert_stage): Update dead_nodes bitmap. + 2008-09-22 Danny Smith PR target/37528 diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 87c724503f6..46981972f16 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1051,7 +1051,7 @@ ipcp_estimate_growth (struct cgraph_node *node) int growth; for (cs = node->callers; cs != NULL; cs = cs->next_caller) - if (!ipcp_need_redirect_p (cs)) + if (cs->caller == node || !ipcp_need_redirect_p (cs)) redirectable_node_callers++; else need_original = true; @@ -1159,7 +1159,6 @@ ipcp_insert_stage (void) int i; VEC (cgraph_edge_p, heap) * redirect_callers; varray_type replace_trees; - struct cgraph_edge *cs; int node_callers, count; tree parm_tree; struct ipa_replace_map *replace_param; @@ -1209,6 +1208,7 @@ ipcp_insert_stage (void) struct ipa_node_params *info; int growth = 0; bitmap args_to_skip; + struct cgraph_edge *cs; node = (struct cgraph_node *)fibheap_extract_min (heap); node->aux = NULL; @@ -1230,6 +1230,13 @@ ipcp_insert_stage (void) new_insns += growth; + /* Look if original function becomes dead after clonning. */ + for (cs = node->callers; cs != NULL; cs = cs->next_caller) + if (cs->caller == node || ipcp_need_redirect_p (cs)) + break; + if (!cs && !node->needed) + bitmap_set_bit (dead_nodes, node->uid); + info = IPA_NODE_REF (node); count = ipa_get_param_count (info);