This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [5/6] Insert pattern statements into vec_basic_blocks

On Wed, Aug 29, 2018 at 09:59:07AM +0100, Richard Sandiford wrote:
> Jakub Jelinek <> writes:
> > 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.
> I'd originally tried adding the pattern stmts to the gimple bb as well
> as the vec_basic_block, but the problem is that we create pattern stmts
> before duplicating the scalar loop for peeling.  So I think we'd need to
> copy the loop even for the single-size case, or arrange some other way of
> temporarily restoring the original code.

Sure, if tree-if-conversion doesn't copy the loop and for single-size case,
we'd need to do that copy (once per loop), if it already copied the loop,
there is already the scalar and for vectorization only loop.
With those copies you don't need to roll back anything, just ensure the
guarding internal fns fold to constants when the vectorization is over based
on if the loop was vectorized and with what vf, and cfg cleanup will do the
The vectorizer already has code to find the scalar loop in the
LOOP_VECTORIZED condition guarded else block.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]