re PR tree-optimization/57488 (loop terminates early at -O3)
authorRichard Biener <rguenther@suse.de>
Mon, 24 Jun 2013 10:22:22 +0000 (10:22 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 24 Jun 2013 10:22:22 +0000 (10:22 +0000)
2013-06-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/57488
* tree-ssa-pre.c (insert): Clear NEW sets before each iteration.

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

From-SVN: r200363

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

index d10b846d4c37ab25e6ddf559eb053240cc5de6b9..51d549f3fa481d51a5cc99de0021354f114abb05 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/57488
+       * tree-ssa-pre.c (insert): Clear NEW sets before each iteration.
+
 2013-06-24  Alan Modra  <amodra@gmail.com>
 
        * config/rs6000/rs6000.c (vspltis_constant): Correct for little-endian.
index d130644e58ad87330489c756bfde7a51a6adc6ae..bb5eaa76ad2fb3c8a972321fefd3742137345f7e 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/57488
+       * gcc.dg/torture/pr57488.c: New testcase.
+
 2013-06-24  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Dominique d'Humieres  <dominiq@lps.ens.fr>
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr57488.c b/gcc/testsuite/gcc.dg/torture/pr57488.c
new file mode 100644 (file)
index 0000000..7eda364
--- /dev/null
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+int i, j, *pj = &j, **ppj = &pj;
+int x, *px = &x;
+
+short s, *ps = &s, k;
+
+unsigned short u, *pu = &u, **ppu = &pu;
+
+char c, *pc = &c;
+
+unsigned char v = 48;
+
+static int
+bar (int p)
+{
+  p = k;
+  *px = **ppu = i;
+  *ppj = &p;
+  if (**ppj)
+    *pj = p;
+  return p;
+}
+
+void __attribute__((noinline))
+foo ()
+{
+  for (; i <= 3; i++)
+    for (; j; j--);
+
+  u ^= bar (*pj);
+
+  for (k = 1; k >= 0; k--)
+    {
+      int l;
+      bar (0);
+      for (l = 1; l < 5; l++)
+       {
+         int m;
+         for (m = 6; m; m--)
+           {
+             v--;
+             *ps = *pc;
+           }
+       }
+    }
+}
+
+int
+main ()
+{
+  foo ();
+  if (v != 0)
+    abort ();
+  return 0;
+}
index 345ebcceaad4e40f4ff6fa86c76a2412d62fb512..642a343afe8f7351c15d718054057747ec75a468 100644 (file)
@@ -3665,6 +3665,12 @@ insert (void)
       if (dump_file && dump_flags & TDF_DETAILS)
        fprintf (dump_file, "Starting insert iteration %d\n", num_iterations);
       new_stuff = insert_aux (ENTRY_BLOCK_PTR);
+
+      /* Clear the NEW sets before the next iteration.  We have already
+         fully propagated its contents.  */
+      if (new_stuff)
+       FOR_ALL_BB (bb)
+         bitmap_set_free (NEW_SETS (bb));
     }
   statistics_histogram_event (cfun, "insert iterations", num_iterations);
 }