aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2021-11-12 23:55:50 +0100
committerJan Hubicka <jh@suse.cz>2021-11-12 23:55:50 +0100
commit4d2d5565a0953eaa829d10006baf007cf33bab89 (patch)
treea6c78a8840e4805de98cab1ecd70952ac692252d /gcc/tree-ssa-structalias.c
parent264f061997c0a5349cdce6d73f0dc167ac7fc8f4 (diff)
downloadgcc-4d2d5565a0953eaa829d10006baf007cf33bab89.zip
gcc-4d2d5565a0953eaa829d10006baf007cf33bab89.tar.gz
gcc-4d2d5565a0953eaa829d10006baf007cf33bab89.tar.bz2
Fix wrong code with pure functions
I introduced bug into find_func_aliases_for_call in handling pure functions. Instead of reading global memory pure functions are believed to write global memory. This results in misoptimization of the testcase at -O1. The change to pta-callused.c updates the template for new behaviour of the constraint generation. We copy nonlocal memory to calluse which is correct but also not strictly necessary because later we take care to add nonlocal_p flag manually. gcc/ChangeLog: PR tree-optimization/103209 * tree-ssa-structalias.c (find_func_aliases_for_call): Fix use of handle_rhs_call gcc/testsuite/ChangeLog: PR tree-optimization/103209 * gcc.dg/tree-ssa/pta-callused.c: Update template. * gcc.c-torture/execute/pr103209.c: New test.
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 153ddf5..34fd47f 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4996,7 +4996,7 @@ find_func_aliases_for_call (struct function *fn, gcall *t)
reachable from their arguments, but they are not an escape
point for reachable memory of their arguments. */
else if (flags & (ECF_PURE|ECF_LOOPING_CONST_OR_PURE))
- handle_rhs_call (t, &rhsc, implicit_pure_eaf_flags, true, false);
+ handle_rhs_call (t, &rhsc, implicit_pure_eaf_flags, false, true);
/* If the call is to a replaceable operator delete and results
from a delete expression as opposed to a direct call to
such operator, then the effects for PTA (in particular