Skip to content

Commit 5662135

Browse files
author
marxin
committed
Remove arc profile histogram in non-LTO mode.
2018-09-21 Martin Liska <mliska@suse.cz> * auto-profile.c (autofdo_source_profile::read): Do not set sum_all. (read_profile): Do not add working sets. (read_autofdo_file): Remove sum_all. (afdo_callsite_hot_enough_for_early_inline): Remove const qualifier. * coverage.c (struct counts_entry): Remove gcov_summary. (read_counts_file): Read new GCOV_TAG_OBJECT_SUMMARY, do not support GCOV_TAG_PROGRAM_SUMMARY. (get_coverage_counts): Remove summary and expected arguments. * coverage.h (get_coverage_counts): Likewise. * doc/gcov-dump.texi: Remove -w option. * gcov-dump.c (dump_working_sets): Remove. (main): Do not support '-w' option. (print_usage): Likewise. (tag_summary): Likewise. * gcov-io.c (gcov_write_summary): Do not dump histogram. (gcov_read_summary): Likewise. (gcov_histo_index): Remove. (gcov_histogram_merge): Likewise. (compute_working_sets): Likewise. * gcov-io.h (GCOV_TAG_OBJECT_SUMMARY): Mark it not obsolete. (GCOV_TAG_PROGRAM_SUMMARY): Mark it obsolete. (GCOV_TAG_SUMMARY_LENGTH): Adjust. (GCOV_HISTOGRAM_SIZE): Remove. (GCOV_HISTOGRAM_BITVECTOR_SIZE): Likewise. (struct gcov_summary): Simplify rapidly just to runs and sum_max fields. (gcov_histo_index): Remove. (NUM_GCOV_WORKING_SETS): Likewise. (compute_working_sets): Likewise. * gcov-tool.c (print_overlap_usage_message): Remove trailing empty line. * gcov.c (read_count_file): Read GCOV_TAG_OBJECT_SUMMARY. (output_lines): Remove program related line. * ipa-profile.c (ipa_profile): Do not consider GCOV histogram. * lto-cgraph.c (output_profile_summary): Do not stream GCOV histogram. (input_profile_summary): Do not read it. (merge_profile_summaries): And do not merge it. (input_symtab): Do not call removed function. * modulo-sched.c (sms_schedule): Do not print sum_max. * params.def (HOT_BB_COUNT_FRACTION): Reincarnate param that was removed when histogram method was invented. (HOT_BB_COUNT_WS_PERMILLE): Mention that it's used only in LTO mode. * postreload-gcse.c (eliminate_partially_redundant_load): Fix GCOV coding style. * predict.c (get_hot_bb_threshold): Use HOT_BB_COUNT_FRACTION and dump selected value. * profile.c (add_working_set): Remove. (get_working_sets): Likewise. (find_working_set): Likewise. (get_exec_counts): Do not work with working sets. (read_profile_edge_counts): Do not inform as sum_max is removed. (compute_branch_probabilities): Likewise. (compute_value_histograms): Remove argument for call of get_coverage_counts. * profile.h: Do not make gcov_summary const. 2018-09-21 Martin Liska <mliska@suse.cz> * libgcov-driver.c (crc32_unsigned): Remove. (gcov_histogram_insert): Likewise. (gcov_compute_histogram): Likewise. (compute_summary): Simplify rapidly. (merge_one_data): Do not handle PROGRAM_SUMMARY tag. (merge_summary): Rapidly simplify. (dump_one_gcov): Ignore gcov_summary. (gcov_do_dump): Do not handle program summary, it's not used. * libgcov-util.c (tag_summary): Remove. (read_gcda_finalize): Fix coding style. (read_gcda_file): Initialize curr_object_summary. (compute_summary): Remove. (calculate_overlap): Remove settings of run_max. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264462 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 92a43ed commit 5662135

21 files changed

+183
-1216
lines changed

gcc/ChangeLog

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1+
2018-09-21 Martin Liska <mliska@suse.cz>
2+
3+
* auto-profile.c (autofdo_source_profile::read): Do not
4+
set sum_all.
5+
(read_profile): Do not add working sets.
6+
(read_autofdo_file): Remove sum_all.
7+
(afdo_callsite_hot_enough_for_early_inline): Remove const
8+
qualifier.
9+
* coverage.c (struct counts_entry): Remove gcov_summary.
10+
(read_counts_file): Read new GCOV_TAG_OBJECT_SUMMARY,
11+
do not support GCOV_TAG_PROGRAM_SUMMARY.
12+
(get_coverage_counts): Remove summary and expected
13+
arguments.
14+
* coverage.h (get_coverage_counts): Likewise.
15+
* doc/gcov-dump.texi: Remove -w option.
16+
* gcov-dump.c (dump_working_sets): Remove.
17+
(main): Do not support '-w' option.
18+
(print_usage): Likewise.
19+
(tag_summary): Likewise.
20+
* gcov-io.c (gcov_write_summary): Do not dump
21+
histogram.
22+
(gcov_read_summary): Likewise.
23+
(gcov_histo_index): Remove.
24+
(gcov_histogram_merge): Likewise.
25+
(compute_working_sets): Likewise.
26+
* gcov-io.h (GCOV_TAG_OBJECT_SUMMARY): Mark
27+
it not obsolete.
28+
(GCOV_TAG_PROGRAM_SUMMARY): Mark it obsolete.
29+
(GCOV_TAG_SUMMARY_LENGTH): Adjust.
30+
(GCOV_HISTOGRAM_SIZE): Remove.
31+
(GCOV_HISTOGRAM_BITVECTOR_SIZE): Likewise.
32+
(struct gcov_summary): Simplify rapidly just
33+
to runs and sum_max fields.
34+
(gcov_histo_index): Remove.
35+
(NUM_GCOV_WORKING_SETS): Likewise.
36+
(compute_working_sets): Likewise.
37+
* gcov-tool.c (print_overlap_usage_message): Remove
38+
trailing empty line.
39+
* gcov.c (read_count_file): Read GCOV_TAG_OBJECT_SUMMARY.
40+
(output_lines): Remove program related line.
41+
* ipa-profile.c (ipa_profile): Do not consider GCOV histogram.
42+
* lto-cgraph.c (output_profile_summary): Do not stream GCOV
43+
histogram.
44+
(input_profile_summary): Do not read it.
45+
(merge_profile_summaries): And do not merge it.
46+
(input_symtab): Do not call removed function.
47+
* modulo-sched.c (sms_schedule): Do not print sum_max.
48+
* params.def (HOT_BB_COUNT_FRACTION): Reincarnate param that was
49+
removed when histogram method was invented.
50+
(HOT_BB_COUNT_WS_PERMILLE): Mention that it's used only in LTO
51+
mode.
52+
* postreload-gcse.c (eliminate_partially_redundant_load): Fix
53+
GCOV coding style.
54+
* predict.c (get_hot_bb_threshold): Use HOT_BB_COUNT_FRACTION
55+
and dump selected value.
56+
* profile.c (add_working_set): Remove.
57+
(get_working_sets): Likewise.
58+
(find_working_set): Likewise.
59+
(get_exec_counts): Do not work with working sets.
60+
(read_profile_edge_counts): Do not inform as sum_max is removed.
61+
(compute_branch_probabilities): Likewise.
62+
(compute_value_histograms): Remove argument for call of
63+
get_coverage_counts.
64+
* profile.h: Do not make gcov_summary const.
65+
166
2018-09-21 Monk Chiang <sh.chiang04@gmail.com>
267

368
* config.gcc (nds32*-*-*): Set TARGET_DEFAULT_TLSDESC_TRAMPOLINE=0.

gcc/auto-profile.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,6 @@ autofdo_source_profile::read ()
867867
function_instance::function_instance_stack stack;
868868
function_instance *s = function_instance::read_function_instance (
869869
&stack, gcov_read_counter ());
870-
afdo_profile_info->sum_all += s->total_count ();
871870
map_[s->name ()] = s;
872871
}
873872
return true;
@@ -958,23 +957,6 @@ read_profile (void)
958957

959958
/* autofdo_module_profile. */
960959
fake_read_autofdo_module_profile ();
961-
962-
/* Read in the working set. */
963-
if (gcov_read_unsigned () != GCOV_TAG_AFDO_WORKING_SET)
964-
{
965-
error ("cannot read working set from %s", auto_profile_file);
966-
return;
967-
}
968-
969-
/* Skip the length of the section. */
970-
gcov_read_unsigned ();
971-
gcov_working_set_t set[128];
972-
for (unsigned i = 0; i < 128; i++)
973-
{
974-
set[i].num_counters = gcov_read_unsigned ();
975-
set[i].min_counter = gcov_read_counter ();
976-
}
977-
add_working_set (set);
978960
}
979961

980962
/* From AutoFDO profiles, find values inside STMT for that we want to measure
@@ -1685,7 +1667,6 @@ read_autofdo_file (void)
16851667
autofdo::afdo_profile_info = XNEW (gcov_summary);
16861668
autofdo::afdo_profile_info->runs = 1;
16871669
autofdo::afdo_profile_info->sum_max = 0;
1688-
autofdo::afdo_profile_info->sum_all = 0;
16891670

16901671
/* Read the profile from the profile file. */
16911672
autofdo::read_profile ();
@@ -1712,7 +1693,7 @@ afdo_callsite_hot_enough_for_early_inline (struct cgraph_edge *edge)
17121693
if (count > 0)
17131694
{
17141695
bool is_hot;
1715-
const gcov_summary *saved_profile_info = profile_info;
1696+
gcov_summary *saved_profile_info = profile_info;
17161697
/* At early inline stage, profile_info is not set yet. We need to
17171698
temporarily set it to afdo_profile_info to calculate hotness. */
17181699
profile_info = autofdo::afdo_profile_info;

gcc/coverage.c

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
4949
#include "intl.h"
5050
#include "params.h"
5151
#include "auto-profile.h"
52+
#include "profile.h"
5253

5354
#include "gcov-io.c"
5455

@@ -73,7 +74,6 @@ struct counts_entry : pointer_hash <counts_entry>
7374
unsigned lineno_checksum;
7475
unsigned cfg_checksum;
7576
gcov_type *counts;
76-
gcov_summary summary;
7777

7878
/* hash_table support. */
7979
static inline hashval_t hash (const counts_entry *);
@@ -185,8 +185,6 @@ static void
185185
read_counts_file (void)
186186
{
187187
gcov_unsigned_t fn_ident = 0;
188-
gcov_summary summary;
189-
unsigned new_summary = 1;
190188
gcov_unsigned_t tag;
191189
int is_error = 0;
192190
unsigned lineno_checksum = 0;
@@ -236,27 +234,12 @@ read_counts_file (void)
236234
}
237235
else
238236
fn_ident = lineno_checksum = cfg_checksum = 0;
239-
new_summary = 1;
240237
}
241-
else if (tag == GCOV_TAG_PROGRAM_SUMMARY)
238+
else if (tag == GCOV_TAG_OBJECT_SUMMARY)
242239
{
243-
struct gcov_summary sum;
244-
245-
if (new_summary)
246-
memset (&summary, 0, sizeof (summary));
247-
248-
gcov_read_summary (&sum);
249-
summary.runs += sum.runs;
250-
summary.sum_all += sum.sum_all;
251-
if (summary.run_max < sum.run_max)
252-
summary.run_max = sum.run_max;
253-
summary.sum_max += sum.sum_max;
254-
if (new_summary)
255-
memcpy (summary.histogram, sum.histogram,
256-
sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
257-
else
258-
gcov_histogram_merge (summary.histogram, sum.histogram);
259-
new_summary = 0;
240+
profile_info = XCNEW (gcov_summary);
241+
profile_info->runs = gcov_read_unsigned ();
242+
profile_info->sum_max = gcov_read_unsigned ();
260243
}
261244
else if (GCOV_TAG_IS_COUNTER (tag) && fn_ident)
262245
{
@@ -276,9 +259,6 @@ read_counts_file (void)
276259
entry->ctr = elt.ctr;
277260
entry->lineno_checksum = lineno_checksum;
278261
entry->cfg_checksum = cfg_checksum;
279-
if (elt.ctr == GCOV_COUNTER_ARCS)
280-
entry->summary = summary;
281-
entry->summary.num = n_counts;
282262
entry->counts = XCNEWVEC (gcov_type, n_counts);
283263
}
284264
else if (entry->lineno_checksum != lineno_checksum
@@ -292,22 +272,6 @@ read_counts_file (void)
292272
counts_hash = NULL;
293273
break;
294274
}
295-
else if (entry->summary.num != n_counts)
296-
{
297-
error ("Profile data for function %u is corrupted", fn_ident);
298-
error ("number of counters is %d instead of %d", entry->summary.num, n_counts);
299-
delete counts_hash;
300-
counts_hash = NULL;
301-
break;
302-
}
303-
else
304-
{
305-
entry->summary.runs += summary.runs;
306-
entry->summary.sum_all += summary.sum_all;
307-
if (entry->summary.run_max < summary.run_max)
308-
entry->summary.run_max = summary.run_max;
309-
entry->summary.sum_max += summary.sum_max;
310-
}
311275
for (ix = 0; ix != n_counts; ix++)
312276
entry->counts[ix] += gcov_read_counter ();
313277
}
@@ -330,9 +294,8 @@ read_counts_file (void)
330294
/* Returns the counters for a particular tag. */
331295

332296
gcov_type *
333-
get_coverage_counts (unsigned counter, unsigned expected,
334-
unsigned cfg_checksum, unsigned lineno_checksum,
335-
const gcov_summary **summary)
297+
get_coverage_counts (unsigned counter, unsigned cfg_checksum,
298+
unsigned lineno_checksum)
336299
{
337300
counts_entry *entry, elt;
338301

@@ -363,14 +326,13 @@ get_coverage_counts (unsigned counter, unsigned expected,
363326
}
364327
elt.ctr = counter;
365328
entry = counts_hash->find (&elt);
366-
if (!entry || !entry->summary.num)
329+
if (!entry)
367330
/* The function was not emitted, or is weak and not chosen in the
368331
final executable. Silently fail, because there's nothing we
369332
can do about it. */
370333
return NULL;
371334

372-
if (entry->cfg_checksum != cfg_checksum
373-
|| entry->summary.num != expected)
335+
if (entry->cfg_checksum != cfg_checksum)
374336
{
375337
static int warned = 0;
376338
bool warning_printed = false;
@@ -414,9 +376,6 @@ get_coverage_counts (unsigned counter, unsigned expected,
414376
DECL_ASSEMBLER_NAME (current_function_decl));
415377
}
416378

417-
if (summary)
418-
*summary = &entry->summary;
419-
420379
return entry->counts;
421380
}
422381

gcc/coverage.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ extern tree tree_coverage_counter_addr (unsigned /*counter*/, unsigned/*num*/);
5151

5252
/* Get all the counters for the current function. */
5353
extern gcov_type *get_coverage_counts (unsigned /*counter*/,
54-
unsigned /*expected*/,
5554
unsigned /*cfg_checksum*/,
56-
unsigned /*lineno_checksum*/,
57-
const gcov_summary **);
55+
unsigned /*lineno_checksum*/);
5856

5957
extern tree get_gcov_type (void);
6058
extern bool coverage_node_map_initialized_p (void);

gcc/doc/gcov-dump.texi

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ gcov-dump [@option{-v}|@option{--version}]
6161
[@option{-h}|@option{--help}]
6262
[@option{-l}|@option{--long}]
6363
[@option{-p}|@option{--positions}]
64-
[@option{-w}|@option{--working-sets}] @var{gcovfiles}
64+
@var{gcovfiles}
6565
@c man end
6666
@end ignore
6767

@@ -84,10 +84,6 @@ Dump positions of records.
8484
@itemx --version
8585
Display the @command{gcov-dump} version number (on the standard output),
8686
and exit without doing any further processing.
87-
88-
@item -w
89-
@itemx --working-sets
90-
Dump working set computed from summary.
9187
@end table
9288

9389
@c man end

0 commit comments

Comments
 (0)