re PR tree-optimization/58228 (wrong code (with vectorization?) at -O3 on x86_64-linux-gnu)

2013-08-30  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/58228
	* tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not
	allow invariant loads in nested loop vectorization.

	* gcc.dg/torture/pr58228.c: New testcase.

From-SVN: r202097
This commit is contained in:
Richard Biener 2013-08-30 07:49:54 +00:00 committed by Richard Biener
parent 062ef2c8f9
commit 6e8dad054f
4 changed files with 34 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-08-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/58228
* tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not
allow invariant loads in nested loop vectorization.
2013-08-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/58223

View File

@ -1,3 +1,8 @@
2013-08-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/58228
* gcc.dg/torture/pr58228.c: New testcase.
2013-08-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/58223

View File

@ -0,0 +1,15 @@
/* { dg-do run } */
extern void abort (void);
int a[8][8] = {{1}};
int b, c, d, e;
int main ()
{
for (c = 0; c < 8; c++)
for (b = 0; b < 2; b++)
a[b + 4][c] = a[c][0];
if (a[4][4] != 1)
abort ();
return 0;
}

View File

@ -2271,10 +2271,17 @@ vect_analyze_data_ref_access (struct data_reference *dr)
return false;
}
/* Allow invariant loads in loops. */
/* Allow invariant loads in not nested loops. */
if (loop_vinfo && integer_zerop (step))
{
GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) = NULL;
if (nested_in_vect_loop_p (loop, stmt))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"zero step in inner loop of nest");
return false;
}
return DR_IS_READ (dr);
}