On Mon, May 21, 2012 at 3:59 PM, Jakub Jelinek <ja...@redhat.com> wrote: > Hi! > > On the following testcase we ICE, because op_def_stmt isn't inside > of the loop (phi is a degenerate phi referencing a phi result from before the > loop) and stmts outside of the loop don't have uid set (or it can contain > garbage). > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.7?
Ok. Thanks, Richard. > 2012-05-21 Jakub Jelinek <ja...@redhat.com> > > PR tree-optimization/53409 > * tree-vect-loop.c (vect_analyze_loop_operations): Don't check > vinfo_for_stmt (op_def_stmt) if op_def_stmt isn't inside loop. > > * gcc.c-torture/compile/pr53409.c: New test. > > --- gcc/tree-vect-loop.c.jj 2012-05-17 08:40:45.000000000 +0200 > +++ gcc/tree-vect-loop.c 2012-05-21 11:30:28.721333458 +0200 > @@ -1327,7 +1327,9 @@ vect_analyze_loop_operations (loop_vec_i > return false; > > op_def_stmt = SSA_NAME_DEF_STMT (phi_op); > - if (!op_def_stmt || !vinfo_for_stmt (op_def_stmt)) > + if (!op_def_stmt > + || !flow_bb_inside_loop_p (loop, gimple_bb > (op_def_stmt)) > + || !vinfo_for_stmt (op_def_stmt)) > return false; > > if (STMT_VINFO_RELEVANT (vinfo_for_stmt (op_def_stmt)) > --- gcc/testsuite/gcc.c-torture/compile/pr53409.c.jj 2012-05-21 > 11:33:23.621318856 +0200 > +++ gcc/testsuite/gcc.c-torture/compile/pr53409.c 2012-05-21 > 11:33:13.000000000 +0200 > @@ -0,0 +1,19 @@ > +/* PR tree-optimization/53409 */ > + > +int a, c, d, e, f; > +int b[0]; > + > +int > +main () > +{ > + if (f) > + e = 0; > + int g = d; > + for (c = 0; c <= 1; c++) > + { > + for (a = 0; a <= 1; a = (char) a + 1) > + b[c] = g; > + a = 0; > + } > + return 0; > +} > > Jakub