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.
This commit is contained in:
parent
0c9687d0da
commit
85ebbabd85
4 changed files with 1098 additions and 204 deletions
|
@ -13010,9 +13010,12 @@ bigger than @option{--param ipa-modref-max-bases} and @option{--param
|
|||
ipa-modref-max-refs}.
|
||||
|
||||
@item ipa-modref-max-depth
|
||||
Specified the maximum depth of DFS walk used by modref escape analysis.
|
||||
Specifies the maximum depth of DFS walk used by modref escape analysis.
|
||||
Setting to 0 disables the analysis completely.
|
||||
|
||||
@item modref-max-escape-points
|
||||
Specifies the maximum number of escape points tracked by modref per SSA-name.
|
||||
|
||||
@item profile-func-internal-id
|
||||
A parameter to control whether to use function internal id in profile
|
||||
database lookup. If the value is 0, the compiler uses an id that
|
||||
|
|
1289
gcc/ipa-modref.c
1289
gcc/ipa-modref.c
File diff suppressed because it is too large
Load diff
|
@ -30,12 +30,12 @@ struct GTY(()) modref_summary
|
|||
modref_records *loads;
|
||||
modref_records *stores;
|
||||
auto_vec<unsigned char> GTY((skip)) arg_flags;
|
||||
bool writes_errno;
|
||||
|
||||
modref_summary ();
|
||||
~modref_summary ();
|
||||
void dump (FILE *);
|
||||
bool useful_p (int ecf_flags);
|
||||
bool writes_errno;
|
||||
bool useful_p (int ecf_flags, bool check_flags = true);
|
||||
};
|
||||
|
||||
modref_summary *get_modref_function_summary (cgraph_node *func);
|
||||
|
|
|
@ -931,6 +931,10 @@ Maximum number of tests performed by modref query.
|
|||
Common Joined UInteger Var(param_modref_max_depth) Init(256) Param Optimization
|
||||
Maximum depth of DFS walk used by modref escape analysis.
|
||||
|
||||
-param=modref-max-escape-points=
|
||||
Common Joined UInteger Var(param_modref_max_escape_points) Init(256) Param Optimization
|
||||
Maximum number of escape points tracked by modref per SSA-name
|
||||
|
||||
-param=tm-max-aggregate-size=
|
||||
Common Joined UInteger Var(param_tm_max_aggregate_size) Init(9) Param Optimization
|
||||
Size in bytes after which thread-local aggregates should be instrumented with the logging functions instead of save/restore pairs.
|
||||
|
|
Loading…
Add table
Reference in a new issue