re PR tree-optimization/84584 ([graphite] ICE: Segmentation fault (in dominated_by_p))
authorRichard Biener <rguenther@suse.de>
Wed, 28 Feb 2018 15:33:33 +0000 (15:33 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 28 Feb 2018 15:33:33 +0000 (15:33 +0000)
2018-02-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/84584
* graphite-scop-detection.c (scop_detection::add_scop): Discard
SCoPs with fake exit edge.

* gcc.dg/graphite/pr84584.c: New testcase.

From-SVN: r258070

gcc/ChangeLog
gcc/graphite-scop-detection.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr84584.c [new file with mode: 0644]

index 820b926ced79d88948de9a990967e811e22be257..dcea097318a788bc94a871927aeb7d3b55dbca81 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/84584
+       * graphite-scop-detection.c (scop_detection::add_scop): Discard
+       SCoPs with fake exit edge.
+
 2018-02-28  Martin Liska  <mliska@suse.cz>
 
        PR testsuite/84597
index 2331dec69190ea5f07b053da19249392de693efc..48e40142e59f7535fa416b480f56f18219002f72 100644 (file)
@@ -590,6 +590,15 @@ scop_detection::add_scop (sese_l s)
 {
   gcc_assert (s);
 
+  /* If the exit edge is fake discard the SCoP for now as we're removing the
+     fake edges again after analysis.  */
+  if (s.exit->flags & EDGE_FAKE)
+    {
+      DEBUG_PRINT (dp << "[scop-detection-fail] Discarding infinite loop SCoP: ";
+                  print_sese (dump_file, s));
+      return;
+    }
+
   /* Include the BB with the loop-closed SSA PHI nodes, we need this
      block in the region for code-generating out-of-SSA copies.
      canonicalize_loop_closed_ssa makes sure that is in proper shape.  */
index 694a01846778fb43679c03f3b6c1732a53d03dd4..d12f8103f8f4bcf32ab10006462a952a88cd89a4 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/84584
+       * gcc.dg/graphite/pr84584.c: New testcase.
+
 2018-02-28  Jonathan Wakely  <jwakely@redhat.com>
 
        PR preprocessor/84517
diff --git a/gcc/testsuite/gcc.dg/graphite/pr84584.c b/gcc/testsuite/gcc.dg/graphite/pr84584.c
new file mode 100644 (file)
index 0000000..a6c6194
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fgraphite-identity -fno-tree-loop-im" } */
+
+int q3, w1;
+
+void
+bw (int b8)
+{
+  const int sd = 2;
+  int mc;
+
+  for (mc = 0; mc < sd; ++mc)
+    {
+ik:
+      for (w1 = 0; w1 < sd; ++w1)
+       ++b8;
+    }
+
+  for (q3 = 0; q3 < sd; ++q3)
+    ;
+
+  goto ik;
+}