diff options
author | Jan Hubicka <jh@suse.cz> | 2023-07-14 17:14:15 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2023-07-14 17:14:15 +0200 |
commit | aa6741ef2e0c312af51825f6411380fe160a8222 (patch) | |
tree | 69463ab8f0068daa77098600efe986020976aa3a /gcc/tree-pass.h | |
parent | 0d2673e995f0dd69f406a34d2e87d2a25cf3c285 (diff) | |
download | gcc-aa6741ef2e0c312af51825f6411380fe160a8222.zip gcc-aa6741ef2e0c312af51825f6411380fe160a8222.tar.gz gcc-aa6741ef2e0c312af51825f6411380fe160a8222.tar.bz2 |
Turn TODO_rebuild_frequencies to a pass
Currently we rebiuild profile_counts from profile_probability after inlining,
because there is a chance that producing large loop nests may get unrealistically
large profile_count values. This is much less of concern when we switched to
new profile_count representation while back.
This propagation can also compensate for profile inconsistencies caused by
optimization passes. Since inliner is followed by basic cleanup passes that
does not use profile, we get more realistic profile by delaying the recomputation
after basic optimizations exposed by inlininig are finished.
This does not fit into TODO machinery, so I turn rebuilding into stand alone
pass and schedule it before first consumer of profile in the optimization
queue.
I also added logic that avoids repropagating when CFG is good and not too close
to overflow. Propagating visits very basic block loop_depth times, so it is
not linear and avoiding it may help a bit.
On tramp3d we get 14 functions repropagated and 916 are OK. The repropagated
functions are RB tree ones where we produce crazy loop nests by recurisve inlining.
This is something to fix independently.
gcc/ChangeLog:
* passes.cc (execute_function_todo): Remove
TODO_rebuild_frequencies
* passes.def: Add rebuild_frequencies pass.
* predict.cc (estimate_bb_frequencies): Drop
force parameter.
(tree_estimate_probability): Update call of
estimate_bb_frequencies.
(rebuild_frequencies): Turn into a pass; verify CFG profile consistency
first and do not rebuild if not necessary.
(class pass_rebuild_frequencies): New.
(make_pass_rebuild_frequencies): New.
* profile-count.h: Add profile_count::very_large_p.
* tree-inline.cc (optimize_inline_calls): Do not return
TODO_rebuild_frequencies
* tree-pass.h (TODO_rebuild_frequencies): Remove.
(make_pass_rebuild_frequencies): Declare.
Diffstat (limited to 'gcc/tree-pass.h')
-rw-r--r-- | gcc/tree-pass.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 6cdaed7..57865cd 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -239,7 +239,6 @@ protected: #define TODO_verify_il (1 << 6) #define TODO_dump_symtab (1 << 7) #define TODO_remove_functions (1 << 8) -#define TODO_rebuild_frequencies (1 << 9) /* To-do flags for calls to update_ssa. */ @@ -418,6 +417,7 @@ extern gimple_opt_pass *make_pass_pre (gcc::context *ctxt); extern unsigned int tail_merge_optimize (bool); extern gimple_opt_pass *make_pass_profile (gcc::context *ctxt); extern gimple_opt_pass *make_pass_strip_predict_hints (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_rebuild_frequencies (gcc::context *ctxt); extern gimple_opt_pass *make_pass_lower_complex_O0 (gcc::context *ctxt); extern gimple_opt_pass *make_pass_lower_complex (gcc::context *ctxt); extern gimple_opt_pass *make_pass_lower_switch (gcc::context *ctxt); |