re PR tree-optimization/56350 (ICE in vectorizable_reduction, at tree-vect-loop.c:4731)

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.

From-SVN: r196134
This commit is contained in:
Jakub Jelinek 2013-02-19 10:14:33 +01:00 committed by Jakub Jelinek
parent a475fd3dcb
commit 47cc28f568
4 changed files with 34 additions and 6 deletions

View File

@ -1,5 +1,10 @@
2013-02-19 Jakub Jelinek <jakub@redhat.com>
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.
PR tree-optimization/56381
* tree-ssa-pre.c (create_expression_by_pieces): Fix up last argument
to fold_build3.

View File

@ -1,5 +1,8 @@
2013-02-19 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/56350
* gcc.dg/pr56350.c: New test.
PR tree-optimization/56381
* g++.dg/opt/pr56381.C: New test.

View File

@ -0,0 +1,13 @@
/* PR tree-optimization/56350 */
/* { dg-do compile } */
/* { dg-options "-O -ftree-vectorize" } */
int a, b, c;
void
f (void)
{
for (; c; c++)
for (b = 0; b < 2; b++)
a /= 8;
}

View File

@ -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;