tree-ssa-operands.c (get_expr_operands): Revert changes to ADDR_EXPR processing intro...
authorDiego Novillo <dnovillo@redhat.com>
Thu, 29 Jul 2004 17:15:38 +0000 (17:15 +0000)
committerDiego Novillo <dnovillo@gcc.gnu.org>
Thu, 29 Jul 2004 17:15:38 +0000 (13:15 -0400)
* tree-ssa-operands.c (get_expr_operands): Revert changes
to ADDR_EXPR processing introduced by:
    2004-06-21  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
    * tree-ssa-operands.c (get_expr_operands): Minor rearrangements.

testsuite/ChangeLog

* gcc.dg/tree-ssa/20040729-1.c: New test.

From-SVN: r85306

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

index 22fa108494969d6d377e9da7464148df7f2c25d1..1d178751163490b161b0eb24890ace6adf45da29 100644 (file)
@@ -1,3 +1,10 @@
+2004-07-29  Diego Novillo  <dnovillo@redhat.com>
+
+       * tree-ssa-operands.c (get_expr_operands): Revert changes
+       to ADDR_EXPR processing introduced by:
+           2004-06-21  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+           * tree-ssa-operands.c (get_expr_operands): Minor rearrangements.
+
 2004-07-29  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        * doc/implement-c.texi: Add C90 subclause references.  Point to
index 2bb525981ecc1bcfb314411d8132f6b8443d862a..c82cbe55ddc030185f4160b34c13e475e71bf7b6 100644 (file)
@@ -1,3 +1,7 @@
+2004-07-29  Diego Novillo  <dnovillo@redhat.com>
+
+       * gcc.dg/tree-ssa/20040729-1.c: New test.
+
 2004-07-27  Matt Austern <austern@apple.com>
 
        * gcc.dg/darwin-bool-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c
new file mode 100644 (file)
index 0000000..6543163
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-dce3" } */
+
+foo ()
+{
+  volatile int *p;
+  volatile int x;
+
+  p = &x;
+  *p = 3;
+  return *p + 1;
+}
+
+/* The assignment to 'p' is dead and should be removed.  But the
+   compiler was mistakenly thinking that the statement had volatile
+   operands.  But 'p' itself is not volatile and taking the address of
+   a volatile does not constitute a volatile operand.  */
+/* { dg-final { scan-tree-dump-times "&x" 0 "dce3"} } */
index a9e864ed8c1c018f17483288134a6f649199e700..4b1e37f2b3ff415fe330d0528c2a281a8dff03da 100644 (file)
@@ -859,9 +859,9 @@ get_expr_operands (tree stmt, tree *expr_p, int flags, voperands_t prev_vops)
         of interest to some passes (e.g. alias resolution).  */
       add_stmt_operand (expr_p, stmt, 0, NULL);
 
-      /* If the address is constant (invariant is not sufficient), there will
-        be no interesting variable references inside.  */
-      if (TREE_CONSTANT (expr))
+      /* If the address is invariant, there may be no interesting variable
+        references inside.  */
+      if (is_gimple_min_invariant (expr))
        return;
 
       /* There should be no VUSEs created, since the referenced objects are