aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-modref.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2021-10-31 23:14:29 +0100
committerJan Hubicka <hubicka@ucw.cz>2021-10-31 23:14:29 +0100
commitca84f39399fda80c770306465276ffd66d3766ed (patch)
tree6bb38a6cd317c43716c251388b7aa9b10c5302b8 /gcc/ipa-modref.c
parentd41092ec52f46d2f4b08fff8d1519e50354331b0 (diff)
downloadgcc-ca84f39399fda80c770306465276ffd66d3766ed.zip
gcc-ca84f39399fda80c770306465276ffd66d3766ed.tar.gz
gcc-ca84f39399fda80c770306465276ffd66d3766ed.tar.bz2
Improve handling of return slot in ipa-pure-const and modref.
while preparing testcase for return slot tracking I noticed that both ipa-pure-const and modref treat return slot writes as non-local which prevents detecting functions as pure or not modifying global state. Fixed by making points_to_local_or_readonly_memory_p to special case return slot. This is bit of a side case, but presently at all uses of points_to_local_or_readonly_memory_p we want to handle return slot this way. I also noticed that we handle gimple copy unnecesarily pesimistically. This does not make difference right now since we do no not track non-scalars, but I fixed it anyway. Bootstrapped/regtested x86_64-linux, comitted. gcc/ChangeLog: * ipa-fnsummary.c: Include tree-dfa.h. (points_to_local_or_readonly_memory_p): Return true on return slot writes. * ipa-modref.c (analyze_ssa_name_flags): Fix handling of copy statement. gcc/testsuite/ChangeLog: * g++.dg/ipa/modref-1.C: New test.
Diffstat (limited to 'gcc/ipa-modref.c')
-rw-r--r--gcc/ipa-modref.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 3539cb4..d866d9e 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -1841,7 +1841,7 @@ analyze_ssa_name_flags (tree name, vec<modref_lattice> &lattice, int depth,
We do not track memory locations, so assume that value
is used arbitrarily. */
if (memory_access_to (gimple_assign_rhs1 (assign), name))
- lattice[index].merge (0);
+ lattice[index].merge (deref_flags (0, false));
/* Handle *name = *exp. */
else if (memory_access_to (gimple_assign_lhs (assign), name))
lattice[index].merge_direct_store ();