re PR tree-optimization/87776 (Compile time hog during RPO VN)
authorRichard Biener <rguenther@suse.de>
Fri, 2 Nov 2018 07:53:48 +0000 (07:53 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 2 Nov 2018 07:53:48 +0000 (07:53 +0000)
2018-11-02  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87776
* tree-ssa-sccvn.c (do_rpo_vn): Do not mark backedges
executable when iterating but running into rpo-vn-max-loop-depth
and not eliding the iteration.

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

From-SVN: r265739

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

index 9d5ed94615ab75fec4f0c1317f21e4664eae8669..90d11f5038d1845cfac4519deca8b2351143fdd9 100644 (file)
@@ -1,3 +1,10 @@
+2018-11-02  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87776
+       * tree-ssa-sccvn.c (do_rpo_vn): Do not mark backedges
+       executable when iterating but running into rpo-vn-max-loop-depth
+       and not eliding the iteration.
+
 2018-11-30  Jan Hubicka  <jh@suse.cz>
 
        * tree.c (free_lang_data_in_decl): Free TREE_TYPE and alignment of
index 98703db230539da08599b7544b33154b55d190da..e3f4e8ef4e365f4951f501b7a05e0bfab5233507 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-02  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87776
+       * gcc.dg/torture/pr87776.c: New testcase.
+
 2018-11-01  Marek Polacek  <polacek@redhat.com>
 
        Implement P0846R0, ADL and function templates.
diff --git a/gcc/testsuite/gcc.dg/torture/pr87776.c b/gcc/testsuite/gcc.dg/torture/pr87776.c
new file mode 100644 (file)
index 0000000..1f15070
--- /dev/null
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-additional-options "--param rpo-vn-max-loop-depth=2" } */
+
+int wp;
+
+void
+ff (void)
+{
+  int *s3 = &wp;
+
+  for (wp = 0; wp < 1; ++wp)
+    {
+      if (wp != 0)
+       {
+o8:
+         ;
+       }
+      else
+       {
+b7:
+         while (wp < 1)
+           {
+           }
+       }
+
+      for (*s3 = 0; *s3 < 1; ++*s3)
+       {
+         for (wp = 0; wp < 1; ++wp)
+           for (wp = 0; wp < 1; ++wp)
+             {
+             }
+
+         for (wp = 0; wp < 1; ++wp)
+           goto o8;
+
+         for (wp = 0; wp < 1; ++wp)
+           goto b7;
+       }
+    }
+}
index 38330754769e906e17df18ac5bc6b42c8b06ce5f..43641916d5298ab53f4b3c84d73cc182acb8a8f0 100644 (file)
@@ -6449,7 +6449,6 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
              FOR_EACH_EDGE (e, ei, header->preds)
                if (e->flags & EDGE_DFS_BACK)
                  {
-                   e->flags |= EDGE_EXECUTABLE;
                    /* There can be a non-latch backedge into the header
                       which is part of an outer irreducible region.  We
                       cannot avoid iterating this block then.  */
@@ -6462,6 +6461,8 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
                                   e->src->index, e->dest->index, loop->num);
                        non_latch_backedge = true;
                      }
+                   else
+                     e->flags |= EDGE_EXECUTABLE;
                  }
              rpo_state[bb_to_rpo[header->index]].iterate = non_latch_backedge;
            }