re PR rtl-optimization/84872 (ICE in create_preheader, at cfgloopmanip.c:1536)
authorJakub Jelinek <jakub@redhat.com>
Fri, 6 Apr 2018 17:28:02 +0000 (19:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 6 Apr 2018 17:28:02 +0000 (19:28 +0200)
PR rtl-optimization/84872
* cfgloopmanip.c (create_preheader): Use make_forwarder_block even if
nentry == 1 when CP_FALLTHRU_PREHEADERS and single_entry is
EDGE_CROSSING edge.

* gcc.dg/graphite/pr84872.c: New test.

From-SVN: r259182

gcc/ChangeLog
gcc/cfgloopmanip.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr84872.c [new file with mode: 0644]

index 36e775ddf1ca781bbe81e13450b97a9bd98af3d6..1a8fcf692d5eb249021f614ce781f77e7ac6a8e7 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/84872
+       * cfgloopmanip.c (create_preheader): Use make_forwarder_block even if
+       nentry == 1 when CP_FALLTHRU_PREHEADERS and single_entry is
+       EDGE_CROSSING edge.
+
 2018-04-06  Tamar Christina  <tamar.christina@arm.com>
 
        * expr.c (copy_blkmode_to_reg): Revert 254862.
index b9b76d80faa99e81e13661ffa65954f335020d94..27484850fd53e9a35fb6d9413337ac2eac1f8918 100644 (file)
@@ -1494,7 +1494,9 @@ create_preheader (struct loop *loop, int flags)
 
   mfb_kj_edge = loop_latch_edge (loop);
   latch_edge_was_fallthru = (mfb_kj_edge->flags & EDGE_FALLTHRU) != 0;
-  if (nentry == 1)
+  if (nentry == 1
+      && ((flags & CP_FALLTHRU_PREHEADERS) == 0
+         || (single_entry->flags & EDGE_CROSSING) == 0))
     dummy = split_edge (single_entry);
   else
     {
index 30423e224b9623b382285508fe977f288fec5520..25cda5027acb42f722f0d9133584a56bc10ee648 100644 (file)
@@ -1,5 +1,8 @@
 2018-04-06  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/84872
+       * gcc.dg/graphite/pr84872.c: New test.
+
        PR c++/85210
        * g++.dg/cpp1z/decomp42.C: New test.
 
diff --git a/gcc/testsuite/gcc.dg/graphite/pr84872.c b/gcc/testsuite/gcc.dg/graphite/pr84872.c
new file mode 100644 (file)
index 0000000..4dcce96
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR rtl-optimization/84872 */
+/* { dg-do compile { target pthread } } */
+/* { dg-options "-O1 -floop-parallelize-all -freorder-blocks-and-partition -fschedule-insns2 -fselective-scheduling2 -fsel-sched-pipelining -fno-tree-dce" } */
+
+void
+foo (int x)
+{
+  int a[2];
+  int b, c = 0;
+
+  for (b = 0; b < 2; ++b)
+    a[b] = 0;
+  for (b = 0; b < 2; ++b)
+    a[b] = 0;
+
+  while (c < 1)
+    while (x < 1)
+      ++x;
+}