re PR tree-optimization/69328 (ice in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1379 with -O3)

gcc/

	PR tree-optimization/69328
	* tree-vect-stmts.c (vect_is_simple_cond): Check compared
	vectors have same number of elements.
	(vectorizable_condition): Fix masked version recognition.

gcc/testsuite/

	PR tree-optimization/69328
	* gcc.dg/pr69328.c: New test.

Co-Authored-By: Richard Biener <rguenther@suse.de>

From-SVN: r232608
This commit is contained in:
Ilya Enkovich 2016-01-20 12:37:01 +00:00 committed by Ilya Enkovich
parent eac437bf2c
commit 28b3301653
4 changed files with 36 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2016-01-20 Ilya Enkovich <enkovich.gnu@gmail.com>
Richard Biener <rguenther@suse.de>
PR tree-optimization/69328
* tree-vect-stmts.c (vect_is_simple_cond): Check compared
vectors have same number of elements.
(vectorizable_condition): Fix masked version recognition.
2016-01-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/69345

View File

@ -1,3 +1,8 @@
2016-01-20 Ilya Enkovich <enkovich.gnu@gmail.com>
PR tree-optimization/69328
* gcc.dg/pr69328.c: New test.
2016-01-20 Jeff Law <law@redhat.com>
PR target/25114

View File

@ -0,0 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-O3" } */
int a, b;
void fn1() {
int c;
char *d;
for (; a; ++a) {
int e, f;
e = d[a];
if (!e && f || !f && e)
++c;
}
if (c)
b = .499;
}

View File

@ -7445,6 +7445,10 @@ vect_is_simple_cond (tree cond, vec_info *vinfo, tree *comp_vectype)
&& TREE_CODE (rhs) != FIXED_CST)
return false;
if (vectype1 && vectype2
&& TYPE_VECTOR_SUBPARTS (vectype1) != TYPE_VECTOR_SUBPARTS (vectype2))
return false;
*comp_vectype = vectype1 ? vectype1 : vectype2;
return true;
}
@ -7548,13 +7552,9 @@ vectorizable_condition (gimple *stmt, gimple_stmt_iterator *gsi,
if (!vect_is_simple_use (else_clause, stmt_info->vinfo, &def_stmt, &dt))
return false;
if (VECTOR_BOOLEAN_TYPE_P (comp_vectype))
{
vec_cmp_type = comp_vectype;
masked = true;
}
else
vec_cmp_type = build_same_sized_truth_vector_type (comp_vectype);
masked = !COMPARISON_CLASS_P (cond_expr);
vec_cmp_type = build_same_sized_truth_vector_type (comp_vectype);
if (vec_cmp_type == NULL_TREE)
return false;