[PATCH] D98714: [SLP] Add insertelement instructions to vectorizable tree
Anton Afanasyev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 5 22:46:44 PDT 2021
anton-afanasyev marked 7 inline comments as done.
anton-afanasyev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2846-2847
+
+ for (auto *V : VL)
+ MinIndex = std::min(MinIndex, int(GetConstantOperand(V)));
+
----------------
ABataev wrote:
> ```
> for (Value *V : VL)
> MinIndex = std::min<int>(MinIndex, GetConstantOperand(V));
> ```
Ok, done
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3643-3644
+ for (auto *V : VL) {
+ int Index = cast<ConstantInt>(cast<InsertElementInst>(V)->getOperand(2))
+ ->getZExtValue();
+ DemandedElts.setBit(Index);
----------------
ABataev wrote:
> Turn `GetConstantOperand` into a function and use it
Ok, done
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4197
+ if (auto *Insert = dyn_cast<InsertElementInst>(EU.Scalar)) {
+ auto &ScalarsList = getTreeEntry(EU.Scalar)->Scalars;
+ ValueSet Scalars(ScalarsList.begin(), ScalarsList.end());
----------------
ABataev wrote:
> `ArrayRef<Value *>`
Ok, done
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4202
+
+ for (auto *S : Scalars)
+ MinIndex = std::min(
----------------
ABataev wrote:
> `Value *`
Ok, done
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4203-4206
+ MinIndex = std::min(
+ MinIndex,
+ int(cast<ConstantInt>(cast<InsertElementInst>(S)->getOperand(2))
+ ->getZExtValue()));
----------------
ABataev wrote:
> `std::min<int>` and use a function
Ok, done
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4211-4212
+ int Index =
+ cast<ConstantInt>(cast<InsertElementInst>(Insert)->getOperand(2))
+ ->getZExtValue() -
+ MinIndex;
----------------
ABataev wrote:
> Use a function to extract index
Ok, done
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4217
+ NumInsertsUsed++;
+ } while (is_contained(Scalars, Insert));
+
----------------
ABataev wrote:
> `Scalars.contains(Insert)` or `.count(Insert)`
Ok, done
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98714/new/
https://reviews.llvm.org/D98714
More information about the llvm-commits
mailing list