]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2007-03-19 Andrew Pinski <andrew_pinski@playstation.sony.com>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Mar 2007 13:36:29 +0000 (13:36 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Mar 2007 13:36:29 +0000 (13:36 +0000)
Richard Guenther  <rguenther@suse.de>

PR tree-optimization/31254
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1):
Use handled_component_p () where appropriate.  Continue
propagating into the rhs if we propagated into an INDIRECT_REF
on the lhs.

* gcc.dg/torture/pr31254.c: New testcase.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr31254.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.c

index 2e8292db81738cb5b916bba657ec93a09144254c..16a38b1086fdf6e59e14a476d6f76ab769c45d17 100644 (file)
@@ -1,3 +1,12 @@
+2007-03-19  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+       Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/31254
+       * tree-ssa-forwprop.c (forward_propagate_addr_expr_1):
+       Use handled_component_p () where appropriate.  Continue
+       propagating into the rhs if we propagated into an INDIRECT_REF
+       on the lhs.
+
 2007-03-19  Andreas Krebbel  <krebbel1@de.ibm.com>
 
        * config/s390/s390.md (op_type attribute): RRR instruction type added.
index 78cfd2088f90da6bcffd638475477abf87825c82..b62c6ebe11809d389cae30c81fec83e55b48781b 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-19  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+       Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/31254
+       * gcc.dg/torture/pr31254.c: New testcase.
+
 2007-03-19  Hans-Peter Nilsson  <hp@axis.com>
 
        * gcc.dg/torture/pr26565.c: Expect warning on packed field for
diff --git a/gcc/testsuite/gcc.dg/torture/pr31254.c b/gcc/testsuite/gcc.dg/torture/pr31254.c
new file mode 100644 (file)
index 0000000..cec3012
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+struct timespec
+{
+  long tv_sec;
+  long tv_nsec;
+};
+struct inode
+{
+  struct timespec i_atime;
+  struct timespec i_mtime;
+};
+struct afs_vnode
+{
+  struct inode vfs_inode;
+};
+static inline
+  struct inode *AFS_VNODE_TO_I (struct afs_vnode *vnode)
+{
+  return &vnode->vfs_inode;
+};
+afs_inode_map_status (struct afs_vnode *vnode)
+{
+  struct inode *inode = AFS_VNODE_TO_I (vnode);
+  inode->i_atime = inode->i_mtime;
+}
index a755a4a4fc3ee803fbd738944961215a0e1e35db..95a0c91a1de4c86f1ff0550b9698c4b781957b24 100644 (file)
@@ -680,7 +680,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt)
   /* Strip away any outer COMPONENT_REF/ARRAY_REF nodes from the LHS. 
      ADDR_EXPR will not appear on the LHS.  */
   lhs = GIMPLE_STMT_OPERAND (use_stmt, 0);
-  while (TREE_CODE (lhs) == COMPONENT_REF || TREE_CODE (lhs) == ARRAY_REF)
+  while (handled_component_p (lhs))
     lhs = TREE_OPERAND (lhs, 0);
 
   rhs = GIMPLE_STMT_OPERAND (use_stmt, 1);
@@ -695,9 +695,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt)
       fold_stmt_inplace (use_stmt);
       tidy_after_forward_propagate_addr (use_stmt);
 
-      /* The only case we did not replace all uses this way is if the
-        use statement is of the form *name = name.  */
-      return rhs != name;
+      /* Continue propagating into the RHS.  */
     }
 
   /* Trivial case.  The use statement could be a trivial copy or a
@@ -714,8 +712,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt)
 
   /* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR
      nodes from the RHS.  */
-  while (TREE_CODE (rhs) == COMPONENT_REF
-        || TREE_CODE (rhs) == ARRAY_REF
+  while (handled_component_p (rhs)
         || TREE_CODE (rhs) == ADDR_EXPR)
     rhs = TREE_OPERAND (rhs, 0);