summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-29 07:31:11 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-29 07:31:11 +0000
commita70a5e2c5886c7e188ccb1be38de030808d5bf4b (patch)
tree2bccbc03becb82b7caf9f75dcea83ae37194f46b /gcc/cgraphunit.c
parent4966cbe25818acad1caf27ba439339875099c231 (diff)
downloadgcc-a70a5e2c5886c7e188ccb1be38de030808d5bf4b.tar.gz
* cgraph.c (clone_function_name): Take SUFFIX argument; export.
(cgraph_create_virtual_clone): Take SUFFIX argument; udpate use of clone_function_name. * cgraph.h (cgraph_create_virtual_clone, cgraph_function_versioning): update prototypes. (clone_function_name): Declare. * ipa-cp.c (ipcp_insert_stage): Update call of cgraph_create_virtual_clone. * omp-low.c (create_omp_child_function_name): Use cgraph_create_virtual_clone. * cgraphunit.c (cgraph_copy_node_for_versioning): Fix edges updating. (cgraph_function_versioning): Take SUFFIX argument; produce new name and make decl local. * gcc.dg/tree-ssa/ipa-cp-1.c: Update testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160016 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index d4a142b2bd7..e7e9e29659e 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2106,10 +2106,9 @@ static struct cgraph_node *
cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
tree new_decl,
VEC(cgraph_edge_p,heap) *redirect_callers)
- {
+{
struct cgraph_node *new_version;
struct cgraph_edge *e;
- struct cgraph_edge *next_callee;
unsigned i;
gcc_assert (old_version);
@@ -2118,34 +2117,24 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
new_version->analyzed = true;
new_version->local = old_version->local;
+ new_version->local.externally_visible = false;
+ new_version->local.local = true;
+ new_version->local.vtable_method = false;
new_version->global = old_version->global;
new_version->rtl = new_version->rtl;
new_version->reachable = true;
new_version->count = old_version->count;
- /* Clone the old node callees. Recursive calls are
- also cloned. */
- for (e = old_version->callees;e; e=e->next_callee)
- {
- cgraph_clone_edge (e, new_version, e->call_stmt,
- e->lto_stmt_uid, REG_BR_PROB_BASE,
- CGRAPH_FREQ_BASE,
- e->loop_nest, true);
- }
- /* Fix recursive calls.
- If OLD_VERSION has a recursive call after the
- previous edge cloning, the new version will have an edge
- pointing to the old version, which is wrong;
- Redirect it to point to the new version. */
- for (e = new_version->callees ; e; e = next_callee)
- {
- next_callee = e->next_callee;
- if (e->callee == old_version)
- cgraph_redirect_edge_callee (e, new_version);
-
- if (!next_callee)
- break;
- }
+ for (e = old_version->callees; e; e=e->next_callee)
+ cgraph_clone_edge (e, new_version, e->call_stmt,
+ e->lto_stmt_uid, REG_BR_PROB_BASE,
+ CGRAPH_FREQ_BASE,
+ e->loop_nest, true);
+ for (e = old_version->indirect_calls; e; e=e->next_callee)
+ cgraph_clone_edge (e, new_version, e->call_stmt,
+ e->lto_stmt_uid, REG_BR_PROB_BASE,
+ CGRAPH_FREQ_BASE,
+ e->loop_nest, true);
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
@@ -2175,7 +2164,8 @@ struct cgraph_node *
cgraph_function_versioning (struct cgraph_node *old_version_node,
VEC(cgraph_edge_p,heap) *redirect_callers,
VEC (ipa_replace_map_p,gc)* tree_map,
- bitmap args_to_skip)
+ bitmap args_to_skip,
+ const char *clone_name)
{
tree old_decl = old_version_node->decl;
struct cgraph_node *new_version_node = NULL;