Skip to content

[llvm] Construct SmallVector with ArrayRef (NFC) #139992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5326,15 +5326,13 @@ static SDValue lowerShuffleViaVRegSplitting(ShuffleVectorSDNode *SVN,
Mask, NumOfSrcRegs, NumOfDestRegs, NumOfDestRegs,
[&]() { Operands.emplace_back(); },
[&](ArrayRef<int> SrcSubMask, unsigned SrcVecIdx, unsigned DstVecIdx) {
Operands.emplace_back().emplace_back(
SrcVecIdx, UINT_MAX,
SmallVector<int>(SrcSubMask.begin(), SrcSubMask.end()));
Operands.emplace_back().emplace_back(SrcVecIdx, UINT_MAX,
SmallVector<int>(SrcSubMask));
},
[&](ArrayRef<int> SrcSubMask, unsigned Idx1, unsigned Idx2, bool NewReg) {
if (NewReg)
Operands.emplace_back();
Operands.back().emplace_back(
Idx1, Idx2, SmallVector<int>(SrcSubMask.begin(), SrcSubMask.end()));
Operands.back().emplace_back(Idx1, Idx2, SmallVector<int>(SrcSubMask));
});
assert(Operands.size() == NumOfDestRegs && "Whole vector must be processed");
// Note: check that we do not emit too many shuffles here to prevent code
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10212,7 +10212,7 @@ void BoUpSLP::buildTreeRec(ArrayRef<Value *> VLRef, unsigned Depth,
assert((allConstant(VLRef) || allSameType(VLRef)) && "Invalid types!");

SmallVector<int> ReuseShuffleIndices;
SmallVector<Value *> VL(VLRef.begin(), VLRef.end());
SmallVector<Value *> VL(VLRef);

// Tries to build split node.
auto TrySplitNode = [&](const InstructionsState &LocalState) {
Expand Down Expand Up @@ -13606,7 +13606,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
unsigned InterleaveFactor;
SmallVector<int> CompressMask;
VectorType *LoadVecTy;
SmallVector<Value *> Scalars(VL.begin(), VL.end());
SmallVector<Value *> Scalars(VL);
if (!E->ReorderIndices.empty()) {
SmallVector<int> Mask(E->ReorderIndices.begin(),
E->ReorderIndices.end());
Expand Down