diff options
author | Martin Jambor <mjambor@suse.cz> | 2020-10-02 18:41:35 +0200 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2020-10-02 18:41:35 +0200 |
commit | 67ce9099bc953f22e6c9e9ee4c64329fdb08286a (patch) | |
tree | f56ef1af5db5e1495e6ade60648c228e0efbafcb /gcc/cp/class.c | |
parent | 1e7fdc02cba43e646fb2389e3c79e7c4e5ff772e (diff) | |
download | gcc-67ce9099bc953f22e6c9e9ee4c64329fdb08286a.zip gcc-67ce9099bc953f22e6c9e9ee4c64329fdb08286a.tar.gz gcc-67ce9099bc953f22e6c9e9ee4c64329fdb08286a.tar.bz2 |
ipa: Multiple predicates for loop properties, with frequencies
This patch enhances the ability of IPA to reason under what conditions
loops in a function have known iteration counts or strides because it
replaces single predicates which currently hold conjunction of
predicates for all loops with vectors capable of holding multiple
predicates, each with a cumulative frequency of loops with the
property.
This second property is then used by IPA-CP to much more aggressively
boost its heuristic score for cloning opportunities which make
iteration counts or strides of frequent loops compile time constant.
gcc/ChangeLog:
2020-09-03 Martin Jambor <mjambor@suse.cz>
* ipa-fnsummary.h (ipa_freqcounting_predicate): New type.
(ipa_fn_summary): Change the type of loop_iterations and loop_strides
to vectors of ipa_freqcounting_predicate.
(ipa_fn_summary::ipa_fn_summary): Construct the new vectors.
(ipa_call_estimates): New fields loops_with_known_iterations and
loops_with_known_strides.
* ipa-cp.c (hint_time_bonus): Multiply param_ipa_cp_loop_hint_bonus
with the expected frequencies of loops with known iteration count or
stride.
* ipa-fnsummary.c (add_freqcounting_predicate): New function.
(ipa_fn_summary::~ipa_fn_summary): Release the new vectors instead of
just two predicates.
(remap_hint_predicate_after_duplication): Replace with function
remap_freqcounting_preds_after_dup.
(ipa_fn_summary_t::duplicate): Use it or duplicate new vectors.
(ipa_dump_fn_summary): Dump the new vectors.
(analyze_function_body): Compute the loop property vectors.
(ipa_call_context::estimate_size_and_time): Calculate also
loops_with_known_iterations and loops_with_known_strides. Adjusted
dumping accordinly.
(remap_hint_predicate): Replace with function
remap_freqcounting_predicate.
(ipa_merge_fn_summary_after_inlining): Use it.
(inline_read_section): Stream loopcounting vectors instead of two
simple predicates.
(ipa_fn_summary_write): Likewise.
* params.opt (ipa-max-loop-predicates): New parameter.
* doc/invoke.texi (ipa-max-loop-predicates): Document new param.
gcc/testsuite/ChangeLog:
2020-09-03 Martin Jambor <mjambor@suse.cz>
* gcc.dg/ipa/ipcp-loophint-1.c: New test.
Diffstat (limited to 'gcc/cp/class.c')
0 files changed, 0 insertions, 0 deletions