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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 12:14:59 PST 2021


ABataev 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);
----------------
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. 


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1666
+        }
+        return UniqueValues.size() == 2 || !isPowerOf2_32(UniqueValues.size());
+      };
----------------
vporpo wrote:
> nit: Perhaps a TODO here?
Will do


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