From patchwork Mon Jun 28 16:56:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4.5,1/2] Backport of a minor fix in cgraph_function_versioning From: Martin Jambor X-Patchwork-Id: 57169 Message-Id: <20100628165654.685906460@virgil.suse.cz> To: GCC Patches Cc: Jan Hubicka Date: Mon, 28 Jun 2010 18:56:48 +0200 Without this patch I saw a lot of LTO/WHOPR ICEs. It is really only a small part of Honza's patch to trunk. Martin 2010-06-27 Martin Jambor Backport from mainline 2010-05-29 Jan Hubicka * cgraph.c (clone_function_name): Made public. * cgraph.h (clone_function_name): Declare. * cgraphunit.c (cgraph_function_versioning): Produce new name. Index: gcc-4_5-branch/gcc/cgraph.c =================================================================== --- gcc-4_5-branch.orig/gcc/cgraph.c +++ gcc-4_5-branch/gcc/cgraph.c @@ -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); Index: gcc-4_5-branch/gcc/cgraph.h =================================================================== --- gcc-4_5-branch.orig/gcc/cgraph.h +++ gcc-4_5-branch/gcc/cgraph.h @@ -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); Index: gcc-4_5-branch/gcc/cgraphunit.c =================================================================== --- gcc-4_5-branch.orig/gcc/cgraphunit.c +++ gcc-4_5-branch/gcc/cgraphunit.c @@ -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 =