diff options
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr70138-1.c | 40 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr70138-2.c | 35 | ||||
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 3 |
5 files changed, 91 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c99bf6415b2..e0e9ad17e8e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 131ed75c624..b95a863aa31 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 00000000000..bd4d006abf6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr70138-1.c @@ -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 index 00000000000..b1f973781aa --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr70138-2.c @@ -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; +} diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index f8a44b53217..7ec6daec0e6 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -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, |