diff options
author | Jan Hubicka <jh@suse.cz> | 2021-11-28 19:25:33 +0100 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2021-11-28 19:25:33 +0100 |
commit | d1471457fcda26cd24e0053b82f8eed35ddb8727 (patch) | |
tree | ccb130300fe101af002265cb1efebb51938b17a1 /gcc/cfghooks.h | |
parent | 7393fa8b1d21eeeb37e59ff8efaebf178fd891e5 (diff) | |
download | gcc-d1471457fcda26cd24e0053b82f8eed35ddb8727.zip gcc-d1471457fcda26cd24e0053b82f8eed35ddb8727.tar.gz gcc-d1471457fcda26cd24e0053b82f8eed35ddb8727.tar.bz2 |
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.
Diffstat (limited to 'gcc/cfghooks.h')
-rw-r--r-- | gcc/cfghooks.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h index 6df651f..684e631 100644 --- a/gcc/cfghooks.h +++ b/gcc/cfghooks.h @@ -36,22 +36,25 @@ along with GCC; see the file COPYING3. If not see and one CFG hook per CFG mode. */ struct profile_record { - /* The number of basic blocks where sum(freq) of the block's predecessors - doesn't match reasonably well with the incoming frequency. */ - int num_mismatched_freq_in; - /* Likewise for a basic block's successors. */ - int num_mismatched_freq_out; + /* A weighted cost of the run-time of the function body. */ + double time; + /* Frequency of execution of basic blocks where sum(prob) of the block's + predecessors doesn't match reasonably probability 1. */ + double dyn_mismatched_prob_out; + /* Frequency of execution basic blocks where sum(count) of the block's + predecessors doesn't match reasonably well with the incoming frequency. */ + double dyn_mismatched_count_in; + /* The number of basic blocks where sum(prob) of the block's predecessors + doesn't match reasonably probability 1. */ + int num_mismatched_prob_out; /* The number of basic blocks where sum(count) of the block's predecessors doesn't match reasonably well with the incoming frequency. */ int num_mismatched_count_in; - /* Likewise for a basic block's successors. */ - int num_mismatched_count_out; - /* A weighted cost of the run-time of the function body. */ - gcov_type_unsigned time; /* A weighted cost of the size of the function body. */ int size; /* True iff this pass actually was run. */ bool run; + bool fdo; }; typedef int_hash <unsigned short, 0> dependence_hash; |