@@ -553,8 +553,8 @@ static std::optional<unsigned> getExtractIndex(Instruction *E) {
553
553
/// successful, the matched scalars are replaced by poison values in \p VL for
554
554
/// future analysis.
555
555
static std::optional<TTI::ShuffleKind>
556
- tryToGatherExtractElements(SmallVectorImpl <Value *> & VL,
557
- SmallVectorImpl<int> &Mask) {
556
+ tryToGatherSingleRegisterExtractElements(MutableArrayRef <Value *> VL,
557
+ SmallVectorImpl<int> &Mask) {
558
558
// Scan list of gathered scalars for extractelements that can be represented
559
559
// as shuffles.
560
560
MapVector<Value *, SmallVector<int>> VectorOpToIdx;
@@ -641,7 +641,7 @@ tryToGatherExtractElements(SmallVectorImpl<Value *> &VL,
641
641
if (!Res) {
642
642
// TODO: try to check other subsets if possible.
643
643
// Restore the original VL if attempt was not successful.
644
- VL.swap(SavedVL );
644
+ copy(SavedVL, VL.begin() );
645
645
return std::nullopt;
646
646
}
647
647
// Restore unused scalars from mask, if some of the extractelements were not
@@ -7616,7 +7616,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
7616
7616
std::optional<TargetTransformInfo::ShuffleKind> GatherShuffle;
7617
7617
SmallVector<const TreeEntry *> Entries;
7618
7618
// Check for gathered extracts.
7619
- ExtractShuffle = tryToGatherExtractElements (GatheredScalars, ExtractMask);
7619
+ ExtractShuffle = tryToGatherSingleRegisterExtractElements (GatheredScalars, ExtractMask);
7620
7620
SmallVector<Value *> IgnoredVals;
7621
7621
if (UserIgnoreList)
7622
7622
IgnoredVals.assign(UserIgnoreList->begin(), UserIgnoreList->end());
@@ -10166,7 +10166,8 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Args &...Params) {
10166
10166
Type *ScalarTy = GatheredScalars.front()->getType();
10167
10167
if (!all_of(GatheredScalars, UndefValue::classof)) {
10168
10168
// Check for gathered extracts.
10169
- ExtractShuffle = tryToGatherExtractElements(GatheredScalars, ExtractMask);
10169
+ ExtractShuffle =
10170
+ tryToGatherSingleRegisterExtractElements(GatheredScalars, ExtractMask);
10170
10171
SmallVector<Value *> IgnoredVals;
10171
10172
if (UserIgnoreList)
10172
10173
IgnoredVals.assign(UserIgnoreList->begin(), UserIgnoreList->end());
0 commit comments