Skip to content

Commit

Permalink
[SLP][NFC]Use MutableArrayRef instead of SmallVectorImpl&, rename
Browse files Browse the repository at this point in the history
function, NFC.
  • Loading branch information
alexey-bataev committed Oct 18, 2023
1 parent 3fb3df3 commit 4a06332
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ static std::optional<unsigned> getExtractIndex(Instruction *E) {
/// successful, the matched scalars are replaced by poison values in \p VL for
/// future analysis.
static std::optional<TTI::ShuffleKind>
tryToGatherExtractElements(SmallVectorImpl<Value *> &VL,
SmallVectorImpl<int> &Mask) {
tryToGatherSingleRegisterExtractElements(MutableArrayRef<Value *> VL,
SmallVectorImpl<int> &Mask) {
// Scan list of gathered scalars for extractelements that can be represented
// as shuffles.
MapVector<Value *, SmallVector<int>> VectorOpToIdx;
Expand Down Expand Up @@ -641,7 +641,7 @@ tryToGatherExtractElements(SmallVectorImpl<Value *> &VL,
if (!Res) {
// TODO: try to check other subsets if possible.
// Restore the original VL if attempt was not successful.
VL.swap(SavedVL);
copy(SavedVL, VL.begin());
return std::nullopt;
}
// Restore unused scalars from mask, if some of the extractelements were not
Expand Down Expand Up @@ -7616,7 +7616,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
std::optional<TargetTransformInfo::ShuffleKind> GatherShuffle;
SmallVector<const TreeEntry *> Entries;
// Check for gathered extracts.
ExtractShuffle = tryToGatherExtractElements(GatheredScalars, ExtractMask);
ExtractShuffle = tryToGatherSingleRegisterExtractElements(GatheredScalars, ExtractMask);
SmallVector<Value *> IgnoredVals;
if (UserIgnoreList)
IgnoredVals.assign(UserIgnoreList->begin(), UserIgnoreList->end());
Expand Down Expand Up @@ -10166,7 +10166,8 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Args &...Params) {
Type *ScalarTy = GatheredScalars.front()->getType();
if (!all_of(GatheredScalars, UndefValue::classof)) {
// Check for gathered extracts.
ExtractShuffle = tryToGatherExtractElements(GatheredScalars, ExtractMask);
ExtractShuffle =
tryToGatherSingleRegisterExtractElements(GatheredScalars, ExtractMask);
SmallVector<Value *> IgnoredVals;
if (UserIgnoreList)
IgnoredVals.assign(UserIgnoreList->begin(), UserIgnoreList->end());
Expand Down

0 comments on commit 4a06332

Please sign in to comment.