re PR middle-end/68595 (ice in const_vector_mask_from_tree at expr.c:11455)

gcc/

	PR middle-end/68595
	* tree-vect-stmts.c (vect_init_vector): Cast boolean
	scalars to a proper value before building a vector.

gcc/testsuite/

	PR middle-end/68595
	* gcc.dg/pr68595.c: New test.

From-SVN: r231106
This commit is contained in:
Ilya Enkovich 2015-12-01 11:04:06 +00:00 committed by Ilya Enkovich
parent 4265bac79a
commit 5a308cf1c6
4 changed files with 43 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2015-12-01 Ilya Enkovich <enkovich.gnu@gmail.com>
PR middle-end/68595
* tree-vect-stmts.c (vect_init_vector): Cast boolean
scalars to a proper value before building a vector.
2015-12-01 Richard Sandiford <richard.sandiford@arm.com>
* genattrtab.c (check_attr_test): Take an attr_desc instead of

View file

@ -1,3 +1,8 @@
2015-12-01 Ilya Enkovich <enkovich.gnu@gmail.com>
PR middle-end/68595
* gcc.dg/pr68595.c: New test.
2015-12-01 Christian Bruel <christian.bruel@st.com>
* gcc.target/arm/ftest-armv6-thumb.c: Remove NEED_ARM_FEATURE_UNALIGNED.

View file

@ -0,0 +1,13 @@
/* { dg-do compile } */
/* { dg-options "-O3" } */
int a, b;
char c;
void fn1() {
b = 30;
for (; b <= 32; b++) {
c = -17;
for (; c <= 56; c++)
a -= 0 == (c || b);
}
}

View file

@ -1300,7 +1300,25 @@ vect_init_vector (gimple *stmt, tree val, tree type, gimple_stmt_iterator *gsi)
{
if (!types_compatible_p (TREE_TYPE (type), TREE_TYPE (val)))
{
if (CONSTANT_CLASS_P (val))
/* Scalar boolean value should be transformed into
all zeros or all ones value before building a vector. */
if (VECTOR_BOOLEAN_TYPE_P (type))
{
tree true_val = build_zero_cst (TREE_TYPE (type));
tree false_val = build_all_ones_cst (TREE_TYPE (type));
if (CONSTANT_CLASS_P (val))
val = integer_zerop (val) ? false_val : true_val;
else
{
new_temp = make_ssa_name (TREE_TYPE (type));
init_stmt = gimple_build_assign (new_temp, COND_EXPR,
val, true_val, false_val);
vect_init_vector_1 (stmt, init_stmt, gsi);
val = new_temp;
}
}
else if (CONSTANT_CLASS_P (val))
val = fold_convert (TREE_TYPE (type), val);
else
{