re PR tree-optimization/87022 (miscompilation with -ftree-loop-distribution)

PR tree-optimization/87022
	* tree-loop-distribution.c (pg_add_dependence_edges): Check all
	bits in dist vector rather than the first one.
	
	gcc/testsuite
	PR tree-optimization/87022
	* gcc.dg/tree-ssa/pr87022.c: New test.

From-SVN: r265161
This commit is contained in:
Bin Cheng 2018-10-15 11:35:56 +00:00 committed by Bin Cheng
parent 61e189a874
commit 0df7c778ed
4 changed files with 49 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-10-15 Bin Cheng <bin.cheng@linux.alibaba.com>
PR tree-optimization/87022
* tree-loop-distribution.c (pg_add_dependence_edges): Check all
bits in dist vector rather than the first one.
2018-10-15 Richard Biener <rguenther@suse.de>
PR middle-end/87610

View File

@ -1,3 +1,8 @@
2018-10-15 Bin Cheng <bin.cheng@linux.alibaba.com>
PR tree-optimization/87022
* gcc.dg/tree-ssa/pr87022.c: New test.
2018-10-15 Richard Biener <rguenther@suse.de>
PR middle-end/87610

View File

@ -0,0 +1,36 @@
/* { dg-do run } */
/* { dg-options "-O3" } */
void abort();
char a[7];
char b[10][7];
char r[10][7] = { {0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0},
{0,0,1,1,1,1,1},
{0,0,1,1,1,1,1},
{0,0,1,1,1,1,1}};
short c;
int d, e, f, g;
int main() {
for (; d <= 4; d++) {
e = 0;
for (; e <= 6; e++) {
if (a[c])
b[e + 3][d + 2] = 1;
a[0] = 5;
b[e][d + 2] = 0;
}
}
for (; f < 10; f++) {
g = 0;
for (; g < 7; g++)
if (b[f][g] != r[f][g])
abort ();
}
return 0;
}

View File

@ -1921,7 +1921,8 @@ pg_add_dependence_edges (struct graph *rdg, int dir,
if (DDR_NUM_DIST_VECTS (ddr) != 1)
this_dir = 2;
/* If the overlap is exact preserve stmt order. */
else if (lambda_vector_zerop (DDR_DIST_VECT (ddr, 0), 1))
else if (lambda_vector_zerop (DDR_DIST_VECT (ddr, 0),
DDR_NB_LOOPS (ddr)))
;
/* Else as the distance vector is lexicographic positive swap
the dependence direction. */