re PR tree-optimization/64493 (ICE at -O3 on x86_64-linux-gnu)
authorRichard Biener <rguenther@suse.de>
Wed, 14 Jan 2015 08:32:18 +0000 (08:32 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 14 Jan 2015 08:32:18 +0000 (08:32 +0000)
2015-01-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/64493
PR tree-optimization/64495
* tree-vect-loop.c (vect_finalize_reduction): For double-reductions
assign the proper vectorized PHI to the inner loop exit PHIs.

* gcc.dg/vect/pr64493.c: New testcase.
* gcc.dg/vect/pr64495.c: Likewise.

From-SVN: r219579

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr64493.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr64495.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index 7a0a9a3b0963830f5e632c9e9146c9c9f2305bc8..853353878e253befae2f8eca5cf93a801d1eec8e 100644 (file)
@@ -1,3 +1,10 @@
+2015-01-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/64493
+       PR tree-optimization/64495
+       * tree-vect-loop.c (vect_finalize_reduction): For double-reductions
+       assign the proper vectorized PHI to the inner loop exit PHIs.
+
 2015-01-14  Joey Ye  <joey.ye@arm.com>
 
        * config/arm/arm.c (arm_compute_save_reg_mask):
index c07074bae8a45cc4076da1c65e22a7072b7681c3..00dc23f89d7b4553aca4f3b0fc731d882f9525ab 100644 (file)
@@ -1,3 +1,10 @@
+2015-01-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/64493
+       PR tree-optimization/64495
+       * gcc.dg/vect/pr64493.c: New testcase.
+       * gcc.dg/vect/pr64495.c: Likewise.
+
 2015-01-13  Martin Uecker <uecker@eecs.berkeley.edu>
 
        * gcc.dg/Warray-bounds-11.c: New test-case.
diff --git a/gcc/testsuite/gcc.dg/vect/pr64493.c b/gcc/testsuite/gcc.dg/vect/pr64493.c
new file mode 100644 (file)
index 0000000..a7dee4d
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+int a, b, c, d, e, f, g, h;
+
+int
+main ()
+{
+  check_vect ();
+
+  for (; a; a--)
+    for (d = 1; d <= 0; d++)
+      for (; d;)
+       if (h)
+         {
+           if (!g) __builtin_abort ();
+           if (!0) __builtin_abort ();
+         }
+
+  for (f = 4; f; f--)
+    {
+      for (b = 0; b < 2; b++)
+       c |= 1;
+      e |= c;
+    }
+
+  return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr64495.c b/gcc/testsuite/gcc.dg/vect/pr64495.c
new file mode 100644 (file)
index 0000000..aad8752
--- /dev/null
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+
+#include <assert.h>
+#include "tree-vect.h"
+
+int a, b, c, d, e, f, g, i, j;
+static int *h = &e;
+
+int
+main ()
+{
+  check_vect ();
+
+  for (; a;)
+    for (; g; g++)
+      for (; f; f++)
+       if (j)
+         {
+           assert(b); 
+           assert(0);
+         }
+  for (i = 24; i; i--)
+    {
+      for (c = 0; c < 6; c++)
+       d |= 1;
+      *h |= d;
+    }
+
+  if (e != 1) 
+    __builtin_abort (); 
+
+  return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 670fe9dacfd0984f2ca06f369822afdce3b5fc8a..fff55dffad0681b1cc89218354d18930428b1bea 100644 (file)
@@ -4580,7 +4580,10 @@ vect_finalize_reduction:
                            && !STMT_VINFO_LIVE_P (exit_phi_vinfo))
                           || double_reduc);
 
-              STMT_VINFO_VEC_STMT (exit_phi_vinfo) = epilog_stmt;
+             if (double_reduc)
+               STMT_VINFO_VEC_STMT (exit_phi_vinfo) = inner_phi;
+             else
+               STMT_VINFO_VEC_STMT (exit_phi_vinfo) = epilog_stmt;
               if (!double_reduc
                   || STMT_VINFO_DEF_TYPE (exit_phi_vinfo)
                       != vect_double_reduction_def)