diff options
author | Jan Hubicka <jh@suse.cz> | 2021-11-15 00:10:06 +0100 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2021-11-15 00:10:06 +0100 |
commit | a34edf9a3e907de25929b1103a4b37af858c7917 (patch) | |
tree | 09a613250d0d99564a39e7b334b878ecceda2525 /gcc/tree-ssa-alias.c | |
parent | 3057f1ab737582a9fb37a3fb967ed8bf3659f2f4 (diff) | |
download | gcc-a34edf9a3e907de25929b1103a4b37af858c7917.zip gcc-a34edf9a3e907de25929b1103a4b37af858c7917.tar.gz gcc-a34edf9a3e907de25929b1103a4b37af858c7917.tar.bz2 |
Track nondeterminism and interposable calls in ipa-modref
Adds tracking of two new flags in ipa-modref: nondeterministic and
calls_interposable. First is set when function does something that is not
guaranteed to be the same if run again (volatile memory access, volatile asm or
external function call). Second is set if function calls something that
does not bind to current def.
nondeterministic enables ipa-modref to discover looping pure/const functions
and it now discovers 138 of them during cc1plus link (which about doubles
number of such functions detected late). We however can do more
1) We can extend FRE to eliminate redundant calls.
I filled a PR103168 for that.
A common case are inline functions that are not autodetected as ECF_CONST
just becuase they do not bind to local def and can be easily handled.
More tricky is to use modref summary to check what memory locations are
read.
2) DSE can eliminate redundant stores
The calls_interposable flag currently also improves tree-ssa-structalias
on functions that are not binds_to_current_def since reads_global_memory
is now not cleared by interposable functions.
gcc/ChangeLog:
* ipa-modref.h (struct modref_summary): Add nondeterministic
and calls_interposable flags.
* ipa-modref.c (modref_summary::modref_summary): Initialize new flags.
(modref_summary::useful_p): Check new flags.
(struct modref_summary_lto): Add nondeterministic and
calls_interposable flags.
(modref_summary_lto::modref_summary_lto): Initialize new flags.
(modref_summary_lto::useful_p): Check new flags.
(modref_summary::dump): Dump new flags.
(modref_summary_lto::dump): Dump new flags.
(ignore_nondeterminism_p): New function.
(merge_call_side_effects): Merge new flags.
(process_fnspec): Likewise.
(analyze_load): Volatile access is nondeterministic.
(analyze_store): Liekwise.
(analyze_stmt): Volatile ASM is nondeterministic.
(analyze_function): Clear new flags.
(modref_summaries::duplicate): Duplicate new flags.
(modref_summaries_lto::duplicate): Duplicate new flags.
(modref_write): Stream new flags.
(read_section): Stream new flags.
(propagate_unknown_call): Update new flags.
(modref_propagate_in_scc): Propagate new flags.
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Check
calls_interposable.
* tree-ssa-structalias.c (determine_global_memory_access):
Likewise.
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 093d65c..02bbc87 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -2765,7 +2765,7 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref, bool tbaa_p) if (node && node->binds_to_current_def_p ()) { modref_summary *summary = get_modref_function_summary (node); - if (summary) + if (summary && !summary->calls_interposable) { if (!modref_may_conflict (call, summary->loads, ref, tbaa_p)) { |