diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-28 13:28:32 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-28 13:28:32 +0000 |
commit | 119147d12d323bafa652a1dff5962c9a1b800bd7 (patch) | |
tree | c6cbdb47b276ee46a1baf832ef5152d54c71249e /gcc/tree-ssa-alias.c | |
parent | 3f59ba3a6d769e2b37bb7cb50c84fc4533ce1297 (diff) | |
download | gcc-119147d12d323bafa652a1dff5962c9a1b800bd7.tar.gz |
2009-10-28 Richard Guenther <rguenther@suse.de>
PR middle-end/41855
* tree-ssa-alias.c (refs_may_alias_p_1): Deal with CONST_DECLs
(ref_maybe_used_by_call_p_1): Fix bcopy handling.
(call_may_clobber_ref_p_1): Likewise.
* tree-ssa-structalias.c (find_func_aliases): Likewise.
* alias.c (nonoverlapping_memrefs_p): Deal with CONST_DECLs.
* gfortran.dg/lto/20091028-1_0.f90: New testcase.
* gfortran.dg/lto/20091028-1_1.c: Likewise.
* gfortran.dg/lto/20091028-2_0.f90: Likewise.
* gfortran.dg/lto/20091028-2_1.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153655 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index fbd047085da..4c052be418f 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -776,12 +776,14 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) || SSA_VAR_P (ref1->ref) || handled_component_p (ref1->ref) || INDIRECT_REF_P (ref1->ref) - || TREE_CODE (ref1->ref) == TARGET_MEM_REF) + || TREE_CODE (ref1->ref) == TARGET_MEM_REF + || TREE_CODE (ref1->ref) == CONST_DECL) && (!ref2->ref || SSA_VAR_P (ref2->ref) || handled_component_p (ref2->ref) || INDIRECT_REF_P (ref2->ref) - || TREE_CODE (ref2->ref) == TARGET_MEM_REF)); + || TREE_CODE (ref2->ref) == TARGET_MEM_REF + || TREE_CODE (ref2->ref) == CONST_DECL)); /* Decompose the references into their base objects and the access. */ base1 = ao_ref_base (ref1); @@ -798,6 +800,8 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) which is seen as a struct copy. */ if (TREE_CODE (base1) == SSA_NAME || TREE_CODE (base2) == SSA_NAME + || TREE_CODE (base1) == CONST_DECL + || TREE_CODE (base2) == CONST_DECL || is_gimple_min_invariant (base1) || is_gimple_min_invariant (base2)) return false; @@ -934,7 +938,6 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) their first argument. */ case BUILT_IN_STRCPY: case BUILT_IN_STRNCPY: - case BUILT_IN_BCOPY: case BUILT_IN_MEMCPY: case BUILT_IN_MEMMOVE: case BUILT_IN_MEMPCPY: @@ -952,6 +955,15 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) size); return refs_may_alias_p_1 (&dref, ref, false); } + case BUILT_IN_BCOPY: + { + ao_ref dref; + tree size = gimple_call_arg (call, 2); + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 0), + size); + return refs_may_alias_p_1 (&dref, ref, false); + } /* The following builtins do not read from memory. */ case BUILT_IN_FREE: case BUILT_IN_MEMSET: @@ -1151,7 +1163,6 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) their first argument. */ case BUILT_IN_STRCPY: case BUILT_IN_STRNCPY: - case BUILT_IN_BCOPY: case BUILT_IN_MEMCPY: case BUILT_IN_MEMMOVE: case BUILT_IN_MEMPCPY: @@ -1170,6 +1181,15 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) size); return refs_may_alias_p_1 (&dref, ref, false); } + case BUILT_IN_BCOPY: + { + ao_ref dref; + tree size = gimple_call_arg (call, 2); + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 1), + size); + return refs_may_alias_p_1 (&dref, ref, false); + } /* Freeing memory kills the pointed-to memory. More importantly the call has to serve as a barrier for moving loads and stores across it. */ |