From: Ira Rosen Date: Mon, 1 Aug 2011 16:58:20 +0000 (+0000) Subject: re PR tree-optimization/49926 (ice in process_use, at tree-vect-stmts.c:405) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=67f2d54f56cf4e978cf8e2d78330da7948f99591;p=gcc.git re PR tree-optimization/49926 (ice in process_use, at tree-vect-stmts.c:405) PR tree-optimization/49926 * tree-vect-loop.c (vect_is_slp_reduction): Check that a statement in a chain doesn't have uses both inside and outside the loop. From-SVN: r177063 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 573f740f164..1b5e6de57cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-08-01 Ira Rosen + + PR tree-optimization/49926 + * tree-vect-loop.c (vect_is_slp_reduction): Check that a statement + in a chain doesn't have uses both inside and outside the loop. + 2011-08-01 Georg-Johann Lay * config/avr/avr.h (mcu_type_s): Add errata_skip field. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 480eea6ac1c..b1a31221b78 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-08-01 Ira Rosen + + PR tree-optimization/49926 + * gcc.dg/vect/pr49926.c: New test. + 2011-08-01 Kirill Yukhin * gcc.target/i386/i386.exp (check_effective_target_lzcnt): New. diff --git a/gcc/testsuite/gcc.dg/vect/pr49926.c b/gcc/testsuite/gcc.dg/vect/pr49926.c new file mode 100644 index 00000000000..60968173469 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr49926.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +int a, b, c[10]; + +void +foo (unsigned int x, int y, int z, int *w) +{ + do + { + *w = z; + y = x; + if (y) + for (b = -4; b; b++) + { + z = y &= a &= 1; + y &= c[b + 4]; + } + } + while (1); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 63b346979af..505a41acb03 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1730,7 +1730,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt) tree lhs; imm_use_iterator imm_iter; use_operand_p use_p; - int nloop_uses, size = 0; + int nloop_uses, size = 0, n_out_of_loop_uses; bool found = false; if (loop != vect_loop) @@ -1741,6 +1741,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt) while (1) { nloop_uses = 0; + n_out_of_loop_uses = 0; FOR_EACH_IMM_USE_FAST (use_p, imm_iter, lhs) { gimple use_stmt = USE_STMT (use_p); @@ -1757,16 +1758,22 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt) break; } - if (flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)) - && vinfo_for_stmt (use_stmt) - && !STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (use_stmt))) - { - loop_use_stmt = use_stmt; - nloop_uses++; - } + if (flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) + { + if (vinfo_for_stmt (use_stmt) + && !STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (use_stmt))) + { + loop_use_stmt = use_stmt; + nloop_uses++; + } + } + else + n_out_of_loop_uses++; - if (nloop_uses > 1) - return false; + /* There are can be either a single use in the loop or two uses in + phi nodes. */ + if (nloop_uses > 1 || (n_out_of_loop_uses && nloop_uses)) + return false; } if (found)