]> git.ipfire.org Git - thirdparty/gcc.git/commit
IPA tracking of EAF flags in ipa-modref.
authorJan Hubicka <jh@suse.cz>
Mon, 16 Nov 2020 18:30:45 +0000 (19:30 +0100)
committerJan Hubicka <jh@suse.cz>
Mon, 16 Nov 2020 18:30:45 +0000 (19:30 +0100)
commit85ebbabd85e03bdc3afc190aeb29250606d18322
treebb5676c1d6481fd778c453c9470920dd9934856c
parent0c9687d0daa08c33456210b87e4060d6397ff4d8
IPA tracking of EAF flags in ipa-modref.

this patch implements the IPA propagation part of EAF flags handling in
ipa-modref.  It extends the local analysis to collect lattice consisting of
flags and escape points.  SSA name escapes if it is passed directly or
indirectly to a function call.

If useful flags are found for parameter its escape list is stored into escape
summaries.  This time each call site is annotated with info on which function
parameters escape to what argument of function call.

At IPA time we then perform iterative dataflow and produce final flags.
ipa-modref is still cheaper than pure-const when running on cc1plus (about 2-3%
that is what accounts every non-trivial passs) and the dataflow converges in 1
or 2 iterations.

Local analysis does some work to avoid streaming escape points when they are
not useful to determine final flags (that is, local escape analysis determined
good enough flags). For cc1plus there are 225k calls with useful escape
summary.

* ipa-modref.c (escape_point): New type.
(modref_lattice): New type.
(escape_entry): New type.
(escape_summary): New type.
(escape_summaries_t): New type.
(escape_summaries): New static variable.
(eaf_flags_useful_p): New function.
(modref_summary::useful_p): Add new check_flags
attribute; check eaf_flags for usefulness.
(modref_summary_lto): Add arg_flags.
(modref_summary_lto::useful_p): Add new check_flags
attribute; check eaf_flags for usefulness.
(dump_modref_edge_summaries): New function.
(remove_modref_edge_summaries): New function.
(ignore_retval_p): New predicate.
(ignore_stores_p): Also ignore for const.
(remove_summary): Call remove_modref_edge_summaries.
(modref_lattice::init): New member function.
(modref_lattice::release): New member unction.
(modref_lattice::dump): New member function.
(modref_lattice::add_escape_point): New member function.
(modref_lattice::merge): Two new member functions.
(modref_lattice::merge_deref): New member functions.
(modref_lattice::merge_direct_load): New member function.
(modref_lattice::merge_direct_store): New member function.
(call_lhs_flags): Rename to ...
(merge_call_lhs_flags): ... this one; reimplement using
modreflattice.
(analyze_ssa_name_flags): Replace KNOWN_FLAGS param by LATTICE;
add IPA parametr; use modref_lattice.
(analyze_parms): New parameter IPA and SUMMARY_LTO; update for
modref_lattice; initialize escape_summary.
(analyze_function): Allocate escape_summaries; update uses of useful_p.
(modref_write_escape_summary): New function.
(modref_read_escape_summary): New function.
(modref_write): Write escape summary.
(read_section): Read escape summary.
(modref_read): Initialie escape_summaries.
(remap_arg_flags): New function.
(update_signature): Use it.
(escape_map): New structure.
(update_escape_summary_1, update_escape_summary): New functions.
(ipa_merge_modref_summary_after_inlining): Merge escape summaries.
(propagate_unknown_call): Do not remove useless summaries.
(remove_useless_summaries): Remove them here.
(modref_propagate_in_scc): Update; do not dump scc.
(modref_propagate_dump_scc): New function.
(modref_merge_call_site_flags): New function.
(modref_propagate_flags_in_scc): New function.
(pass_ipa_modref::execute): Use modref_propagate_flags_in_scc
and modref_propagate_dump_scc; delete escape_summaries.
(ipa_modref_c_finalize):  Remove escape_summaries.
* ipa-modref.h (modref_summary): Update prototype of useful_p.
* params.opt (param=modref-max-escape-points): New param.
* doc/invoke.texi (modref-max-escape-points): Document.
gcc/doc/invoke.texi
gcc/ipa-modref.c
gcc/ipa-modref.h
gcc/params.opt