re PR tree-optimization/70780 (wrong code at -O2 and -O3 on x86_64-linux-gnu)
authorRichard Biener <rguenther@suse.de>
Mon, 25 Apr 2016 10:49:55 +0000 (10:49 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 25 Apr 2016 10:49:55 +0000 (10:49 +0000)
2016-04-25  Richard Biener  <rguenther@suse.de>

PR tree-optimization/70780
* tree-ssa-pre.c (compute_antic_aux): Also return true if the block
wasn't visited yet.
(compute_antic): Mark blocks with abnormal preds as visited as
they have a final empty antic-in solution already.

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

From-SVN: r235407

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

index e70bcaf6ba52b932c87e45fc3116321688a38018..2dac38eff7becd79f2c5c9d4deab2ee5ab254b47 100644 (file)
@@ -1,4 +1,13 @@
+2016-04-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/70780
+       * tree-ssa-pre.c (compute_antic_aux): Also return true if the block
+       wasn't visited yet.
+       (compute_antic): Mark blocks with abnormal preds as visited as
+       they have a final empty antic-in solution already.
+
 2016-04-25  Michael Collison  <michael.collison@linaro.org>
+
        * ChangeLog(2016-04-25): Fix ChangeLog formatting.
 
 2016-04-25  Michael Collison  <michael.collison@linaro.org>
index d49f1895160e173bb3590aaa9144d3ed98ecee00..bbaa3a2f1a28d5a07450245b776fb67c1d5aefe0 100644 (file)
@@ -1,3 +1,8 @@
+2016-04-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/70780
+       * gcc.dg/torture/pr70780.c: New testcase.
+
 2016-04-25  Michael Collison <michael.collison@arm.com>
 
        * testsuite/gcc.target/arm/neon-vaddws16.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr70780.c b/gcc/testsuite/gcc.dg/torture/pr70780.c
new file mode 100644 (file)
index 0000000..2f7a5cb
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+
+int a, b, c, *d, e;
+
+static int
+fn1 () 
+{
+  if (a)
+    goto l1;
+l2: while (b)
+      if (*d)
+       return c;
+    for (e = 0; e; e++)
+      {
+       goto l2;
+l1:;
+      }
+    return 0; 
+}
+
+int
+main ()
+{
+  fn1 ();
+  return 0; 
+}
index 2d1eb70c03b600ddaa69c087b99fccc42a7b98b3..7b9eb2e5b9cd65e2f8c09a545c541c3a844e2c3b 100644 (file)
@@ -2077,6 +2077,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
   unsigned int bii;
   edge e;
   edge_iterator ei;
+  bool was_visited = BB_VISITED (block);
 
   old = ANTIC_OUT = S = NULL;
   BB_VISITED (block) = 1;
@@ -2167,7 +2168,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
 
   clean (ANTIC_IN (block));
 
-  if (!bitmap_set_equal (old, ANTIC_IN (block)))
+  if (!was_visited || !bitmap_set_equal (old, ANTIC_IN (block)))
     changed = true;
 
  maybe_dump_sets: