]> gcc.gnu.org Git - gcc.git/commitdiff
re PR tree-optimization/83963 ([graphite] ICE in merge_sese, at graphite-scop-detecti...
authorRichard Biener <rguenther@suse.de>
Mon, 22 Jan 2018 13:10:57 +0000 (13:10 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 22 Jan 2018 13:10:57 +0000 (13:10 +0000)
2018-01-22  Richard Biener  <rguenther@suse.de>

PR tree-optimization/83963
* graphite-scop-detection.c (scop_detection::get_sese): Delay
including the loop exit block.
(scop_detection::merge_sese): Likewise.
(scop_detection::add_scop): Do it here instead.

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

From-SVN: r256943

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

index f3fe4f69710168080385047392777eb81707cd0f..bba9f63c11f057cbd10fdaf4862d988a7dbb3694 100644 (file)
@@ -1,3 +1,11 @@
+2018-01-22  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83963
+       * graphite-scop-detection.c (scop_detection::get_sese): Delay
+       including the loop exit block.
+       (scop_detection::merge_sese): Likewise.
+       (scop_detection::add_scop): Do it here instead.
+
 2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * doc/sourcebuild.texi (arm_softfloat): Document.
index b1122c227eb73cd445a6f94bcff5c3d683e7f954..6f407e16c887d66ad34a5ce33cfffe79fbe1cea8 100644 (file)
@@ -420,13 +420,6 @@ scop_detection::get_sese (loop_p loop)
   edge scop_end = single_exit (loop);
   if (!scop_end || (scop_end->flags & (EDGE_COMPLEX|EDGE_FAKE)))
     return invalid_sese;
-  /* Include the BB with the loop-closed SSA PHI nodes.
-     canonicalize_loop_closed_ssa makes sure that is in proper shape.  */
-  if (! single_pred_p (scop_end->dest)
-      || ! single_succ_p (scop_end->dest)
-      || ! sese_trivially_empty_bb_p (scop_end->dest))
-    gcc_unreachable ();
-  scop_end = single_succ_edge (scop_end->dest);
 
   return sese_l (scop_begin, scop_end);
 }
@@ -507,17 +500,6 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
     }
   while (! bitmap_empty_p (worklist));
 
-  /* Include the BB with the loop-closed SSA PHI nodes.
-     canonicalize_loop_closed_ssa makes sure that is in proper shape.  */
-  if (exit->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)
-      && loop_exit_edge_p (exit->src->loop_father, exit))
-    {
-      gcc_assert (single_pred_p (exit->dest)
-                 && single_succ_p (exit->dest)
-                 && sese_trivially_empty_bb_p (exit->dest));
-      exit = single_succ_edge (exit->dest);
-    }
-
   sese_l combined (entry, exit);
 
   DEBUG_PRINT (dp << "[merged-sese] s1: "; print_sese (dump_file, combined));
@@ -608,6 +590,18 @@ scop_detection::add_scop (sese_l s)
 {
   gcc_assert (s);
 
+  /* 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.  */
+  if (s.exit->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)
+      && loop_exit_edge_p (s.exit->src->loop_father, s.exit))
+    {
+      gcc_assert (single_pred_p (s.exit->dest)
+                 && single_succ_p (s.exit->dest)
+                 && sese_trivially_empty_bb_p (s.exit->dest));
+      s.exit = single_succ_edge (s.exit->dest);
+    }
+
   /* Do not add scops with only one loop.  */
   if (region_has_one_loop (s))
     {
index 256ab140d4c1e2ef361b4d31d8d0445b7da066e3..d64a841a49eef2b05d2ce3990a1edc106195aecb 100644 (file)
@@ -1,3 +1,7 @@
+2018-01-22  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83963
+       * gcc.dg/graphite/pr83963.c: New testcase.
 
 2018-01-22  Sudakshina Das  <sudi.das@arm.com>
 
diff --git a/gcc/testsuite/gcc.dg/graphite/pr83963.c b/gcc/testsuite/gcc.dg/graphite/pr83963.c
new file mode 100644 (file)
index 0000000..6174463
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O -floop-nest-optimize -fno-tree-loop-im" } */
+
+int mg, et;
+
+void
+s5 (int is)
+{
+  if (is == 0)
+    {
+g6:
+      ++is;
+    }
+
+  while (mg < 1)
+    {
+      while (et < 1)
+       {
+         if (is == 0)
+           return;
+
+         ++et;
+       }
+
+      while (mg < 1)
+       ++mg;
+    }
+
+  goto g6;
+}
+
This page took 0.097417 seconds and 5 git commands to generate.