lto-cgraph.c (output_cgraph): Output toplevel asms only into first partition.
authorJan Hubicka <jh@suse.cz>
Wed, 7 Jul 2010 12:04:09 +0000 (14:04 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 7 Jul 2010 12:04:09 +0000 (12:04 +0000)
* lto-cgraph.c (output_cgraph): Output toplevel asms only into first
partition.

From-SVN: r161904

gcc/ChangeLog
gcc/lto-cgraph.c

index b42a64fdb3f183c2de2c7a0b8d246788e2a62812..6c661c865942f32c2ce973f8ebe39ec32157f3a0 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-06  Jan Hubicka  <jh@suse.cz>
+
+       * lto-cgraph.c (output_cgraph): Output toplevel asms only into first
+       partition.
+
 2010-07-06  Alexandre Oliva  <aoliva@redhat.com>
 
        * doc/gimple.texi (GIMPLE_DEBUG): Document.
index 4217a71da35c76a19382669b90eba2dd16868b15..04f5407a800b5f05fc88bb54ef791494cc7edf9d 100644 (file)
@@ -881,14 +881,21 @@ output_cgraph (cgraph_node_set set, varpool_node_set vset)
 
   lto_output_uleb128_stream (ob->main_stream, 0);
 
-  /* Emit toplevel asms.  */
-  for (can = cgraph_asm_nodes; can; can = can->next)
+  /* Emit toplevel asms.
+     When doing WPA we must output every asm just once.  Since we do not partition asm
+     nodes at all, output them to first output.  This is kind of hack, but should work
+     well.  */
+  if (!asm_nodes_output)
     {
-      int len = TREE_STRING_LENGTH (can->asm_str);
-      lto_output_uleb128_stream (ob->main_stream, len);
-      for (i = 0; i < len; ++i)
-       lto_output_1_stream (ob->main_stream,
-                            TREE_STRING_POINTER (can->asm_str)[i]);
+      asm_nodes_output = true;
+      for (can = cgraph_asm_nodes; can; can = can->next)
+       {
+         int len = TREE_STRING_LENGTH (can->asm_str);
+         lto_output_uleb128_stream (ob->main_stream, len);
+         for (i = 0; i < len; ++i)
+           lto_output_1_stream (ob->main_stream,
+                                TREE_STRING_POINTER (can->asm_str)[i]);
+       }
     }
 
   lto_output_uleb128_stream (ob->main_stream, 0);