diff options
author | Richard Biener <rguenther@suse.de> | 2018-08-29 14:12:25 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-08-29 14:12:25 +0000 |
commit | 6214d5c7e7470bdd5ecbeae668c2522551bfebbc (patch) | |
tree | 7abbd12de9fe52419e5e7738b933a729107ffe6e /gcc/tree-ssa-alias.c | |
parent | 66e5825973556c8db6fc2cf19179397506b0b101 (diff) | |
download | gcc-6214d5c7e7470bdd5ecbeae668c2522551bfebbc.zip gcc-6214d5c7e7470bdd5ecbeae668c2522551bfebbc.tar.gz gcc-6214d5c7e7470bdd5ecbeae668c2522551bfebbc.tar.bz2 |
tree-core.h: Document use of deprecated_flag in SSA_NAME.
2018-08-29 Richard Biener <rguenther@suse.de>
* tree-core.h: Document use of deprecated_flag in SSA_NAME.
* tree.h (SSA_NAME_POINTS_TO_READONLY_MEMORY): Define.
* tree-into-ssa.c (pass_build_ssa::execute): Initialize
function parameters SSA_NAME_POINTS_TO_READONLY_MEMORY from fnspec.
* tree-ssa-sccvn.c (const_parms, init_const_parms): Remove.
(vn_reference_lookup_3): Remove use of const_parms.
(free_rpo_vn): Do not free const_parms.
(do_rpo_vn): Do not call init_const_parms.
* tree-ssa-alias.c (refs_may_alias_p_1): Honor
SSA_NAME_POINTS_TO_READONLY_MEMORY.
(call_may_clobber_ref_p_1): Likewise.
From-SVN: r263958
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e6e21e8..6efe4c3 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1483,6 +1483,16 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) ao_ref_alias_set (ref2))) return false; + /* If the reference is based on a pointer that points to memory + that may not be written to then the other reference cannot possibly + clobber it. */ + if ((TREE_CODE (TREE_OPERAND (base2, 0)) == SSA_NAME + && SSA_NAME_POINTS_TO_READONLY_MEMORY (TREE_OPERAND (base2, 0))) + || (ind1_p + && TREE_CODE (TREE_OPERAND (base1, 0)) == SSA_NAME + && SSA_NAME_POINTS_TO_READONLY_MEMORY (TREE_OPERAND (base1, 0)))) + return false; + /* Dispatch to the pointer-vs-decl or pointer-vs-pointer disambiguators. */ if (var1_p && ind2_p) return indirect_ref_may_alias_decl_p (ref2->ref, base2, @@ -1991,6 +2001,14 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref) || !is_global_var (base))) return false; + /* If the reference is based on a pointer that points to memory + that may not be written to then the call cannot possibly clobber it. */ + if ((TREE_CODE (base) == MEM_REF + || TREE_CODE (base) == TARGET_MEM_REF) + && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME + && SSA_NAME_POINTS_TO_READONLY_MEMORY (TREE_OPERAND (base, 0))) + return false; + callee = gimple_call_fndecl (call); /* Handle those builtin functions explicitly that do not act as |