]> gcc.gnu.org Git - gcc.git/commitdiff
tree-ssa-operands.c (add_stmt_operand): Do not mark stmts volatile when processing...
authorRichard Guenther <rguenther@suse.de>
Thu, 8 Dec 2011 15:08:16 +0000 (15:08 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 8 Dec 2011 15:08:16 +0000 (15:08 +0000)
2011-12-08  Richard Guenther  <rguenther@suse.de>

* tree-ssa-operands.c (add_stmt_operand): Do not mark stmts
volatile when processing operands of an ADDR_EXPR.
(get_indirect_ref_operands): Likewise.
(get_tmr_operands): Likewise.
(get_expr_operands): Likewise.

* gcc.dg/volatile3.c: New testcase.

From-SVN: r182117

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/volatile3.c [new file with mode: 0644]
gcc/tree-ssa-operands.c

index ee1b6985f23b7cfcd834426116e72268f6085b58..acf73da830a4e84b6ede1b1ed603d0fc15b987d2 100644 (file)
@@ -1,3 +1,11 @@
+2011-12-08  Richard Guenther  <rguenther@suse.de>
+
+       * tree-ssa-operands.c (add_stmt_operand): Do not mark stmts
+       volatile when processing operands of an ADDR_EXPR.
+       (get_indirect_ref_operands): Likewise.
+       (get_tmr_operands): Likewise.
+       (get_expr_operands): Likewise.
+
 2011-12-08  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        PR target/50395
index 7cec9a6ff1975328f06a76c49fd630e6cbb69665..fe1e197480fad5735c6176d81f5402dd9b6d2ca8 100644 (file)
@@ -1,3 +1,7 @@
+2011-12-08  Richard Guenther  <rguenther@suse.de>
+
+       * gcc.dg/volatile3.c: New testcase.
+
 2011-12-08  Georg-Johann Lay  <avr@gjlay.de>
 
        PR tree-optimization/51315
diff --git a/gcc/testsuite/gcc.dg/volatile3.c b/gcc/testsuite/gcc.dg/volatile3.c
new file mode 100644 (file)
index 0000000..4a5893d
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-ssa" } */
+
+volatile int *q;
+void foo(int i)
+{
+  volatile int a[2];
+  volatile int *p = &a[i];
+  q = p;
+}
+
+/* { dg-final { scan-tree-dump-not "{v}" "ssa" } } */
+/* { dg-final { cleanup-tree-dump "ssa" } } */
index 3de34be7948eda5b6bba5b65c0c0aa2da88992a5..0045dd875ec09b516ba28ead5e59332a01180977 100644 (file)
@@ -668,7 +668,8 @@ add_stmt_operand (tree *var_p, gimple stmt, int flags)
   sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
 
   /* Mark statements with volatile operands.  */
-  if (TREE_THIS_VOLATILE (sym))
+  if (!(flags & opf_no_vops)
+      && TREE_THIS_VOLATILE (sym))
     gimple_set_has_volatile_ops (stmt, true);
 
   if (is_gimple_reg (sym))
@@ -728,7 +729,8 @@ get_indirect_ref_operands (gimple stmt, tree expr, int flags,
 {
   tree *pptr = &TREE_OPERAND (expr, 0);
 
-  if (TREE_THIS_VOLATILE (expr))
+  if (!(flags & opf_no_vops)
+      && TREE_THIS_VOLATILE (expr))
     gimple_set_has_volatile_ops (stmt, true);
 
   /* Add the VOP.  */
@@ -747,7 +749,8 @@ 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))
+  if (!(flags & opf_no_vops)
+      && TREE_THIS_VOLATILE (expr))
     gimple_set_has_volatile_ops (stmt, true);
 
   /* First record the real operands.  */
@@ -914,14 +917,16 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
     case REALPART_EXPR:
     case IMAGPART_EXPR:
       {
-       if (TREE_THIS_VOLATILE (expr))
+       if (!(flags & opf_no_vops)
+           && TREE_THIS_VOLATILE (expr))
          gimple_set_has_volatile_ops (stmt, true);
 
        get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
 
        if (code == COMPONENT_REF)
          {
-           if (TREE_THIS_VOLATILE (TREE_OPERAND (expr, 1)))
+           if (!(flags & opf_no_vops)
+               && TREE_THIS_VOLATILE (TREE_OPERAND (expr, 1)))
              gimple_set_has_volatile_ops (stmt, true);
            get_expr_operands (stmt, &TREE_OPERAND (expr, 2), uflags);
          }
@@ -960,7 +965,8 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
        /* A volatile constructor is actually TREE_CLOBBER_P, transfer
           the volatility to the statement, don't use TREE_CLOBBER_P for
           mirroring the other uses of THIS_VOLATILE in this file.  */
-       if (TREE_THIS_VOLATILE (expr))
+       if (!(flags & opf_no_vops)
+           && TREE_THIS_VOLATILE (expr))
          gimple_set_has_volatile_ops (stmt, true);
 
        for (idx = 0;
@@ -972,7 +978,8 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
       }
 
     case BIT_FIELD_REF:
-      if (TREE_THIS_VOLATILE (expr))
+      if (!(flags & opf_no_vops)
+         && TREE_THIS_VOLATILE (expr))
        gimple_set_has_volatile_ops (stmt, true);
       /* FALLTHRU */
 
This page took 0.125294 seconds and 5 git commands to generate.