Skip to content

Commit 4a06332

Browse files
committed
[SLP][NFC]Use MutableArrayRef instead of SmallVectorImpl&, rename
function, NFC.
1 parent 3fb3df3 commit 4a06332

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,8 @@ static std::optional<unsigned> getExtractIndex(Instruction *E) {
553553
/// successful, the matched scalars are replaced by poison values in \p VL for
554554
/// future analysis.
555555
static std::optional<TTI::ShuffleKind>
556-
tryToGatherExtractElements(SmallVectorImpl<Value *> &VL,
557-
SmallVectorImpl<int> &Mask) {
556+
tryToGatherSingleRegisterExtractElements(MutableArrayRef<Value *> VL,
557+
SmallVectorImpl<int> &Mask) {
558558
// Scan list of gathered scalars for extractelements that can be represented
559559
// as shuffles.
560560
MapVector<Value *, SmallVector<int>> VectorOpToIdx;
@@ -641,7 +641,7 @@ tryToGatherExtractElements(SmallVectorImpl<Value *> &VL,
641641
if (!Res) {
642642
// TODO: try to check other subsets if possible.
643643
// Restore the original VL if attempt was not successful.
644-
VL.swap(SavedVL);
644+
copy(SavedVL, VL.begin());
645645
return std::nullopt;
646646
}
647647
// Restore unused scalars from mask, if some of the extractelements were not
@@ -7616,7 +7616,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
76167616
std::optional<TargetTransformInfo::ShuffleKind> GatherShuffle;
76177617
SmallVector<const TreeEntry *> Entries;
76187618
// Check for gathered extracts.
7619-
ExtractShuffle = tryToGatherExtractElements(GatheredScalars, ExtractMask);
7619+
ExtractShuffle = tryToGatherSingleRegisterExtractElements(GatheredScalars, ExtractMask);
76207620
SmallVector<Value *> IgnoredVals;
76217621
if (UserIgnoreList)
76227622
IgnoredVals.assign(UserIgnoreList->begin(), UserIgnoreList->end());
@@ -10166,7 +10166,8 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Args &...Params) {
1016610166
Type *ScalarTy = GatheredScalars.front()->getType();
1016710167
if (!all_of(GatheredScalars, UndefValue::classof)) {
1016810168
// Check for gathered extracts.
10169-
ExtractShuffle = tryToGatherExtractElements(GatheredScalars, ExtractMask);
10169+
ExtractShuffle =
10170+
tryToGatherSingleRegisterExtractElements(GatheredScalars, ExtractMask);
1017010171
SmallVector<Value *> IgnoredVals;
1017110172
if (UserIgnoreList)
1017210173
IgnoredVals.assign(UserIgnoreList->begin(), UserIgnoreList->end());

0 commit comments

Comments
 (0)