[llvm-dev] Extending SLP Vectorizer to deal with aggregates?

Renato Golin via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 14 09:30:35 PDT 2015


On 14 October 2015 at 16:40, Robison, Arch via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> 1. Identify stores of arrays.  E.g. “store [4 x float]”.
>
> 2. Walk chains backwards from the array stores, similar to the way
> SLPVectorizer already walks chains.
>
> 3. If vectorization is applicable, replace array construction/load/store
> with vector construction/load/store.  Vector load/stores will be unaligned.

I like this idea, too. But unaligned access may need to be constrained
for the targets that support it. Not a big deal.

Another potential problem is the cost model. Right now, it's tuned to
make scalar vs vector loads and shuffles be "sensible", but array
patterns are slightly different. With luck, you can add gep costs to
balance individual allocas.

That IR you sent could be reduced to a few vector loads, one mul-add,
one vector store. :)

IIRC, AVX has the indirect shuffle, so this could even reduce the
number of loads.

Seems like a good candidate for vectorizing!

cheers,
-renato


More information about the llvm-dev mailing list