On Tue, 29 Oct 2019, Bernhard Reutner-Fischer wrote: > On Mon, 28 Oct 2019 14:55:37 +0100 (CET) > Richard Biener <rguent...@suse.de> wrote: > > > Index: gcc/tree-vect-loop.c > > =================================================================== > > --- gcc/tree-vect-loop.c (revision 277517) > > +++ gcc/tree-vect-loop.c (working copy) > > > @@ -2690,6 +2689,20 @@ pop: > > fail = true; > > break; > > } > > + /* Check there's only a single stmt the op is used on inside > > + of the loop. */ > > + imm_use_iterator imm_iter; > > + gimple *op_use_stmt; > > + unsigned cnt = 0; > > + FOR_EACH_IMM_USE_STMT (op_use_stmt, imm_iter, op) > > + if (!is_gimple_debug (op_use_stmt) > > + && flow_bb_inside_loop_p (loop, gimple_bb (op_use_stmt))) > > + cnt++; > > + if (cnt != 1) > > + { > > + fail = true; > > + break; > > + } > > cosmetics, but it seems you could maybe BREAK_FROM_IMM_USE_STMT. > Maybe even the clumsy > use_operand_p use_p; > FOR_EACH_IMM_USE_FAST (use_p, imm_iter, op) > { > op_use_stmt = USE_STMT (use_p); > if (!is_gimple_debug (op_use_stmt) > && flow_bb_inside_loop_p (loop, gimple_bb (op_use_stmt))) > fail = true; > break; > } > if (fail) > break;
Unfortunately it's not semantically equivalent ;) I could indeed break once cnt reaches 2 but not sure if it's worth the ugliness ;) > btw, it seems there are two typos in the docs. BREAK_FROM_SAFE_IMM_USE > was removed 2006-04-27, and "iter" should be "iterator": > > diff --git a/gcc/doc/tree-ssa.texi b/gcc/doc/tree-ssa.texi > index 9baabf99440..97a7b8e0263 100644 > --- a/gcc/doc/tree-ssa.texi > +++ b/gcc/doc/tree-ssa.texi > @@ -392,7 +392,7 @@ to do this : > FOR_EACH_IMM_USE_STMT (stmt, iterator, ssa_var) > @{ > if (stmt == last_stmt) > - BREAK_FROM_SAFE_IMM_USE (iter); > + BREAK_FROM_IMM_USE_STMT (iterator); > > FOR_EACH_IMM_USE_ON_STMT (imm_use_p, iterator) > SET_USE (imm_use_p, ssa_var_2); > That change is OK as obvious if you want to fix it ;) > > enum tree_code use_code = gimple_assign_rhs_code (use_stmt); > > s/enum tree_code/tree_code/g Ah, yeah - still coding C ... Thanks, Richard.