re PR tree-optimization/41956 (Segfault in vectorizer)

PR tree-optimization/41956
	* tree-vect-analyze.c (vect_supported_load_permutation_p): Add check
	that the load indices differ.

From-SVN: r155614
This commit is contained in:
Ira Rosen 2010-01-04 12:45:46 +00:00 committed by Ira Rosen
parent dcf553531f
commit deca952548
4 changed files with 39 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2010-01-04 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/41956
* tree-vect-analyze.c (vect_supported_load_permutation_p): Add check
that the load indices differ.
2010-01-02 Richard Guenther <rguenther@suse.de>
Backport from mainline

View File

@ -1,3 +1,8 @@
2010-01-04 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/41956
* gcc.dg/vect/pr41956.c: New test.
2010-01-02 Richard Guenther <rguenther@suse.de>
Backport from mainline

View File

@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
void K (int *gpwgts, int *badminpwgt, int *badmaxpwgt)
{
int i;
for (i = 0; i < 10; i += 2) {
badminpwgt[i] = badminpwgt[i+1] = gpwgts[i]+gpwgts[i];
badmaxpwgt[i] = badmaxpwgt[i+1] = gpwgts[i]+gpwgts[i];
}
}
/* { dg-final { cleanup-tree-dump "vect" } } */

View File

@ -3213,6 +3213,7 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
{
int i = 0, j, prev = -1, next, k;
bool supported;
sbitmap load_index;
/* FORNOW: permutations are only supported for loop-aware SLP. */
if (!slp_instn)
@ -3233,6 +3234,8 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
return false;
supported = true;
load_index = sbitmap_alloc (group_size);
sbitmap_zero (load_index);
for (j = 0; j < group_size; j++)
{
for (i = j * group_size, k = 0;
@ -3246,9 +3249,19 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
}
prev = next;
}
}
if (TEST_BIT (load_index, prev))
{
supported = false;
break;
}
SET_BIT (load_index, prev);
}
sbitmap_free (load_index);
if (supported && i == group_size * group_size
&& vect_supported_slp_permutation_p (slp_instn))
return true;