re PR tree-optimization/68060 (ICE on valid code at -O3 on x86_64-linux-gnu in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1413)

2016-01-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/68060
	* tree-vect-loop.c (vect_is_simple_reduction): Check the
	outer loop reduction is only used in the inner loop before
	detecting a double reduction.

	* gcc.dg/torture/pr68060-1.c: New testcase.
	* gcc.dg/torture/pr68060-2.c: Likewise.

From-SVN: r232367
This commit is contained in:
Richard Biener 2016-01-14 15:13:19 +00:00 committed by Richard Biener
parent a2ae4661ab
commit 3688e13db3
5 changed files with 54 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2016-01-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/68060
* tree-vect-loop.c (vect_is_simple_reduction): Check the
outer loop reduction is only used in the inner loop before
detecting a double reduction.
2016-01-14 Jakub Jelinek <jakub@redhat.com>
PR target/68269

View File

@ -1,3 +1,9 @@
2016-01-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/68060
* gcc.dg/torture/pr68060-1.c: New testcase.
* gcc.dg/torture/pr68060-2.c: Likewise.
2016-01-14 Nick Clifton <nickc@redhat.com>
* lib/target-supports.exp

View File

@ -0,0 +1,16 @@
/* { dg-do compile } */
int a, b, c;
int
main ()
{
for (; c; c++)
for (a = 0; a < 4; a++)
{
c &= 5;
for (b = 0; b < 2; b++)
c |= 1;
}
return 0;
}

View File

@ -0,0 +1,20 @@
/* { dg-do compile } */
void fn2 ();
int a, b, c;
void fn1()
{
for (;;) {
int *d;
fn2();
c = 0;
for (; c <= 3; c++) {
*d ^= 9;
b = 0;
for (; b <= 3; b++)
*d ^= a;
}
}
}

View File

@ -2591,7 +2591,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
struct loop *vect_loop = LOOP_VINFO_LOOP (loop_info);
edge latch_e = loop_latch_edge (loop);
tree loop_arg = PHI_ARG_DEF_FROM_EDGE (phi, latch_e);
gimple *def_stmt, *def1 = NULL, *def2 = NULL;
gimple *def_stmt, *def1 = NULL, *def2 = NULL, *phi_use_stmt = NULL;
enum tree_code orig_code, code;
tree op1, op2, op3 = NULL_TREE, op4 = NULL_TREE;
tree type;
@ -2640,6 +2640,8 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
"reduction used in loop.\n");
return NULL;
}
phi_use_stmt = use_stmt;
}
if (TREE_CODE (loop_arg) != SSA_NAME)
@ -2722,7 +2724,8 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
&& flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))
&& loop->inner
&& flow_bb_inside_loop_p (loop->inner, gimple_bb (def1))
&& is_gimple_assign (def1))
&& is_gimple_assign (def1)
&& flow_bb_inside_loop_p (loop->inner, gimple_bb (phi_use_stmt)))
{
if (dump_enabled_p ())
report_vect_op (MSG_NOTE, def_stmt,