[PATCH] D25517: [SLPVectorizer] Improved support of partial tree vectorization.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 11:26:31 PDT 2016

ABataev added a comment.

In https://reviews.llvm.org/D25517#568970, @avt77 wrote:

> Could you give some more comments about the suggested algorithm? Is it for reductions only?

Yes, it is for reductions. Previously, when the non-vectorizable node was found during horizontal reduction analysis, the whole vectorization process stopped without any further attempts for vectorization. Now I consider this node as a possible start for another possibly vectorizable instruction.
Also, patch does not require that the initial instruction is a binary operation. It scans all operands of the root instruction, trying to find all binops in the tree, which can be vectorized.
It allows to vectorize the ั‚ัƒั‡ะต code:

  int foo(int *a) {
    int res = 0;
    for (int i = 0; i < 4; ++i)
      res += a[i];
    return res * 42;

Currently SLP vectorizer is unable to vectorize it, but this patch allows to do it.


More information about the llvm-commits mailing list