summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-22 04:24:28 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-22 04:24:28 +0000
commit7e56b3723e8bfbeff346b9c76d971b172cc09b6c (patch)
treedb55463ff43b7c026dcc445a28880d63e8b77f03 /gcc/ipa-cp.c
parent4f788c5c0afa687d3a52aa1f4d101bf0f2fae967 (diff)
downloadgcc-7e56b3723e8bfbeff346b9c76d971b172cc09b6c.tar.gz
* ipa-cp.c (ipcp_estimate_growth): Check recursive calls.
(ipcp_insert_stage): Update dead_nodes bitmap. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140542 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c11
1 files changed, 9 insertions, 2 deletions
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);