On Tue, Aug 28, 2018 at 12:24:06PM +0100, Richard Sandiford wrote:
> The point of this patch is to put pattern statements in the same
> vec_basic_block as the statements they replace, with the pattern
> statements for S coming between S and S's original predecessor.
> This removes the need to handle them specially in various places.

My preferred way to handle pattern stmts would be to do what we do in
tree-if-conversion, i.e. whenever creating first pattern stmt for certain
loop, duplicate that loop directly in the IL guarded with an ifn
and modify directly one copy of the loop (the one meant to be vectorized).
If we aren't cycling over multiple vectorization factors, that could be even
done directly on the tree-if-conversion created vector loop copy, otherwise
we'd need more.

For tree-if-conversion, we have:
  if (LOOP_VECTORIZED (num))
    loop;
  else
    loop; // scalar loop, to use if vectorization fails
so for multiple vfs we could have:
  if (LOOP_VECTORIZED (num))
    {
      if (LOOP_VECTORIZED (num, 8))
        loop; // if vf is 8
      else if (LOOP_VECTORIZED (num, 4))
        loop; // if vf is 4
      else
        loop; // otherwise
    }
  else
    loop; // scalar loop, to use if vectorization fails

        Jakub

Reply via email to