]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/59519 (ICE on valid code at -O3 on x86_64-linux-gnu in slpeel...
authorJakub Jelinek <jakub@redhat.com>
Sat, 4 Jan 2014 11:23:16 +0000 (12:23 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 4 Jan 2014 11:23:16 +0000 (12:23 +0100)
PR tree-optimization/59519
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1): Don't
ICE if get_current_def (current_new_name) is already non-NULL, as long
as it is a phi result of some other phi in *new_exit_bb that has
the same argument.

* gcc.dg/vect/pr59519-1.c: New test.
* gcc.dg/vect/pr59519-2.c: New test.

From-SVN: r206333

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr59519-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr59519-2.c [new file with mode: 0644]
gcc/tree-vect-loop-manip.c

index caae1f6f473acfdf6277ddab9d494bc239e7b6b0..9ce39739045a20984f150b55b0ec34f00ae98ccf 100644 (file)
@@ -1,5 +1,11 @@
 2014-01-04  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/59519
+       * tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1): Don't
+       ICE if get_current_def (current_new_name) is already non-NULL, as long
+       as it is a phi result of some other phi in *new_exit_bb that has
+       the same argument.
+
        * config/i386/sse.md (avx512f_load<mode>_mask): Emit vmovup{s,d}
        or vmovdqu* for misaligned_operand.
        (<sse>_loadu<ssemodesuffix><avxsizesuffix><mask_name>,
index 267bcc0c7c603e9fd2f2b101247a3d8817fdbd69..395607aa307752b77362446d960e0b31d07d0e19 100644 (file)
@@ -1,5 +1,9 @@
 2014-01-04  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/59519
+       * gcc.dg/vect/pr59519-1.c: New test.
+       * gcc.dg/vect/pr59519-2.c: New test.
+
        * gcc.target/i386/avx512f-vmovdqu32-1.c: Allow vmovdqu64 instead of
        vmovdqu32.
 
diff --git a/gcc/testsuite/gcc.dg/vect/pr59519-1.c b/gcc/testsuite/gcc.dg/vect/pr59519-1.c
new file mode 100644 (file)
index 0000000..428d4ec
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR tree-optimization/59519 */
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+int a, b, c, d;
+
+void
+foo (void)
+{
+  for (; d; d++)
+    for (b = 0; b < 14; b++)
+      {
+       c |= 1;
+       if (a)
+         break;
+      }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr59519-2.c b/gcc/testsuite/gcc.dg/vect/pr59519-2.c
new file mode 100644 (file)
index 0000000..2b109d2
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR tree-optimization/59519 */
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+struct S { int f0; } d;
+int a[8] = { 0 }, b, c, e;
+
+void
+foo (void)
+{
+  for (; e < 1; e++)
+    for (b = 0; b < 7; b++)
+      {
+       c |= (a[b + 1] != 0);
+       if (d.f0)
+         break;
+      }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index e8dbf4daf468d5a1c411822c288bd1189ba4204e..f68626171d147db29722f356cbb768574445be00 100644 (file)
@@ -483,7 +483,18 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
          if (!current_new_name)
            continue;
         }
-      gcc_assert (get_current_def (current_new_name) == NULL_TREE);
+      tree new_name = get_current_def (current_new_name);
+      /* Because of peeled_chrec optimization it is possible that we have
+        set this earlier.  Verify the PHI has the same value.  */
+      if (new_name)
+       {
+         gimple phi = SSA_NAME_DEF_STMT (new_name);
+         gcc_assert (gimple_code (phi) == GIMPLE_PHI
+                     && gimple_bb (phi) == *new_exit_bb
+                     && (PHI_ARG_DEF_FROM_EDGE (phi, single_exit (loop))
+                         == loop_arg));
+         continue;
+       }
 
       set_current_def (current_new_name, PHI_RESULT (new_phi));
     }