aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-01-14 15:02:20 +0000
committerRichard Guenther <rguenther@suse.de>2011-01-14 15:02:20 +0000
commitf9f31f7c9b137fed2e85417ee178ef1231d2e2d6 (patch)
treee8806b70dd48d5f2e48f1df1922bb15787ffe2ba /gcc/tree-ssa-alias.c
parenta5c53294c697fc1925ae82a40d7dca16f44fbdd5 (diff)
2011-01-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47179 * target.def (ref_may_alias_errno): New target hook. * targhooks.h (default_ref_may_alias_errno): Declare. * targhooks.c: Include tree-ssa-alias.h and tree-flow.h. (default_ref_may_alias_errno): New function. * target.h (struct ao_ref_s): Declare. * tree-ssa-alias.c: Include target.h. (call_may_clobber_ref_p_1): Use the ref_may_alias_errno target hook. * Makefile.in (tree-ssa-alias.o): Adjust dependencies. (targhooks.o): Likewise. * doc/tm.texi.in (TARGET_REF_MAY_ALIAS_ERRNO): Document. * doc/tm.texi (TARGET_REF_MAY_ALIAS_ERRNO): Copy documentation. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@168788 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index d990a0227e0..3f6fec1574a 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "tm_p.h"
+#include "target.h"
#include "basic-block.h"
#include "timevar.h"
#include "ggc.h"
@@ -1417,24 +1418,10 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
being the definition point for the pointer. */
case BUILT_IN_MALLOC:
case BUILT_IN_CALLOC:
- /* Unix98 specifies that errno is set on allocation failure.
- Until we properly can track the errno location assume it
- is not a local decl but external or anonymous storage in
- a different translation unit. Also assume it is of
- type int as required by the standard. */
+ /* Unix98 specifies that errno is set on allocation failure. */
if (flag_errno_math
- && TREE_TYPE (base) == integer_type_node)
- {
- struct ptr_info_def *pi;
- if (DECL_P (base)
- && !TREE_STATIC (base))
- return true;
- else if ((INDIRECT_REF_P (base)
- || TREE_CODE (base) == MEM_REF)
- && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME
- && (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0))))
- return pi->pt.anything || pi->pt.nonlocal;
- }
+ && targetm.ref_may_alias_errno (ref))
+ return true;
return false;
/* Freeing memory kills the pointed-to memory. More importantly
the call has to serve as a barrier for moving loads and stores