Fix inter-procedural EAF flags propagation with respect to !binds_to_current_def_p
authorJan Hubicka <hubicka@ucw.cz>
Sun, 7 Nov 2021 17:20:45 +0000 (18:20 +0100)
committerJan Hubicka <hubicka@ucw.cz>
Sun, 7 Nov 2021 17:20:45 +0000 (18:20 +0100)
commitf6f704fd104b79fc88914978772737cd05423059
tree39f3fbf1a4711497619b6406f66320e7d76b839c
parenta28cfe49203705ff9675b79fce88d6087b11d098
Fix inter-procedural EAF flags propagation with respect to !binds_to_current_def_p

While proofreading the code for handling EAF flags of !binds_to_current_def_p I
noticed that the interprocedural dataflow actually ignores the flag possibly
introducing wrong code on quite complex interposable functions in non-trivial
recursion cycles (or at ltrans partition boundary).

This patch unifies the flags changes to single place (remove_useless_eaf_flags)
and does extend modref_merge_call_site_flags to do the right thing.

lto-bootstrapped/regtested x86_64-linux.  Plan to commit it today after bit
more testing (firefox/clang build).

gcc/ChangeLog:

* gimple.c (gimple_call_arg_flags): Use interposable_eaf_flags.
(gimple_call_retslot_flags): Likewise.
(gimple_call_static_chain_flags): Likewise.
* ipa-modref.c (remove_useless_eaf_flags): Do not remove everything for
NOVOPS.
(modref_summary::useful_p): Likewise.
(modref_summary_lto::useful_p): Likewise.
(analyze_parms): Do not give up on NOVOPS.
(analyze_function): When dumping report chnages in EAF flags
between IPA and local pass.
(modref_merge_call_site_flags): Compute implicit eaf flags
based on callee ecf_flags and fnspec; if the function does not
bind to current defs use interposable_eaf_flags.
(modref_propagate_flags_in_scc): Update.
* ipa-modref.h (interposable_eaf_flags): New function.
gcc/gimple.c
gcc/ipa-modref.c
gcc/ipa-modref.h