tree-ssa-dom.c (propagate_rhs_into_lhs): Don't call update_stmt directly.
authorJeff Law <law@redhat.com>
Fri, 24 Mar 2006 23:21:27 +0000 (16:21 -0700)
committerJeff Law <law@gcc.gnu.org>
Fri, 24 Mar 2006 23:21:27 +0000 (16:21 -0700)
        * tree-ssa-dom.c (propagate_rhs_into_lhs): Don't call update_stmt
        directly.  Call mark_new_vars_to_rename slightly earlier.

        * gcc.c-torture/pr26840.c: New test.

From-SVN: r112365

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr26840.c [new file with mode: 0644]
gcc/tree-ssa-dom.c

index cdb1fdc..51a9ae8 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-24  Jeff Law  <law@redhat.com>
+
+       * tree-ssa-dom.c (propagate_rhs_into_lhs): Don't call update_stmt
+       directly.  Call mark_new_vars_to_rename slightly earlier.
+
 2006-03-24  Geoffrey Keating  <geoffk@apple.com>
 
        PR 26793
index 6857ace..c7daaeb 100644 (file)
@@ -1,3 +1,7 @@
+2006-03-24  Jeff Law  <law@redhat.com>
+
+       * gcc.c-torture/pr26840.c: New test.
+
 2006-03-24  Geoffrey Keating  <geoffk@apple.com>
 
        * g++.old-deja/g++.other/init19.C: New.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26840.c b/gcc/testsuite/gcc.c-torture/compile/pr26840.c
new file mode 100644 (file)
index 0000000..8d864a2
--- /dev/null
@@ -0,0 +1,42 @@
+extern int f1 (void **);
+extern void f2 (void *);
+
+struct s
+{
+  unsigned char field1;
+  int field2;
+};
+
+static inline struct s *
+get_globals (void)
+{
+  struct s * r;
+  void * rr;
+
+  if (f1 (&rr))
+    return 0;
+  r = rr;
+  if (! r)
+    {
+      extern struct s t;
+      r = &t;
+    }
+  r->field1 = 1;
+  return r;
+}
+
+void
+atexit_common (const void *dso)
+{
+  struct s *g = get_globals ();
+
+  if (! g)
+    return;
+  if (g->field1)
+    {
+      g->field2 = 0;
+      f2 (g);
+    }
+  else
+    f2 (g);
+}
index 9df59e9..db9f873 100644 (file)
@@ -2160,7 +2160,11 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
             collapse control statements.  */
          propagate_value (use_p, rhs);
          fold_stmt_inplace (use_stmt);
-         update_stmt (use_stmt);
+
+         /* Sometimes propagation can expose new operands to the
+            renamer.  Note this will call update_stmt at the 
+            appropriate time.  */
+         mark_new_vars_to_rename (use_stmt);
 
          /* Dump details.  */
          if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2170,10 +2174,6 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
              fprintf (dump_file, "\n");
            }
 
-         /* Sometimes propagation can expose new operands to the
-            renamer.  */
-         mark_new_vars_to_rename (use_stmt);
-
          /* If we replaced a variable index with a constant, then
             we would need to update the invariant flag for ADDR_EXPRs.  */
          if (TREE_CODE (use_stmt) == MODIFY_EXPR