diff options
author | Richard Biener <rguenther@suse.de> | 2018-11-15 13:42:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-11-15 13:42:13 +0000 |
commit | 22692f3ce9d00eac18d5582de90dda5ae5c07c77 (patch) | |
tree | 5b45430049bf1f43c56112e905e467089f9e5027 /gcc/tree-vect-loop.c | |
parent | 3f5a0fdefbb4bd69547b7275da08f712b18a972e (diff) | |
download | gcc-22692f3ce9d00eac18d5582de90dda5ae5c07c77.zip gcc-22692f3ce9d00eac18d5582de90dda5ae5c07c77.tar.gz gcc-22692f3ce9d00eac18d5582de90dda5ae5c07c77.tar.bz2 |
re PR tree-optimization/88031 (ICE in vectorizable_reduction, at tree-vect-loop.c:6953)
2018-11-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/88031
* tree-vect-loop.c (vectorizable_reduction): Move check
for multiple types earlier so we get the expected dump.
Simplify calls to vectorizable_condition.
* tree-vect-stmts.h (vectorizable_condition): Update prototype.
* tree-vect-stmts.c (vectorizable_condition): Instead of
reduc_def and reduc_index take just a flag. Simplify
code-generation now that we can rely on the defs being set up.
(vectorizable_comparison): Remove unused argument.
* gcc.dg/pr88031.c: New testcase.
From-SVN: r266182
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index dac6bb8..f2d9d8a 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6491,14 +6491,24 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, double_reduc = true; } + vect_reduction_type reduction_type + = STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info); + if ((double_reduc || reduction_type != TREE_CODE_REDUCTION) + && ncopies > 1) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "multiple types in double reduction or condition " + "reduction.\n"); + return false; + } + if (code == COND_EXPR) { /* Only call during the analysis stage, otherwise we'll lose - STMT_VINFO_TYPE. We'll pass ops[0] as reduc_op, it's only - used as a flag during analysis. */ + STMT_VINFO_TYPE. */ if (!vec_stmt && !vectorizable_condition (stmt_info, gsi, NULL, - ops[0], 0, NULL, - cost_vec)) + true, NULL, cost_vec)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -6598,8 +6608,6 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, (and also the same tree-code) when generating the epilog code and when generating the code inside the loop. */ - vect_reduction_type reduction_type - = STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info); if (orig_stmt_info && (reduction_type == TREE_CODE_REDUCTION || reduction_type == FOLD_LEFT_REDUCTION)) @@ -6689,16 +6697,6 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, return false; } - if ((double_reduc || reduction_type != TREE_CODE_REDUCTION) - && ncopies > 1) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "multiple types in double reduction or condition " - "reduction.\n"); - return false; - } - /* For SLP reductions, see if there is a neutral value we can use. */ tree neutral_op = NULL_TREE; if (slp_node) @@ -6963,7 +6961,7 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, { gcc_assert (!slp_node); return vectorizable_condition (stmt_info, gsi, vec_stmt, - NULL, reduc_index, NULL, NULL); + true, NULL, NULL); } /* Create the destination vector */ @@ -6995,9 +6993,7 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, { gcc_assert (!slp_node); vectorizable_condition (stmt_info, gsi, vec_stmt, - PHI_RESULT (phis[0]->stmt), - reduc_index, NULL, NULL); - /* Multiple types are not supported for condition. */ + true, NULL, NULL); break; } if (code == LSHIFT_EXPR |