diff options
author | Martin Liska <mliska@suse.cz> | 2018-11-13 16:06:54 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-11-13 15:06:54 +0000 |
commit | 160576e1ac9bbee90af9e09e1507f64d58473358 (patch) | |
tree | 6541a5a15b3bc6f875bc04aac0025283eb9d84a6 /gcc/cfghooks.c | |
parent | e4db210dd8683bf7b2a8ea828d6ea0b18967630a (diff) | |
download | gcc-160576e1ac9bbee90af9e09e1507f64d58473358.zip gcc-160576e1ac9bbee90af9e09e1507f64d58473358.tar.gz gcc-160576e1ac9bbee90af9e09e1507f64d58473358.tar.bz2 |
Improve -fprofile-report.
2018-11-13 Martin Liska <mliska@suse.cz>
PR tree-optimization/87885
* cfghooks.c (account_profile_record): Rename
to ...
(profile_record_check_consistency): ... this.
Calculate missing num_mismatched_freq_in.
(profile_record_account_profile): New function
that calculates time and size of a function.
* cfghooks.h (struct profile_record): Remove
all tuples.
(struct cfg_hooks): Remove after_pass flag.
(account_profile_record): Rename to ...
(profile_record_check_consistency): ... this.
(profile_record_account_profile): New.
* cfgrtl.c (rtl_account_profile_record): Remove
after_pass flag.
* passes.c (check_profile_consistency): Do only
checking.
(account_profile): Calculate size and time of
function only.
(pass_manager::dump_profile_report): Reformat
output.
(execute_one_ipa_transform_pass): Call
consistency check before clean upand call account_profile
after a clean up is done.
(execute_one_pass): Call check_profile_consistency and
account_profile instead of using after_pass flag..
* tree-cfg.c (gimple_account_profile_record): Likewise.
From-SVN: r266074
Diffstat (limited to 'gcc/cfghooks.c')
-rw-r--r-- | gcc/cfghooks.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index ea106e0..824ab25 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -1425,11 +1425,10 @@ split_block_before_cond_jump (basic_block bb) /* Work-horse for passes.c:check_profile_consistency. Do book-keeping of the CFG for the profile consistency checker. - If AFTER_PASS is 0, do pre-pass accounting, or if AFTER_PASS is 1 - then do post-pass accounting. Store the counting in RECORD. */ + Store the counting in RECORD. */ void -account_profile_record (struct profile_record *record, int after_pass) +profile_record_check_consistency (profile_record *record) { basic_block bb; edge_iterator ei; @@ -1445,26 +1444,49 @@ account_profile_record (struct profile_record *record, int after_pass) sum += e->probability; if (EDGE_COUNT (bb->succs) && sum.differs_from_p (profile_probability::always ())) - record->num_mismatched_freq_out[after_pass]++; + record->num_mismatched_freq_out++; profile_count lsum = profile_count::zero (); FOR_EACH_EDGE (e, ei, bb->succs) lsum += e->count (); if (EDGE_COUNT (bb->succs) && (lsum.differs_from_p (bb->count))) - record->num_mismatched_count_out[after_pass]++; + record->num_mismatched_count_out++; } if (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) && profile_status_for_fn (cfun) != PROFILE_ABSENT) { + profile_probability sum = profile_probability::never (); profile_count lsum = profile_count::zero (); FOR_EACH_EDGE (e, ei, bb->preds) - lsum += e->count (); + { + sum += e->probability; + lsum += e->count (); + } + if (EDGE_COUNT (bb->preds) + && sum.differs_from_p (profile_probability::always ())) + record->num_mismatched_freq_in++; if (lsum.differs_from_p (bb->count)) - record->num_mismatched_count_in[after_pass]++; + record->num_mismatched_count_in++; } if (bb == ENTRY_BLOCK_PTR_FOR_FN (cfun) || bb == EXIT_BLOCK_PTR_FOR_FN (cfun)) continue; gcc_assert (cfg_hooks->account_profile_record); - cfg_hooks->account_profile_record (bb, after_pass, record); + cfg_hooks->account_profile_record (bb, record); + } +} + +/* Work-horse for passes.c:acount_profile. + Do book-keeping of the CFG for the profile accounting. + Store the counting in RECORD. */ + +void +profile_record_account_profile (profile_record *record) +{ + basic_block bb; + + FOR_ALL_BB_FN (bb, cfun) + { + gcc_assert (cfg_hooks->account_profile_record); + cfg_hooks->account_profile_record (bb, record); } } |