re PR tree-optimization/87280 (ICE in set_ssa_val_to, at tree-ssa-sccvn.c:3647)
authorRichard Biener <rguenther@suse.de>
Wed, 12 Sep 2018 14:03:21 +0000 (14:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 12 Sep 2018 14:03:21 +0000 (14:03 +0000)
2018-09-12  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87280
* tree-ssa-sccvn.c (process_bb): Handle the case of executable
edge but unreachable target.
(do_rpo_vn): For conservatively handling a PHI only mark
the backedge executable but not the block reachable.

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

From-SVN: r264241

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

index c96b5eb5480a26f57bb31f7752937ffad9037569..1da8d18c294cdf4d31dcce79c6bb2669efdb9681 100644 (file)
@@ -1,3 +1,11 @@
+2018-09-12  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87280
+       * tree-ssa-sccvn.c (process_bb): Handle the case of executable
+       edge but unreachable target.
+       (do_rpo_vn): For conservatively handling a PHI only mark
+       the backedge executable but not the block reachable.
+
 2018-09-12  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87266
index 5f73cd8fe2a708d543f1c4ca5d1676072b617dfd..f1b9fe231dbeffe8530dc6c35e8ebd4266462e99 100644 (file)
@@ -1,3 +1,8 @@
+2018-09-12  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87280
+       * gcc.dg/torture/pr87280.c: New testcase.
+
 2018-09-12  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87266
diff --git a/gcc/testsuite/gcc.dg/torture/pr87280.c b/gcc/testsuite/gcc.dg/torture/pr87280.c
new file mode 100644 (file)
index 0000000..c62e8be
--- /dev/null
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+/* { dg-additional-options "--param rpo-vn-max-loop-depth=5" } */
+
+int uc;
+
+void
+j8 (int *xv, int f3)
+{
+  uc = 0;
+  while (uc < 1)
+    {
+    }
+
+  if (*xv == 0)
+    {
+      int *o8 = xv;
+
+      if (0)
+       {
+n3:
+         *o8 = 0;
+         while (*o8 < 1)
+           {
+h5:
+             *o8 = 0;
+           }
+       }
+
+      while (*xv < 1)
+       if (*xv == 0)
+         goto h5;
+
+g5:
+      ;
+    }
+
+  *xv = 0;
+  for (;;)
+    {
+      while (uc < 1)
+       {
+       }
+
+      while (f3 < 1)
+       {
+         if (*xv == 0)
+           goto n3;
+
+         while (f3 < 1)
+           while (*xv < 1)
+             while (*xv < 1)
+               while (*xv < 1)
+                 while (*xv < 1)
+                   {
+                   }
+       }
+
+      if (*xv == 0)
+       goto g5;
+    }
+}
index 8bf724e793afd22bf002ef0d6a23246ca9a643ab..2a837c268211ec388c0d92404c400cca03ec9d5d 100644 (file)
@@ -5976,15 +5976,24 @@ process_bb (rpo_elim &avail, basic_block bb,
     {
       FOR_EACH_EDGE (e, ei, bb->succs)
        {
-         if (e->flags & EDGE_EXECUTABLE)
-           continue;
-         if (dump_file && (dump_flags & TDF_DETAILS))
-           fprintf (dump_file,
-                    "marking outgoing edge %d -> %d executable\n",
-                    e->src->index, e->dest->index);
-         gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK));
-         e->flags |= EDGE_EXECUTABLE;
-         e->dest->flags |= BB_EXECUTABLE;
+         if (!(e->flags & EDGE_EXECUTABLE))
+           {
+             if (dump_file && (dump_flags & TDF_DETAILS))
+               fprintf (dump_file,
+                        "marking outgoing edge %d -> %d executable\n",
+                        e->src->index, e->dest->index);
+             gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK));
+             e->flags |= EDGE_EXECUTABLE;
+             e->dest->flags |= BB_EXECUTABLE;
+           }
+         else if (!(e->dest->flags & BB_EXECUTABLE))
+           {
+             if (dump_file && (dump_flags & TDF_DETAILS))
+               fprintf (dump_file,
+                        "marking destination block %d reachable\n",
+                        e->dest->index);
+             e->dest->flags |= BB_EXECUTABLE;
+           }
        }
     }
   for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
@@ -6124,20 +6133,37 @@ process_bb (rpo_elim &avail, basic_block bb,
              e->flags |= EDGE_EXECUTABLE;
              e->dest->flags |= BB_EXECUTABLE;
            }
+         else if (!(e->dest->flags & BB_EXECUTABLE))
+           {
+             if (dump_file && (dump_flags & TDF_DETAILS))
+               fprintf (dump_file,
+                        "marking destination block %d reachable\n",
+                        e->dest->index);
+             e->dest->flags |= BB_EXECUTABLE;
+           }
        }
       else if (gsi_one_before_end_p (gsi))
        {
          FOR_EACH_EDGE (e, ei, bb->succs)
            {
-             if (e->flags & EDGE_EXECUTABLE)
-               continue;
-             if (dump_file && (dump_flags & TDF_DETAILS))
-               fprintf (dump_file,
-                        "marking outgoing edge %d -> %d executable\n",
-                        e->src->index, e->dest->index);
-             gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK));
-             e->flags |= EDGE_EXECUTABLE;
-             e->dest->flags |= BB_EXECUTABLE;
+             if (!(e->flags & EDGE_EXECUTABLE))
+               {
+                 if (dump_file && (dump_flags & TDF_DETAILS))
+                   fprintf (dump_file,
+                            "marking outgoing edge %d -> %d executable\n",
+                            e->src->index, e->dest->index);
+                 gcc_checking_assert (iterate || !(e->flags & EDGE_DFS_BACK));
+                 e->flags |= EDGE_EXECUTABLE;
+                 e->dest->flags |= BB_EXECUTABLE;
+               }
+             else if (!(e->dest->flags & BB_EXECUTABLE))
+               {
+                 if (dump_file && (dump_flags & TDF_DETAILS))
+                   fprintf (dump_file,
+                            "marking destination block %d reachable\n",
+                            e->dest->index);
+                 e->dest->flags |= BB_EXECUTABLE;
+               }
            }
        }
 
@@ -6399,7 +6425,6 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
                if (e->flags & EDGE_DFS_BACK)
                  {
                    e->flags |= EDGE_EXECUTABLE;
-                   e->dest->flags |= BB_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.  */