[PATCH] D132590: [SLP] Try to match reductions first in a vector build sequence.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 10:25:34 PDT 2022


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:11948-11952
+    SmallVector<Value *, 16> BuildVectorOpds;
+    SmallVector<Value *, 16> BuildVectorInsts;
+    if (!findBuildAggregate(I, TTI, BuildVectorOpds, BuildVectorInsts))
+      continue;
+
----------------
vdmitrie wrote:
> ABataev wrote:
> > I think you're doing it too early, need to do it after the vectorizeHorReduction, which should start with I, otherwise we may miss single insertelement instruction which has reduction.
> You probably meant to make another call to vectorizeHorReduction if we did not match a vector build. I'll try to reproduce the situation you described in a test case.
> 
I mean for horizontal reductions you don't need to perform this, you can do it after the horizontal reduction matching. Plus `continue` is too early, if `findBuildAggregate` fails.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132590/new/

https://reviews.llvm.org/D132590



More information about the llvm-commits mailing list