diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-02-19 09:14:33 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2013-02-19 09:14:33 +0000 |
commit | b8aacbeb5a68f3b10ea5093649aee6b5711eec39 (patch) | |
tree | 686b8fed7c73913c1f14dac6b8015d579d29103e /gcc/tree-vect-loop.c | |
parent | b309cbc7cde86748d01d3905053e3ce066760f19 (diff) |
PR tree-optimization/56350
* tree-vect-loop.c (vectorizable_reduction): If orig_stmt, return false
if haven't found reduction or nested cycle operand, rather than
asserting we must find it.
* gcc.dg/pr56350.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@196134 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index a2f90138fc9..3693cd27a96 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -4707,7 +4707,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, The last use is the reduction variable. In case of nested cycle this assumption is not true: we use reduc_index to record the index of the reduction variable. */ - for (i = 0; i < op_type-1; i++) + for (i = 0; i < op_type - 1; i++) { /* The condition of COND_EXPR is checked in vectorizable_condition(). */ if (i == 0 && code == COND_EXPR) @@ -4739,11 +4739,18 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, if (!vectype_in) vectype_in = tem; gcc_assert (is_simple_use); - gcc_assert (dt == vect_reduction_def - || dt == vect_nested_cycle - || ((dt == vect_internal_def || dt == vect_external_def - || dt == vect_constant_def || dt == vect_induction_def) - && nested_cycle && found_nested_cycle_def)); + if (!(dt == vect_reduction_def + || dt == vect_nested_cycle + || ((dt == vect_internal_def || dt == vect_external_def + || dt == vect_constant_def || dt == vect_induction_def) + && nested_cycle && found_nested_cycle_def))) + { + /* For pattern recognized stmts, orig_stmt might be a reduction, + but some helper statements for the pattern might not, or + might be COND_EXPRs with reduction uses in the condition. */ + gcc_assert (orig_stmt); + return false; + } if (!found_nested_cycle_def) reduc_def_stmt = def_stmt; |