Hi, this patchlet adjusts the DECL_NAME of the cloned functions created by cgraph_create_virtual_clone. It's currently set to a simple copy of the DECL_ASSEMBLER_NAME, which is mildly annoying because it comprises weird platform-independent tweaks, which results in a different output in error messages or in the -fstack-usage report for example. With the patchlet, it's changed to a uniform name based on the DECL_NAME and using $ as concatenation character like in SRA.
Tested on x86_64-suse-linux, OK for the mainline? 2013-08-19 Eric Botcazou <ebotca...@adacore.com> * cgraphclones.c (cgraph_create_virtual_clone): Compute the DECL_NAME of the clone from the DECL_NAME of the original function. testsuite/ * gcc.dg/tree-ssa/ipa-cp-1.c: Adjust regexp. -- Eric Botcazou
Index: cgraphclones.c =================================================================== --- cgraphclones.c (revision 201823) +++ cgraphclones.c (working copy) @@ -252,7 +252,7 @@ cgraph_clone_node (struct cgraph_node *n return new_node; } -/* Create a new name for clone of DECL, add SUFFIX. Returns an identifier. */ +/* Return a new assembler name for a clone of DECL with SUFFIX. */ static GTY(()) unsigned int clone_fn_id_num; @@ -293,8 +293,9 @@ cgraph_create_virtual_clone (struct cgra tree old_decl = old_node->symbol.decl; struct cgraph_node *new_node = NULL; tree new_decl; - size_t i; + size_t len, i; struct ipa_replace_map *map; + char *name; if (!in_lto_p) gcc_checking_assert (tree_versionable_function_p (old_decl)); @@ -318,8 +319,13 @@ cgraph_create_virtual_clone (struct cgra sometimes storing only clone decl instead of original. */ /* Generate a new name for the new version. */ - DECL_NAME (new_decl) = clone_function_name (old_decl, suffix); - SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); + len = IDENTIFIER_LENGTH (DECL_NAME (old_decl)); + name = XALLOCAVEC (char, len + strlen (suffix) + 2); + memcpy (name, IDENTIFIER_POINTER (DECL_NAME (old_decl)), len); + name[len] = '$'; + strcpy (name + len + 1, suffix); + DECL_NAME (new_decl) = get_identifier (name); + SET_DECL_ASSEMBLER_NAME (new_decl, clone_function_name (old_decl, suffix)); SET_DECL_RTL (new_decl, NULL); new_node = cgraph_clone_node (old_node, new_decl, old_node->count, Index: testsuite/gcc.dg/tree-ssa/ipa-cp-1.c =================================================================== --- testsuite/gcc.dg/tree-ssa/ipa-cp-1.c (revision 201823) +++ testsuite/gcc.dg/tree-ssa/ipa-cp-1.c (working copy) @@ -16,5 +16,5 @@ blah () very_long_function (1); } /* One appearance for dump, one self recursive call and one call from main. */ -/* { dg-final { scan-tree-dump-times "very_long_function.constprop.0 \\(\\)" 3 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "very_long_function\\\$constprop \\(\\)" 3 "optimized"} } */ /* { dg-final { cleanup-tree-dump "optimized" } } */