OSDN Git Service

2011-01-18 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Jan 2011 15:50:55 +0000 (15:50 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Jan 2011 15:50:55 +0000 (15:50 +0000)
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

gcc/ChangeLog
gcc/Makefile.in
gcc/emit-rtl.c

index 25625c4..678f393 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2011-01-18  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
 
         * config/arm/cortex-a9.md (cortex-a9-neon.md): Actually
index 188f8d5..db98cc8 100644 (file)
@@ -2952,7 +2952,7 @@ emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    $(TREE_H) $(FLAGS_H) $(FUNCTION_H) $(REGS_H) insn-config.h $(RECOG_H) \
    $(GGC_H) $(EXPR_H) hard-reg-set.h $(BITMAP_H) $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) \
    $(HASHTAB_H) $(TM_P_H) debug.h langhooks.h $(TREE_PASS_H) gt-emit-rtl.h \
-   $(DF_H) $(PARAMS_H) $(TARGET_H)
+   $(DF_H) $(PARAMS_H) $(TARGET_H) $(TREE_FLOW_H)
 real.o : real.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    $(DIAGNOSTIC_CORE_H) $(TM_P_H) $(REAL_H) dfp.h realmpfr.h
 realmpfr.o : realmpfr.c realmpfr.h $(CONFIG_H) $(SYSTEM_H) $(REAL_H)
index 0839d0b..4ff5d4e 100644 (file)
@@ -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))