Patchwork [4.5,1/2] Backport of a minor fix in cgraph_function_versioning

login
register
mail settings
Submitter Martin Jambor
Date June 28, 2010, 4:56 p.m.
Message ID <20100628165654.685906460@virgil.suse.cz>
Download mbox | patch
Permalink /patch/57169/
State New
Headers show

Comments

Martin Jambor - June 28, 2010, 4:56 p.m.
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  <mjambor@suse.cz>

	Backport from mainline
	2010-05-29  Jan Hubicka  <jh@suse.cz>

	* cgraph.c (clone_function_name): Made public.
	* cgraph.h (clone_function_name): Declare.
	* cgraphunit.c (cgraph_function_versioning): Produce new name.

Patch

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 =