summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index d52a8f42759..fa086b0a793 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1518,6 +1518,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:
@@ -1841,6 +1842,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. */