+2010-05-29 Jan Hubicka <jh@suse.cz>
+
+ * 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.
+
2010-05-29 Steven Bosscher <steven@gcc.gnu.org>
* vec.h: Include statistics.h
return new_node;
}
-/* Create a new name for omp child function. Returns an identifier. */
+/* Create a new name for clone of DECL, add SUFFIX. Returns an identifier. */
static GTY(()) unsigned int clone_fn_id_num;
-static tree
-clone_function_name (tree decl)
+tree
+clone_function_name (tree decl, const char *suffix)
{
tree name = DECL_ASSEMBLER_NAME (decl);
size_t len = IDENTIFIER_LENGTH (name);
char *tmp_name, *prefix;
- prefix = XALLOCAVEC (char, len + strlen ("_clone") + 1);
+ prefix = XALLOCAVEC (char, len + strlen (suffix) + 2);
memcpy (prefix, IDENTIFIER_POINTER (name), len);
- strcpy (prefix + len, "_clone");
+ strcpy (prefix + len + 1, suffix);
#ifndef NO_DOT_IN_LABEL
prefix[len] = '.';
#elif !defined NO_DOLLAR_IN_LABEL
prefix[len] = '$';
+#else
+ prefix[len] = '_';
#endif
ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++);
return get_identifier (tmp_name);
cgraph_create_virtual_clone (struct cgraph_node *old_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 * suffix)
{
tree old_decl = old_node->decl;
struct cgraph_node *new_node = NULL;
DECL_STRUCT_FUNCTION (new_decl) = NULL;
/* Generate a new name for the new version. */
- DECL_NAME (new_decl) = clone_function_name (old_decl);
+ DECL_NAME (new_decl) = clone_function_name (old_decl, suffix);
SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
SET_DECL_RTL (new_decl, NULL);
struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node,
VEC(cgraph_edge_p,heap)*,
VEC(ipa_replace_map_p,gc)* tree_map,
- bitmap args_to_skip);
+ bitmap args_to_skip,
+ const char *clone_name);
void cgraph_set_nothrow_flag (struct cgraph_node *, bool);
void cgraph_set_readonly_flag (struct cgraph_node *, bool);
void cgraph_set_pure_flag (struct cgraph_node *, bool);
void cgraph_set_looping_const_or_pure_flag (struct cgraph_node *, bool);
+tree clone_function_name (tree decl, const char *);
/* In cgraphunit.c */
void cgraph_finalize_function (tree, bool);
struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
VEC(cgraph_edge_p,heap)*,
VEC(ipa_replace_map_p,gc)*,
- bitmap);
+ bitmap, const char *);
void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*, bool, bitmap);
struct cgraph_node *save_inline_function_body (struct cgraph_node *);
void record_references_in_initializer (tree, bool);
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);
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
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;
new versioned node. */
node1 =
cgraph_create_virtual_clone (node, redirect_callers, replace_trees,
- args_to_skip);
+ args_to_skip, "clone");
args_to_skip = NULL;
VEC_free (cgraph_edge_p, heap, redirect_callers);
replace_trees = NULL;
static tree
create_omp_child_function_name (bool task_copy)
{
- tree name = DECL_ASSEMBLER_NAME (current_function_decl);
- size_t len = IDENTIFIER_LENGTH (name);
- char *tmp_name, *prefix;
- const char *suffix;
-
- suffix = task_copy ? "_omp_cpyfn" : "_omp_fn";
- prefix = XALLOCAVEC (char, len + strlen (suffix) + 1);
- memcpy (prefix, IDENTIFIER_POINTER (name), len);
- strcpy (prefix + len, suffix);
-#ifndef NO_DOT_IN_LABEL
- prefix[len] = '.';
-#elif !defined NO_DOLLAR_IN_LABEL
- prefix[len] = '$';
-#endif
- ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, tmp_ompfn_id_num++);
- return get_identifier (tmp_name);
+ return (clone_function_name (current_function_decl,
+ task_copy ? "_omp_cpyfn" : "_omp_fn"));
}
/* Build a decl for the omp child function. It'll not contain a body
+2010-05-29 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/tree-ssa/ipa-cp-1.c: Update testcase.
+
2010-05-28 Sebastian Pop <sebastian.pop@amd.com>
* gcc.dg/vect/vect-outer-fir-lb.c: Un-XFAIL-ed.
very_long_function (1);
}
/* One appereance for dump, one self recursive call and one call from main. */
-/* { dg-final { scan-tree-dump-times "very_long_function.clone.0 \\(\\)" 3 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "very_long_function.constprop.0 \\(\\)" 3 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */