aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-01-27 14:54:03 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-01-27 14:54:03 +0000
commit167c7bfa499967104ff514075c581a58d4ac240b (patch)
tree09ba81f79679354fa63f7baab396d5491db9948a /gcc/tree-vect-loop.c
parent1430fb1f563dd7434b262d1b1378d9954d13dc0c (diff)
downloadgcc-167c7bfa499967104ff514075c581a58d4ac240b.zip
gcc-167c7bfa499967104ff514075c581a58d4ac240b.tar.gz
gcc-167c7bfa499967104ff514075c581a58d4ac240b.tar.bz2
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
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 6034672..b8303ad 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2750,17 +2750,17 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
&& SSA_NAME_DEF_STMT (op1) == phi)
code = PLUS_EXPR;
- if (check_reduction)
+ if (code == COND_EXPR)
{
- if (code == COND_EXPR)
+ if (check_reduction)
*v_reduc_type = COND_REDUCTION;
- else if (!commutative_tree_code (code) || !associative_tree_code (code))
- {
- if (dump_enabled_p ())
- report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt,
- "reduction: not commutative/associative: ");
- return NULL;
- }
+ }
+ else if (!commutative_tree_code (code) || !associative_tree_code (code))
+ {
+ if (dump_enabled_p ())
+ report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt,
+ "reduction: not commutative/associative: ");
+ return NULL;
}
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
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? */
- if (SCALAR_FLOAT_TYPE_P (type) && !flag_associative_math
- && check_reduction)
+ if (SCALAR_FLOAT_TYPE_P (type) && !flag_associative_math)
{
/* Changing the order of operations changes the semantics. */
if (dump_enabled_p ())
@@ -2868,7 +2868,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
"reduction: unsafe fp math optimization: ");
return NULL;
}
- else if (INTEGRAL_TYPE_P (type) && check_reduction)
+ else if (INTEGRAL_TYPE_P (type))
{
if (!operation_no_trapping_overflow (type, code))
{
@@ -2891,7 +2891,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
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. */
if (dump_enabled_p ())