mirror of git://gcc.gnu.org/git/gcc.git
re PR tree-optimization/69166 (ICE in get_initial_def_for_reduction, at tree-vect-loop.c:4188)
2016-01-27 Richard Biener <rguenther@suse.de> PR tree-optimization/69166 * tree-vect-loop.c (vect_is_simple_reduction): Always check reduction code for commutativity / associativity. * gcc.dg/torture/pr69166.c: New testcase. From-SVN: r232878
This commit is contained in:
parent
1430fb1f56
commit
167c7bfa49
|
|
@ -1,3 +1,9 @@
|
||||||
|
2016-01-27 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/69166
|
||||||
|
* tree-vect-loop.c (vect_is_simple_reduction): Always check
|
||||||
|
reduction code for commutativity / associativity.
|
||||||
|
|
||||||
2016-01-27 Martin Jambor <mjambor@suse.cz>
|
2016-01-27 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
PR tree-optimization/69355
|
PR tree-optimization/69355
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2016-01-27 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/69166
|
||||||
|
* gcc.dg/torture/pr69166.c: New testcase.
|
||||||
|
|
||||||
2016-01-27 Martin Jambor <mjambor@suse.cz>
|
2016-01-27 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
PR tree-optimization/69355
|
PR tree-optimization/69355
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
|
||||||
|
void fn2(double *e, double a)
|
||||||
|
{
|
||||||
|
int b = 0;
|
||||||
|
for (; b < 256; b++)
|
||||||
|
{
|
||||||
|
int c = 0;
|
||||||
|
double x = e[b];
|
||||||
|
for (; c < 256; ++c)
|
||||||
|
x /= a;
|
||||||
|
e[b] = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2750,10 +2750,11 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
&& SSA_NAME_DEF_STMT (op1) == phi)
|
&& SSA_NAME_DEF_STMT (op1) == phi)
|
||||||
code = PLUS_EXPR;
|
code = PLUS_EXPR;
|
||||||
|
|
||||||
if (check_reduction)
|
|
||||||
{
|
|
||||||
if (code == COND_EXPR)
|
if (code == COND_EXPR)
|
||||||
|
{
|
||||||
|
if (check_reduction)
|
||||||
*v_reduc_type = COND_REDUCTION;
|
*v_reduc_type = COND_REDUCTION;
|
||||||
|
}
|
||||||
else if (!commutative_tree_code (code) || !associative_tree_code (code))
|
else if (!commutative_tree_code (code) || !associative_tree_code (code))
|
||||||
{
|
{
|
||||||
if (dump_enabled_p ())
|
if (dump_enabled_p ())
|
||||||
|
|
@ -2761,7 +2762,6 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
"reduction: not commutative/associative: ");
|
"reduction: not commutative/associative: ");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (get_gimple_rhs_class (code) != GIMPLE_BINARY_RHS)
|
if (get_gimple_rhs_class (code) != GIMPLE_BINARY_RHS)
|
||||||
{
|
{
|
||||||
|
|
@ -2856,11 +2856,11 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
and therefore vectorizing reductions in the inner-loop during
|
and therefore vectorizing reductions in the inner-loop during
|
||||||
outer-loop vectorization is safe. */
|
outer-loop vectorization is safe. */
|
||||||
|
|
||||||
if (*v_reduc_type != COND_REDUCTION)
|
if (*v_reduc_type != COND_REDUCTION
|
||||||
|
&& check_reduction)
|
||||||
{
|
{
|
||||||
/* CHECKME: check for !flag_finite_math_only too? */
|
/* CHECKME: check for !flag_finite_math_only too? */
|
||||||
if (SCALAR_FLOAT_TYPE_P (type) && !flag_associative_math
|
if (SCALAR_FLOAT_TYPE_P (type) && !flag_associative_math)
|
||||||
&& check_reduction)
|
|
||||||
{
|
{
|
||||||
/* Changing the order of operations changes the semantics. */
|
/* Changing the order of operations changes the semantics. */
|
||||||
if (dump_enabled_p ())
|
if (dump_enabled_p ())
|
||||||
|
|
@ -2868,7 +2868,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
"reduction: unsafe fp math optimization: ");
|
"reduction: unsafe fp math optimization: ");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (INTEGRAL_TYPE_P (type) && check_reduction)
|
else if (INTEGRAL_TYPE_P (type))
|
||||||
{
|
{
|
||||||
if (!operation_no_trapping_overflow (type, code))
|
if (!operation_no_trapping_overflow (type, code))
|
||||||
{
|
{
|
||||||
|
|
@ -2891,7 +2891,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (SAT_FIXED_POINT_TYPE_P (type) && check_reduction)
|
else if (SAT_FIXED_POINT_TYPE_P (type))
|
||||||
{
|
{
|
||||||
/* Changing the order of operations changes the semantics. */
|
/* Changing the order of operations changes the semantics. */
|
||||||
if (dump_enabled_p ())
|
if (dump_enabled_p ())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue