aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-08-21 10:13:27 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-08-21 08:13:27 +0000
commitf1395d4a6e0ea98b1fa3b72d40f02fcba9801500 (patch)
treeac13290a08f4ac5331c1427478989a701ad10615
parent12523de0996e56c7f3094825ea9197b53ca7b445 (diff)
downloadgcc-f1395d4a6e0ea98b1fa3b72d40f02fcba9801500.zip
gcc-f1395d4a6e0ea98b1fa3b72d40f02fcba9801500.tar.gz
gcc-f1395d4a6e0ea98b1fa3b72d40f02fcba9801500.tar.bz2
lto-cgraph.c (lto_output_edge): Use gimple_has_body_p instead of flag_wpa.
* lto-cgraph.c (lto_output_edge): Use gimple_has_body_p instead of flag_wpa. * lto-streamer-out.c (lto_output): Likewise. * passes.c (ipa_write_optimization_summaries): Initialize statement uids. * lto.c (lto_1_to_1_map): Be prepared for node to have no file data. (lto_wpa_write_files): Update comments. From-SVN: r163438
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/lto-cgraph.c3
-rw-r--r--gcc/lto-streamer-out.c2
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto.c34
-rw-r--r--gcc/passes.c17
6 files changed, 53 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7539067..56fef86 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-20 Jan Hubicka <jh@suse.cz>
+
+ * lto-cgraph.c (lto_output_edge): Use gimple_has_body_p instead of flag_wpa.
+ * lto-streamer-out.c (lto_output): Likewise.
+ * passes.c (ipa_write_optimization_summaries): Initialize statement uids.
+
2010-08-20 Olivier Hainque <hainque@adacore.com>
* tree.h (alias_diag_flags): New enum.
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 9bd0f70..22b4916 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -281,7 +281,8 @@ lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge,
lto_output_sleb128_stream (ob->main_stream, edge->count);
bp = bitpack_create (ob->main_stream);
- uid = flag_wpa ? edge->lto_stmt_uid : gimple_uid (edge->call_stmt);
+ uid = (!gimple_has_body_p (edge->caller->decl)
+ ? edge->lto_stmt_uid : gimple_uid (edge->call_stmt));
bp_pack_value (&bp, uid, HOST_BITS_PER_INT);
bp_pack_value (&bp, edge->inline_failed, HOST_BITS_PER_INT);
bp_pack_value (&bp, edge->frequency, HOST_BITS_PER_INT);
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index e00fd86..dde86b9 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2122,7 +2122,7 @@ lto_output (cgraph_node_set set, varpool_node_set vset)
#endif
decl_state = lto_new_out_decl_state ();
lto_push_out_decl_state (decl_state);
- if (!flag_wpa)
+ if (gimple_has_body_p (node->decl))
output_function (node);
else
copy_function (node);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index daaae9a..590435f 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-20 Jan Hubicka <jh@suse.cz>
+
+ * lto.c (lto_1_to_1_map): Be prepared for node to have no file data.
+ (lto_wpa_write_files): Update comments.
+
2010-08-20 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/45357
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index a9c5dd3..0b885a7 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -835,15 +835,28 @@ lto_1_to_1_map (void)
continue;
file_data = node->local.lto_file_data;
- gcc_assert (!node->same_body_alias && file_data);
+ gcc_assert (!node->same_body_alias);
- slot = pointer_map_contains (pmap, file_data);
- if (slot)
- partition = (ltrans_partition) *slot;
+ if (file_data)
+ {
+ slot = pointer_map_contains (pmap, file_data);
+ if (slot)
+ partition = (ltrans_partition) *slot;
+ else
+ {
+ partition = new_partition (file_data->file_name);
+ slot = pointer_map_insert (pmap, file_data);
+ *slot = partition;
+ npartitions++;
+ }
+ }
+ else if (!file_data
+ && VEC_length (ltrans_partition, ltrans_partitions))
+ partition = VEC_index (ltrans_partition, ltrans_partitions, 0);
else
{
- partition = new_partition (file_data->file_name);
- slot = pointer_map_insert (pmap, file_data);
+ partition = new_partition ("");
+ slot = pointer_map_insert (pmap, NULL);
*slot = partition;
npartitions++;
}
@@ -1089,16 +1102,13 @@ lto_wpa_write_files (void)
timevar_push (TV_WHOPR_WPA);
- /* Include all inlined functions and determine what sets need to be
- compiled by LTRANS. After this loop, only those sets that
- contain callgraph nodes from more than one file will need to be
- compiled by LTRANS. */
FOR_EACH_VEC_ELT (ltrans_partition, ltrans_partitions, i, part)
lto_stats.num_output_cgraph_nodes += VEC_length (cgraph_node_ptr,
part->cgraph_set->nodes);
- /* After adding all inlinees, find out statics that need to be promoted
- to globals because of cross-file inlining. */
+ /* Find out statics that need to be promoted
+ to globals with hidden visibility because they are accessed from multiple
+ partitions. */
lto_promote_cross_file_statics ();
timevar_pop (TV_WHOPR_WPA);
diff --git a/gcc/passes.c b/gcc/passes.c
index e2b9369..1b98e99 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -1792,9 +1792,26 @@ void
ipa_write_optimization_summaries (cgraph_node_set set, varpool_node_set vset)
{
struct lto_out_decl_state *state = lto_new_out_decl_state ();
+ cgraph_node_set_iterator csi;
compute_ltrans_boundary (state, set, vset);
lto_push_out_decl_state (state);
+ for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
+ {
+ struct cgraph_node *node = csi_node (csi);
+ /* When streaming out references to statements as part of some IPA
+ pass summary, the statements need to have uids assigned.
+
+ For functions newly born at WPA stage we need to initialize
+ the uids here. */
+ if (node->analyzed
+ && gimple_has_body_p (node->decl))
+ {
+ push_cfun (DECL_STRUCT_FUNCTION (node->decl));
+ renumber_gimple_stmt_uids ();
+ pop_cfun ();
+ }
+ }
gcc_assert (flag_wpa);
ipa_write_optimization_summaries_1 (all_regular_ipa_passes, set, vset, state);