From 0208f7dab09ed1ceb3fcfceff049e24cc05d69fa Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 29 Mar 2013 19:07:34 +0100 Subject: lto-cgraph.c (output_profile_summary, [...]): Use gcov streaming; stream hot bb threshold to ltrans. * lto-cgraph.c (output_profile_summary, input_profile_summary): Use gcov streaming; stream hot bb threshold to ltrans. * predict.c (get_hot_bb_threshold): Break out from .... (maybe_hot_count_p): ... here. (set_hot_bb_threshold): New function. * lto-section-in.c (lto_section_name): Add profile. * profile.h (get_hot_bb_threshold, set_hot_bb_threshold): Declare. * ipa.c: Include hash-table.h, tree-inline.h, profile.h, lto-streamer.h and data-streamer.h (histogram_entry): New structure. (histogram, histogram_pool): New global vars. (histogram_hash): New structure. (histogram_hash::hash): New method. (histogram_hash::equal): Likewise. (account_time_size): New function. (cmp_counts): New function. (dump_histogram): New function. (ipa_profile_generate_summary): New function. (ipa_profile_write_summary): New function. (ipa_profile_read_summary): New function. (ipa_profile): Decide on threshold. (pass_ipa_profile): Add ipa_profile_write_summary and ipa_profile_read_summary. * Makefile.in (ipa.o): Update dependencies. * lto-streamer.h (LTO_section_ipa_profile): New section. From-SVN: r197243 --- gcc/lto-cgraph.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'gcc/lto-cgraph.c') diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 6d639a9..c619197 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -604,11 +604,11 @@ output_profile_summary (struct lto_simple_output_block *ob) units. */ gcc_assert (profile_info->runs); streamer_write_uhwi_stream (ob->main_stream, profile_info->runs); - streamer_write_uhwi_stream (ob->main_stream, profile_info->sum_max); + streamer_write_gcov_count_stream (ob->main_stream, profile_info->sum_max); /* sum_all is needed for computing the working set with the histogram. */ - streamer_write_uhwi_stream (ob->main_stream, profile_info->sum_all); + streamer_write_gcov_count_stream (ob->main_stream, profile_info->sum_all); /* Create and output a bitpack of non-zero histogram entries indices. */ bp = bitpack_create (ob->main_stream); @@ -620,13 +620,18 @@ output_profile_summary (struct lto_simple_output_block *ob) { if (!profile_info->histogram[h_ix].num_counters) continue; - streamer_write_uhwi_stream (ob->main_stream, + streamer_write_gcov_count_stream (ob->main_stream, profile_info->histogram[h_ix].num_counters); - streamer_write_uhwi_stream (ob->main_stream, + streamer_write_gcov_count_stream (ob->main_stream, profile_info->histogram[h_ix].min_value); - streamer_write_uhwi_stream (ob->main_stream, + streamer_write_gcov_count_stream (ob->main_stream, profile_info->histogram[h_ix].cum_value); - } + } + /* IPA-profile computes hot bb threshold based on cumulated + whole program profile. We need to stream it down to ltrans. */ + if (flag_wpa) + streamer_write_gcov_count_stream (ob->main_stream, + get_hot_bb_threshold ()); } else streamer_write_uhwi_stream (ob->main_stream, 0); @@ -1259,8 +1264,8 @@ input_profile_summary (struct lto_input_block *ib, if (runs) { file_data->profile_info.runs = runs; - file_data->profile_info.sum_max = streamer_read_uhwi (ib); - file_data->profile_info.sum_all = streamer_read_uhwi (ib); + file_data->profile_info.sum_max = streamer_read_gcov_count (ib); + file_data->profile_info.sum_all = streamer_read_gcov_count (ib); memset (file_data->profile_info.histogram, 0, sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE); @@ -1279,12 +1284,16 @@ input_profile_summary (struct lto_input_block *ib, continue; file_data->profile_info.histogram[h_ix].num_counters - = streamer_read_uhwi (ib); + = streamer_read_gcov_count (ib); file_data->profile_info.histogram[h_ix].min_value - = streamer_read_uhwi (ib); + = streamer_read_gcov_count (ib); file_data->profile_info.histogram[h_ix].cum_value - = streamer_read_uhwi (ib); + = streamer_read_gcov_count (ib); } + /* IPA-profile computes hot bb threshold based on cumulated + whole program profile. We need to stream it down to ltrans. */ + if (flag_ltrans) + set_hot_bb_threshold (streamer_read_gcov_count (ib)); } } -- cgit v1.1