diff options
author | Richard Biener <rguenther@suse.de> | 2014-02-07 09:33:23 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-02-07 09:33:23 +0000 |
commit | 32cab212f2dd2f17c80c2894e6d9095912db02cc (patch) | |
tree | 629d882ca041bd4388e6a8674102352639e71fa5 /gcc/tree-ssa-alias.c | |
parent | 1c51d6883ae957c26cbd2a71c09291e34a21f73c (diff) | |
download | gcc-32cab212f2dd2f17c80c2894e6d9095912db02cc.zip gcc-32cab212f2dd2f17c80c2894e6d9095912db02cc.tar.gz gcc-32cab212f2dd2f17c80c2894e6d9095912db02cc.tar.bz2 |
re PR middle-end/60092 (posix_memalign not recognized to derive alias and alignment info)
2014-02-07 Richard Biener <rguenther@suse.de>
PR middle-end/60092
* builtin-types.def (BT_FN_INT_PTRPTR_SIZE_SIZE): Add.
* builtins.def (BUILT_IN_POSIX_MEMALIGN): Likewise.
* tree-ssa-structalias.c (find_func_aliases_for_builtin_call):
Handle BUILT_IN_POSIX_MEMALIGN.
(find_func_clobbers): Likewise.
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise.
(call_may_clobber_ref_p_1): Likewise.
* gcc.dg/tree-ssa/alias-30.c: New testcase.
* gcc.dg/tree-ssa/alias-31.c: Likewise.
From-SVN: r207595
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 2c3583b..e706275 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1515,6 +1515,7 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) /* The following builtins do not read from memory. */ case BUILT_IN_FREE: case BUILT_IN_MALLOC: + case BUILT_IN_POSIX_MEMALIGN: case BUILT_IN_CALLOC: case BUILT_IN_ALLOCA: case BUILT_IN_ALLOCA_WITH_ALIGN: @@ -1838,6 +1839,18 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) case BUILT_IN_ALLOCA_WITH_ALIGN: case BUILT_IN_ASSUME_ALIGNED: return false; + /* But posix_memalign stores a pointer into the memory pointed to + by its first argument. */ + case BUILT_IN_POSIX_MEMALIGN: + { + tree ptrptr = gimple_call_arg (call, 0); + ao_ref dref; + ao_ref_init_from_ptr_and_size (&dref, ptrptr, + TYPE_SIZE_UNIT (ptr_type_node)); + return (refs_may_alias_p_1 (&dref, ref, false) + || (flag_errno_math + && targetm.ref_may_alias_errno (ref))); + } /* Freeing memory kills the pointed-to memory. More importantly the call has to serve as a barrier for moving loads and stores across it. */ |