re PR tree-optimization/70138 (wrong code at -O3 on x86_64-linux-gnu)

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.

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

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r234086
This commit is contained in:
Richard Biener 2016-03-09 16:41:19 +00:00 committed by Richard Biener
parent 2c73b7640d
commit c9e336624a
5 changed files with 91 additions and 1 deletions

View 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

View 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

View file

@ -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;
}

View file

@ -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;
}

View 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,