]> git.ipfire.org Git - thirdparty/gcc.git/commit
Improve -fprofile-report
authorJan Hubicka <jh@suse.cz>
Sun, 28 Nov 2021 18:25:33 +0000 (19:25 +0100)
committerJan Hubicka <jh@suse.cz>
Sun, 28 Nov 2021 18:25:33 +0000 (19:25 +0100)
commitd1471457fcda26cd24e0053b82f8eed35ddb8727
treeccb130300fe101af002265cb1efebb51938b17a1
parent7393fa8b1d21eeeb37e59ff8efaebf178fd891e5
Improve -fprofile-report

Profile-report was never properly updated after switch to new profile
representation.  This patch fixes the way profile mismatches are calculated:
we used to collect separately count and freq mismatches, while now we have
only counts & probabilities.  So we verify
 - in count: that total count of incomming edges is close to acutal count of
   the BB
 - out prob: that total sum of outgoing edge edge probabilities is close
   to 1 (except for BB containing noreturn calls or EH).

Moreover I added dumping of absolute data which is useful to plot them: with
Martin Liska we plan to setup regular testing so we keep optimizers profie
updates bit under control.

Finally I added both static and dynamic stats about mismatches - static one is
simply number of inconsistencies in the cfg while dynamic is scaled by the
profile - I think in order to keep eye on optimizers the first number is quite
relevant. WHile when tracking why code quality regressed the second number
matters more.

2021-11-28  Jan Hubicka  <hubicka@ucw.cz>

* cfghooks.c: Include sreal.h, profile.h.
(profile_record_check_consistency): Fix checking of count counsistency;
record also dynamic mismatches.
* cfgrtl.c (rtl_account_profile_record): Similarly.
* tree-cfg.c (gimple_account_profile_record): Likewise.
* cfghooks.h (struct profile_record): Remove num_mismatched_freq_in,
num_mismatched_freq_out, turn time to double, add
dyn_mismatched_prob_out, dyn_mismatched_count_in,
num_mismatched_prob_out; remove num_mismatched_count_out.
* passes.c (account_profile_1): New function.
(account_profile_in_list): New function.
(pass_manager::dump_profile_report): Rewrite.
(execute_one_ipa_transform_pass): Check profile consistency after
running all passes.
(execute_all_ipa_transforms): Remove cfun test; record all transform
methods.
(execute_one_pass): Fix collecting of profile stats.
gcc/cfghooks.c
gcc/cfghooks.h
gcc/cfgrtl.c
gcc/passes.c
gcc/tree-cfg.c