OSDN Git Service

2011-10-18 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Oct 2011 11:44:15 +0000 (11:44 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Oct 2011 11:44:15 +0000 (11:44 +0000)
PR tree-optimization/50767
* tree-ssa-pre.c (create_expression_by_pieces): Update the
folded statement.

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

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

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

index 2968fb0..d026022 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-18  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/50767
+       * tree-ssa-pre.c (create_expression_by_pieces): Update the
+       folded statement.
+
 2011-10-18  Julian Brown  <julian@codesourcery.com>
 
        * config/arm/arm.c (arm_block_move_unaligned_straight)
 2011-10-18  Julian Brown  <julian@codesourcery.com>
 
        * config/arm/arm.c (arm_block_move_unaligned_straight)
index 3216bfc..411f63e 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-18  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/50767
+       * gcc.dg/torture/pr50767.c: New testcase.
+
 2011-10-18  Julian Brown  <julian@codesourcery.com>
 
        * lib/target-supports.exp (check_effective_target_arm_unaligned): New.
 2011-10-18  Julian Brown  <julian@codesourcery.com>
 
        * lib/target-supports.exp (check_effective_target_arm_unaligned): New.
diff --git a/gcc/testsuite/gcc.dg/torture/pr50767.c b/gcc/testsuite/gcc.dg/torture/pr50767.c
new file mode 100644 (file)
index 0000000..96ab72e
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-tree-copy-prop -fno-tree-dominator-opts" } */
+
+struct S
+{
+  struct S *s;
+};
+
+static struct S *ss;
+struct S *s;
+
+void bar(void);
+
+void foo(void)
+{
+  for (;;)
+    {
+      s->s = ss;
+      bar ();
+    }
+}
index a7f6cee..60ae35c 100644 (file)
@@ -3188,7 +3188,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
 
   /* Fold the last statement.  */
   gsi = gsi_last (*stmts);
 
   /* Fold the last statement.  */
   gsi = gsi_last (*stmts);
-  fold_stmt_inplace (&gsi);
+  if (fold_stmt_inplace (&gsi))
+    update_stmt (gsi_stmt (gsi));
 
   /* Add a value number to the temporary.
      The value may already exist in either NEW_SETS, or AVAIL_OUT, because
 
   /* Add a value number to the temporary.
      The value may already exist in either NEW_SETS, or AVAIL_OUT, because