diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-18 15:50:55 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-18 15:50:55 +0000 |
commit | 73eb0a09e37026a6fd92348b38ebd479992bb1a9 (patch) | |
tree | d38fdc7f5a515bad12f63a6dce21d0eba6f42eaa /gcc/emit-rtl.c | |
parent | c54f1e1f16b74210967e2b4d6433236a5d1f8ddd (diff) | |
download | gcc-73eb0a09e37026a6fd92348b38ebd479992bb1a9.tar.gz |
2011-01-18 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/47216
* emit-rtl.c: Include tree-flow.h.
(set_mem_attributes_minus_bitpos): Use tree_could_trap_p instead
of replicating it with different semantics.
* Makefile.in (emit-rtl.o): Adjust.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168951 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 0839d0bff78..4ff5d4edc8a 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see #include "df.h" #include "params.h" #include "target.h" +#include "tree-flow.h" struct target_rtl default_target_rtl; #if SWITCHABLE_TARGET @@ -1669,33 +1670,10 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, || TREE_CODE (t) == SAVE_EXPR) t = TREE_OPERAND (t, 0); - /* We may look through structure-like accesses for the purposes of - examining TREE_THIS_NOTRAP, but not array-like accesses. */ - base = t; - while (TREE_CODE (base) == COMPONENT_REF - || TREE_CODE (base) == REALPART_EXPR - || TREE_CODE (base) == IMAGPART_EXPR - || TREE_CODE (base) == BIT_FIELD_REF) - base = TREE_OPERAND (base, 0); - - if (TREE_CODE (base) == MEM_REF - && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) - base = TREE_OPERAND (TREE_OPERAND (base, 0), 0); - if (DECL_P (base)) - { - if (CODE_CONTAINS_STRUCT (TREE_CODE (base), TS_DECL_WITH_VIS)) - MEM_NOTRAP_P (ref) = !DECL_WEAK (base); - else - MEM_NOTRAP_P (ref) = 1; - } - else if (TREE_CODE (base) == INDIRECT_REF - || TREE_CODE (base) == MEM_REF - || TREE_CODE (base) == TARGET_MEM_REF - || TREE_CODE (base) == ARRAY_REF - || TREE_CODE (base) == ARRAY_RANGE_REF) - MEM_NOTRAP_P (ref) = TREE_THIS_NOTRAP (base); - - base = get_base_address (base); + /* Note whether this expression can trap. */ + MEM_NOTRAP_P (ref) = !tree_could_trap_p (t); + + base = get_base_address (t); if (base && DECL_P (base) && TREE_READONLY (base) && (TREE_STATIC (base) || DECL_EXTERNAL (base)) |