diff mbox series

Fix PR84584

Message ID alpine.LSU.2.20.1802281306360.18265@zhemvz.fhfr.qr
State New
Headers show
Series Fix PR84584 | expand

Commit Message

Richard Biener Feb. 28, 2018, 12:07 p.m. UTC
The following fixes this PR.

Bootstrap & regtest running on x86_64-unknown-linux-gnu.

Richard.

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.
diff mbox series

Patch

Index: gcc/graphite-scop-detection.c
===================================================================
--- gcc/graphite-scop-detection.c	(revision 258056)
+++ gcc/graphite-scop-detection.c	(working copy)
@@ -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: gcc/testsuite/gcc.dg/graphite/pr84584.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/pr84584.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/graphite/pr84584.c	(working copy)
@@ -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;
+}