From b0d9e66374cae4f996a4a2f8f2a58b9f70819ad1 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 7 Jul 2010 14:04:09 +0200 Subject: [PATCH] lto-cgraph.c (output_cgraph): Output toplevel asms only into first partition. * lto-cgraph.c (output_cgraph): Output toplevel asms only into first partition. From-SVN: r161904 --- gcc/ChangeLog | 5 +++++ gcc/lto-cgraph.c | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b42a64fdb3f..6c661c86594 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-07-06 Jan Hubicka + + * lto-cgraph.c (output_cgraph): Output toplevel asms only into first + partition. + 2010-07-06 Alexandre Oliva * doc/gimple.texi (GIMPLE_DEBUG): Document. diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 4217a71da35..04f5407a800 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -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); -- 2.30.2