https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108785
Bug ID: 108785
Summary: nested cycle vectorization too restrictive
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
For the testcase in PR108782 we're rejecting to vectorize the nested cycle
because
if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"intermediate value used outside loop.\n");
return NULL;
}
but really all inner PHIs should be trivially vectorizable without
further restrictions. The only thing we need to do is detect double
reductions, that is, when there's an outer reduction feeding the inner
loop PHI.