re PR tree-optimization/68906 (ICE at -O3 on x86_64-linux-gnu: verify_ssa failed)
authorYuri Rumyantsev <ysrumyan@gmail.com>
Fri, 18 Dec 2015 10:16:56 +0000 (10:16 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Fri, 18 Dec 2015 10:16:56 +0000 (10:16 +0000)
gcc/

2015-12-18  Yuri Rumyantsev  <ysrumyan@gmail.com>

PR tree-optimization/68906
* tree-ssa-loop-unswitch.c (tree_unswitch_outer_loop): Add check
that an exit block belongs to LOOP.

gcc/testsuite/

2015-12-18  Yuri Rumyantsev  <ysrumyan@gmail.com>

PR tree-optimization/68906
* gcc.dg/torture/pr68906.c: New test.

From-SVN: r231812

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr68906.c [new file with mode: 0644]
gcc/tree-ssa-loop-unswitch.c

index 32a94eb7c32efccbe8f1e7afec99fe63a38cb896..aab0e3abb3d24469eacf0331d4d9d5970ca322a4 100644 (file)
@@ -1,3 +1,9 @@
+2015-12-18  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       PR tree-optimization/68906
+       * tree-ssa-loop-unswitch.c (tree_unswitch_outer_loop): Add check
+       that an exit block belongs to LOOP.
+
 2015-12-18  Ilya Enkovich  <enkovich.gnu@gmail.com>
 
        PR tree-optimization/68956
index 6120ed1b2f3015cad583d23dd61dfabc756d8214..eee043417098275b86054cb41122b21a02cef9ab 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-18  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       PR tree-optimization/68906
+       * gcc.dg/torture/pr68906.c: New test.
+
 2015-12-18  Ilya Enkovich  <enkovich.gnu@gmail.com>
 
        PR tree-optimization/68956
diff --git a/gcc/testsuite/gcc.dg/torture/pr68906.c b/gcc/testsuite/gcc.dg/torture/pr68906.c
new file mode 100644 (file)
index 0000000..8c89bbd
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a;
+volatile int b;
+short c, d;
+int
+fn1 ()
+{
+  int e;
+  for (;;)
+    {
+      a = 3;
+      if (c)
+       continue;
+      e = 0;
+      for (; e > -30; e--)
+       if (b)
+         {
+           int f = e;
+           return d;
+         }
+    }
+}
index c340bcb2c041b8c0ae7f50e584e059221d6b0c1e..a17c60e927c017d7ecd5056bc15cd26b10859722 100644 (file)
@@ -429,9 +429,9 @@ tree_unswitch_outer_loop (struct loop *loop)
   gcc_assert (loop->inner);
   if (loop->inner->next)
     return false;
-  /* Accept loops with single exit only.  */
+  /* Accept loops with single exit only which is not from inner loop.  */
   exit = single_exit (loop);
-  if (!exit)
+  if (!exit || exit->src->loop_father != loop)
     return false;
   /* Check that phi argument of exit edge is not defined inside loop.  */
   if (!check_exit_phi (loop))