Introduce EAF_NOREAD and cleanup EAF_UNUSED + ipa-modref
this patch add EAF_NOREAD (as disucssed on IRC already) and fixes meaning
of EAF_UNUSED to be really unused and not "does not escape, is not clobbered,
read or returned" since we have separate flags for each of the properties
now.
Since number of flags has grown I refactored the code a bit to avoid
repeated uses of complex flag combinations and also simplified the logic of
merging.
Merging is bit tricky since we have flags that implies other flags
(like NOESCAPE implies NODIRECTESCAPE) but code that sets only NOESCAPE.
Perhaps it would make sense to update fnspecs to always set flag along with
all the implications, but for now I am handlingit in merge.
I made only trivial update to tree-ssa-structalias to handle EAF_NORETURN in
normal function handling, but not in pure functions. The problem is that the
way constraints are generated for pure functions makes this difficult.
I think logical step is to track whether function reads/stores global memory
and rewrite the constraint generation so we can handle normal, pure and const
in unified manner.
Bootstrapped/regtested x86_64-linux, plan to commit it after furhter testing.
The patch improves alias oracle stats for cc1plus somewhat.
From:
Alias oracle query stats:
refs_may_alias_p:
72380497 disambiguations,
82649832 queries
ref_maybe_used_by_call_p: 495184 disambiguations,
73366950 queries
call_may_clobber_ref_p: 259312 disambiguations, 263253 queries
nonoverlapping_component_refs_p: 0 disambiguations, 38006 queries
nonoverlapping_refs_since_match_p: 21157 disambiguations, 65698 must overlaps, 87756 queries
aliasing_component_refs_p: 63141 disambiguations, 2164695 queries
TBAA oracle:
25975753 disambiguations
61449632 queries
12138220 are in alias set 0
11316663 queries asked about the same object
144 queries asked about the same alias set
0 access volatile
10472885 are dependent in the DAG
1545967 are aritificially in conflict with void *
Modref stats:
modref use: 23857 disambiguations, 754515 queries
modref clobber: 1392162 disambiguations,
17753512 queries
3450241 tbaa queries (0.194341 per modref query)
534816 base compares (0.030125 per modref query)
PTA query stats:
pt_solution_includes:
12394915 disambiguations,
20235925 queries
pt_solutions_intersect: 1365299 disambiguations,
14638068 queries
To:
Alias oracle query stats:
refs_may_alias_p:
72629640 disambiguations,
82903333 queries
ref_maybe_used_by_call_p: 502474 disambiguations,
73612186 queries
call_may_clobber_ref_p: 261806 disambiguations, 265659 queries
nonoverlapping_component_refs_p: 0 disambiguations, 38007 queries
nonoverlapping_refs_since_match_p: 21139 disambiguations, 65772 must overlaps, 87816 queries
aliasing_component_refs_p: 63144 disambiguations, 2164330 queries
TBAA oracle:
26059018 disambiguations
61571714 queries
12158033 are in alias set 0
11326115 queries asked about the same object
144 queries asked about the same alias set
0 access volatile
10484493 are dependent in the DAG
1543911 are aritificially in conflict with void *
Modref stats:
modref use: 24008 disambiguations, 712712 queries
modref clobber: 1395917 disambiguations,
17163694 queries
3465657 tbaa queries (0.201918 per modref query)
537591 base compares (0.031321 per modref query)
PTA query stats:
pt_solution_includes:
12468934 disambiguations,
20295402 queries
pt_solutions_intersect: 1391917 disambiguations,
14665265 queries
I think it is mostly due to better heandling of EAF_NODIRECTESCAPE.
Honza
gcc/ChangeLog:
2021-08-12 Jan Hubicka <hubicka@ucw.cz>
* ipa-modref.c (dump_eaf_flags): Dump EAF_NOREAD.
(implicit_const_eaf_flags, implicit_pure_eaf_flags,
ignore_stores_eaf_flags): New constants.
(remove_useless_eaf_flags): New function.
(eaf_flags_useful_p): Use it.
(deref_flags): Add EAF_NOT_RETURNED if flag is unused;
handle EAF_NOREAD.
(modref_lattice::init): Add EAF_NOREAD.
(modref_lattice::add_escape_point): Do not reacord escape point if
result is unused.
(modref_lattice::merge): EAF_NOESCAPE implies EAF_NODIRECTESCAPE;
use remove_useless_eaf_flags.
(modref_lattice::merge_deref): Use ignore_stores_eaf_flags.
(modref_lattice::merge_direct_load): Add EAF_NOREAD
(analyze_ssa_name_flags): Fix handling EAF_NOT_RETURNED
(analyze_parms): Use remove_useless_eaf_flags.
(ipa_merge_modref_summary_after_inlining): Use ignore_stores_eaf_flags.
(modref_merge_call_site_flags): Add caller and ecf_flags parameter;
use remove_useless_eaf_flags.
(modref_propagate_flags_in_scc): Update.
* ipa-modref.h: Turn eaf_flags_t back to char.
* tree-core.h (EAF_NOT_RETURNED): Fix.
(EAF_NOREAD): New constant
* tree-ssa-alias.c: (ref_maybe_used_by_call_p_1): Check for
EAF_NOREAD.
* tree-ssa-structalias.c (handle_rhs_call): Handle new flags.
(handle_pure_call): Likewise.
gcc/testsuite/ChangeLog:
2021-08-12 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/tree-ssa/modref-6.c: Update.