aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-modref.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2021-08-22 20:57:19 +0200
committerJan Hubicka <jh@suse.cz>2021-08-22 20:57:19 +0200
commit9b08f7764cecd16cba84944f2a8b67a7f73a7ce7 (patch)
tree641724b6b8b6b377cf84f6d977e014fbdbf98b13 /gcc/ipa-modref.c
parenta5416bf369419428fb139c432bcd88f6f8ee4910 (diff)
downloadgcc-9b08f7764cecd16cba84944f2a8b67a7f73a7ce7.zip
gcc-9b08f7764cecd16cba84944f2a8b67a7f73a7ce7.tar.gz
gcc-9b08f7764cecd16cba84944f2a8b67a7f73a7ce7.tar.bz2
Clear EAF_NOCLOBBER for indirect calls
gcc/ChangeLog: 2021-08-22 Jan Hubicka <hubicka@ucw.cz> Martin Liska <mliska@suse.cz> PR middle-end/101949 * ipa-modref.c (analyze_ssa_name_flags): Indirect call implies ~EAF_NOCLOBBER. gcc/testsuite/ChangeLog: 2021-08-22 Jan Hubicka <hubicka@ucw.cz> Martin Liska <mliska@suse.cz> * gcc.dg/lto/pr101949_0.c: New test. * gcc.dg/lto/pr101949_1.c: New test.
Diffstat (limited to 'gcc/ipa-modref.c')
-rw-r--r--gcc/ipa-modref.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index fafd804..5491538 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -1700,6 +1700,15 @@ analyze_ssa_name_flags (tree name, vec<modref_lattice> &lattice, int depth,
else if (gcall *call = dyn_cast <gcall *> (use_stmt))
{
tree callee = gimple_call_fndecl (call);
+
+ /* IPA PTA internally it treats calling a function as "writing" to
+ the argument space of all functions the function pointer points to
+ (PR101949). We can not drop EAF_NOCLOBBER only when ipa-pta
+ is on since that would allow propagation of this from -fno-ipa-pta
+ to -fipa-pta functions. */
+ if (gimple_call_fn (use_stmt) == name)
+ lattice[index].merge (~EAF_NOCLOBBER);
+
/* Return slot optimization would require bit of propagation;
give up for now. */
if (gimple_call_return_slot_opt_p (call)