===================================================================
@@ -1934,7 +1934,7 @@ cgraph_clone_node (struct cgraph_node *n
static GTY(()) unsigned int clone_fn_id_num;
-static tree
+tree
clone_function_name (tree decl)
{
tree name = DECL_ASSEMBLER_NAME (decl);
===================================================================
@@ -483,6 +483,7 @@ void cgraph_set_nothrow_flag (struct cgr
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);
/* In cgraphunit.c */
void cgraph_finalize_function (tree, bool);
===================================================================
@@ -2135,6 +2135,11 @@ cgraph_function_versioning (struct cgrap
else
new_decl = build_function_decl_skip_args (old_decl, args_to_skip);
+ /* Generate a new name for the new version. */
+ DECL_NAME (new_decl) = clone_function_name (old_decl);
+ SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
+ SET_DECL_RTL (new_decl, NULL);
+
/* Create the new version's call-graph node.
and update the edges of the new node. */
new_version_node =