[PATCH] D115811: [SLP]Early exit out of the reordering if shuffled/perfect diamond match found.

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 13:31:07 PST 2021


vporpo added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1656-1665
+        SmallPtrSet<Value *, 4> UniqueValues;
+        ArrayRef<OperandData> Op0 = OpsVec.front();
+        for (const OperandData &Data : Op0)
+          UniqueValues.insert(Data.V);
+        for (ArrayRef<OperandData> Op : drop_begin(OpsVec, 1)) {
+          if (any_of(Op, [&UniqueValues](const OperandData &Data) {
+                return !UniqueValues.contains(Data.V);
----------------
ABataev wrote:
> vporpo wrote:
> > Isn't `VLOperands` a better place for this logic? Perhaps a method like: `isDiamondMatch()` ?
> > This will also help separate the temporary check `UniqueValues.size() == 2 || !isPowerOf2_32(UniqueValues.size())`. What do you think?
> I just thought that we may have this situation after the very first iteration of the reordering, not only initially. 
I am not sure I follow why moving this logic to a member method in VLOperands won't work in this case. Could you elaborate a bit on this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115811



More information about the llvm-commits mailing list