OSDN Git Service

2010-04-01 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Apr 2010 16:18:07 +0000 (16:18 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Apr 2010 16:18:07 +0000 (16:18 +0000)
PR middle-end/43614
* tree-ssa-address.c (copy_mem_ref_info): Copy TREE_SIDE_EFFECTS
and TREE_THIS_VOLATILE.
(copy_ref_info): Likewise.
* tree-ssa-operands.c (get_tmr_operands): Check TREE_THIS_VOLATILE.
* tree.c (build6_stat): Ignore side-effects of all but arg5
for TARGET_MEM_REF.  Set TREE_THIS_VOLATILE from arg5 of
TARGET_MEM_REF.

* gcc.c-torture/compile/pr43614.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157913 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr43614.c [new file with mode: 0644]
gcc/tree-ssa-address.c
gcc/tree-ssa-loop-ivopts.c
gcc/tree-ssa-operands.c
gcc/tree.c

index 2e70ef8..c2a6a64 100644 (file)
@@ -1,5 +1,16 @@
 2010-04-01  Richard Guenther  <rguenther@suse.de>
 
+       PR middle-end/43614
+       * tree-ssa-address.c (copy_mem_ref_info): Copy TREE_SIDE_EFFECTS
+       and TREE_THIS_VOLATILE.
+       (copy_ref_info): Likewise.
+       * tree-ssa-operands.c (get_tmr_operands): Check TREE_THIS_VOLATILE.
+       * tree.c (build6_stat): Ignore side-effects of all but arg5
+       for TARGET_MEM_REF.  Set TREE_THIS_VOLATILE from arg5 of
+       TARGET_MEM_REF.
+
+2010-04-01  Richard Guenther  <rguenther@suse.de>
+
        PR tree-optimization/43607
        * ipa-type-escape.c (check_call): Do not access non-existing
        arguments.
index 77ebaa6..c182186 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-01  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/43614
+       * gcc.c-torture/compile/pr43614.c: New testcase.
+
 2010-04-01  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/43141
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43614.c b/gcc/testsuite/gcc.c-torture/compile/pr43614.c
new file mode 100644 (file)
index 0000000..411b25d
--- /dev/null
@@ -0,0 +1,27 @@
+volatile int g_2[7];
+
+void foo (unsigned);
+
+int main (void)
+{
+  int i_459 = 0;
+  int t2818;
+  int t2819;
+  volatile char *t2820;
+  int t2821;
+  volatile char *t2822;
+  int *t2823;
+  unsigned t2824;
+LL655:
+  t2822 = (volatile char *)g_2;
+  t2821 = i_459;
+  t2820 = t2822 + t2821;
+  t2823 = (int *)t2820;
+  t2824 = *t2823;
+  foo (t2824);
+  t2818 = i_459;
+  t2819 = t2818 + 1;
+  i_459 = t2819;
+  goto LL655;
+}
+
index 5cd5d9d..b17257a 100644 (file)
@@ -765,6 +765,8 @@ copy_mem_ref_info (tree to, tree from)
 {
   /* And the info about the original reference.  */
   TMR_ORIGINAL (to) = TMR_ORIGINAL (from);
+  TREE_SIDE_EFFECTS (to) = TREE_SIDE_EFFECTS (from);
+  TREE_THIS_VOLATILE (to) = TREE_THIS_VOLATILE (from);
 }
 
 /* Move constants in target_mem_ref REF to offset.  Returns the new target
index e6565db..f6db241 100644 (file)
@@ -5517,7 +5517,11 @@ copy_ref_info (tree new_ref, tree old_ref)
   if (TREE_CODE (old_ref) == TARGET_MEM_REF)
     copy_mem_ref_info (new_ref, old_ref);
   else
-    TMR_ORIGINAL (new_ref) = unshare_and_remove_ssa_names (old_ref);
+    {
+      TMR_ORIGINAL (new_ref) = unshare_and_remove_ssa_names (old_ref);
+      TREE_SIDE_EFFECTS (new_ref) = TREE_SIDE_EFFECTS (old_ref);
+      TREE_THIS_VOLATILE (new_ref) = TREE_THIS_VOLATILE (old_ref);
+    }
 }
 
 /* Rewrites USE (address that is an iv) using candidate CAND.  */
index 9b6d3a3..0c525b9 100644 (file)
@@ -732,6 +732,9 @@ get_indirect_ref_operands (gimple stmt, tree expr, int flags,
 static void
 get_tmr_operands (gimple stmt, tree expr, int flags)
 {
+  if (TREE_THIS_VOLATILE (expr))
+    gimple_set_has_volatile_ops (stmt, true);
+
   /* First record the real operands.  */
   get_expr_operands (stmt, &TMR_BASE (expr), opf_use | (flags & opf_no_vops));
   get_expr_operands (stmt, &TMR_INDEX (expr), opf_use | (flags & opf_no_vops));
index 86fe2bb..863b51e 100644 (file)
@@ -3824,10 +3824,14 @@ build6_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
   PROCESS_ARG(2);
   PROCESS_ARG(3);
   PROCESS_ARG(4);
+  if (code == TARGET_MEM_REF)
+    side_effects = 0;
   PROCESS_ARG(5);
 
   TREE_SIDE_EFFECTS (t) = side_effects;
-  TREE_THIS_VOLATILE (t) = 0;
+  TREE_THIS_VOLATILE (t)
+    = (code == TARGET_MEM_REF
+       && arg5 && TREE_THIS_VOLATILE (arg5));
 
   return t;
 }