]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2016-03-09 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Mar 2016 16:41:19 +0000 (16:41 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Mar 2016 16:41:19 +0000 (16:41 +0000)
Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/70138
* tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer):
Also skip vect_double_reduction_def.

* gcc.dg/vect/pr70138-1.c: New testcase.
* gcc.dg/vect/pr70138-2.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234086 138bc75d-0d04-0410-961f-82ee72b054a4

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

index c99bf6415b24e8c0129e011e55b677a8f185d95f..e0e9ad17e8e55015be76c5d672a75da962a2e058 100644 (file)
@@ -1,3 +1,10 @@
+2016-03-09  Richard Biener  <rguenther@suse.de>
+       Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/70138
+       * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer):
+       Also skip vect_double_reduction_def.
+
 2016-03-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/70049
index 131ed75c624e7fb0132aa6a857aaafc3cbca6840..b95a863aa3149f4788b1811d365b2b240ee655f4 100644 (file)
@@ -1,3 +1,10 @@
+2016-03-09  Richard Biener  <rguenther@suse.de>
+       Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/70138
+       * gcc.dg/vect/pr70138-1.c: New testcase.
+       * gcc.dg/vect/pr70138-2.c: Likewise.
+
 2016-03-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/70049
diff --git a/gcc/testsuite/gcc.dg/vect/pr70138-1.c b/gcc/testsuite/gcc.dg/vect/pr70138-1.c
new file mode 100644 (file)
index 0000000..bd4d006
--- /dev/null
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+double u[33 * 33];
+
+__attribute__((noinline, noclone)) static void
+foo (int *x)
+{
+  double c = 0.0;
+  int a, b;
+  for (a = 0; a < 33; a++)
+    {
+      for (b = 0; b < 33; b++)
+       c = c + u[34 * a];
+      u[34 * a] *= 2.0;
+    }
+  *x = c;
+}
+
+int
+main ()
+{
+  int d, e;
+  check_vect ();
+  for (d = 0; d < 33 * 33; d++)
+    {
+      u[d] = 499.0;
+      __asm__ volatile ("" : : : "memory");
+    }
+  for (d = 0; d < 33; d++)
+    {
+      u[d * 34] = (d + 2);
+      __asm__ volatile ("" : : : "memory");
+    }
+  foo (&e);
+  if (e != 33 * (2 + 34) / 2 * 33)
+    __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr70138-2.c b/gcc/testsuite/gcc.dg/vect/pr70138-2.c
new file mode 100644 (file)
index 0000000..b1f9737
--- /dev/null
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+double u[33];
+
+__attribute__((noinline, noclone)) static void
+foo (int *x)
+{
+  double c = 0.0;
+  int a, b;
+  for (a = 0; a < 33; a++)
+    {
+      for (b = 0; b < 33; b++)
+       c = c + u[a];
+      u[a] *= 2.0;
+    }
+  *x = c;
+}
+
+int
+main ()
+{
+  int d, e;
+  check_vect ();
+  for (d = 0; d < 33; d++)
+    {
+      u[d] = (d + 2);
+      __asm__ volatile ("" : : : "memory");
+    }
+  foo (&e);
+  if (e != 33 * (2 + 34) / 2 * 33)
+    __builtin_abort ();
+  return 0;
+}
index f8a44b53217b18b367abac7472a17e42a941304b..7ec6daec0e60e955e877db9d2409a3f99ab19269 100644 (file)
@@ -1692,7 +1692,8 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
 
       /* Skip reduction phis.  */
       stmt_info = vinfo_for_stmt (phi);
-      if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
+      if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def
+         || STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def)
         {
          if (dump_enabled_p ())
            dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,