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

Valeriy Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 10:30:59 PDT 2022


vdmitrie 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;
+
----------------
ABataev wrote:
> 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.
The whole point of the patch was to make sure to visit every vector build operand early. In order to do that we need the call. But I also see what you mean.


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