diff options
author | Jan Hubicka <jh@suse.cz> | 2009-10-02 01:20:15 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2009-10-01 23:20:15 +0000 |
commit | 03ec7d01e07f3477397874f01ee7da39fc93d023 (patch) | |
tree | 851bbe5f7a341f0badf18bf5a177dfbf5e290e5c /gcc/cgraph.c | |
parent | 0ecdd2aae98b931eb50dff3c8013a1b7adcfaa95 (diff) | |
download | gcc-03ec7d01e07f3477397874f01ee7da39fc93d023.zip gcc-03ec7d01e07f3477397874f01ee7da39fc93d023.tar.gz gcc-03ec7d01e07f3477397874f01ee7da39fc93d023.tar.bz2 |
cgraph.c (cgraph_clone_node): Add redirect_callers parameter.
* cgraph.c (cgraph_clone_node): Add redirect_callers parameter.
(cgraph_create_virtual_clone): Just pass redirect_callers
around.
* cgraph.h (cgraph_clone_node): Update prototype.
* ipa-pure-const.c (self_recursive_p): New function.
(propagate): Use it.
* ipa-inline.c (cgraph_clone_inlined_nodes,
* cgraph_decide_recursive_inlining): Update.
* gcc.dg/tree-ssa/ipa-cp-1.c: New testcase.
From-SVN: r152388
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 75447be..15dd60a 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1656,11 +1656,13 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, by node. */ struct cgraph_node * cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, - int loop_nest, bool update_original) + int loop_nest, bool update_original, + VEC(cgraph_edge_p,heap) *redirect_callers) { struct cgraph_node *new_node = cgraph_create_node (); struct cgraph_edge *e; gcov_type count_scale; + unsigned i; new_node->decl = n->decl; new_node->origin = n->origin; @@ -1691,6 +1693,14 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, n->count = 0; } + for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++) + { + /* Redirect calls to the old version node to point to its new + version. */ + cgraph_redirect_edge_callee (e, new_node); + } + + for (e = n->callees;e; e=e->next_callee) cgraph_clone_edge (e, new_node, e->call_stmt, count_scale, freq, loop_nest, update_original); @@ -1744,8 +1754,6 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, struct cgraph_node *new_node = NULL; tree new_decl; struct cgraph_node key, **slot; - unsigned i; - struct cgraph_edge *e; gcc_assert (tree_versionable_function_p (old_decl)); @@ -1762,7 +1770,8 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, SET_DECL_RTL (new_decl, NULL); new_node = cgraph_clone_node (old_node, old_node->count, - CGRAPH_FREQ_BASE, 0, false); + CGRAPH_FREQ_BASE, 0, false, + redirect_callers); new_node->decl = new_decl; /* Update the properties. Make clone visible only within this translation unit. Make sure @@ -1821,13 +1830,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, gcc_assert (!*aslot); *aslot = new_node; } - for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++) - { - /* Redirect calls to the old version node to point to its new - version. */ - cgraph_redirect_edge_callee (e, new_node); - } - + return new_node; } |