@@ -13443,15 +13443,14 @@ BoUpSLP::isGatherShuffledSingleRegisterEntry(
13443
13443
for_each(SubMask, [&](int &Idx) {
13444
13444
if (Idx == PoisonMaskElem)
13445
13445
return;
13446
- Idx = (Idx % VF) - (( MinElement / NewVF) * NewVF ) +
13446
+ Idx = (Idx % VF) - (MinElement % VF ) +
13447
13447
(Idx >= static_cast<int>(VF) ? NewVF : 0);
13448
13448
});
13449
- } else {
13450
- NewVF = VF;
13449
+ VF = NewVF;
13451
13450
}
13452
13451
13453
13452
constexpr TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
13454
- auto *VecTy = getWidenedType(VL.front()->getType(), NewVF );
13453
+ auto *VecTy = getWidenedType(VL.front()->getType(), VF );
13455
13454
auto *MaskVecTy = getWidenedType(VL.front()->getType(), SubMask.size());
13456
13455
auto GetShuffleCost = [&,
13457
13456
&TTI = *TTI](ArrayRef<int> Mask,
@@ -13476,7 +13475,7 @@ BoUpSLP::isGatherShuffledSingleRegisterEntry(
13476
13475
APInt DemandedElts = APInt::getAllOnes(SubMask.size());
13477
13476
bool IsIdentity = true;
13478
13477
for (auto [I, Idx] : enumerate(FirstMask)) {
13479
- if (Idx >= static_cast<int>(NewVF )) {
13478
+ if (Idx >= static_cast<int>(VF )) {
13480
13479
Idx = PoisonMaskElem;
13481
13480
} else {
13482
13481
DemandedElts.clearBit(I);
@@ -13499,12 +13498,12 @@ BoUpSLP::isGatherShuffledSingleRegisterEntry(
13499
13498
APInt DemandedElts = APInt::getAllOnes(SubMask.size());
13500
13499
bool IsIdentity = true;
13501
13500
for (auto [I, Idx] : enumerate(SecondMask)) {
13502
- if (Idx < static_cast<int>(NewVF ) && Idx >= 0) {
13501
+ if (Idx < static_cast<int>(VF ) && Idx >= 0) {
13503
13502
Idx = PoisonMaskElem;
13504
13503
} else {
13505
13504
DemandedElts.clearBit(I);
13506
13505
if (Idx != PoisonMaskElem) {
13507
- Idx -= NewVF ;
13506
+ Idx -= VF ;
13508
13507
IsIdentity &= static_cast<int>(I) == Idx;
13509
13508
}
13510
13509
}
@@ -13524,24 +13523,12 @@ BoUpSLP::isGatherShuffledSingleRegisterEntry(
13524
13523
/*Extract=*/false, CostKind);
13525
13524
const TreeEntry *BestEntry = nullptr;
13526
13525
if (FirstShuffleCost < ShuffleCost) {
13527
- std::for_each(std::next(Mask.begin(), Part * VL.size()),
13528
- std::next(Mask.begin(), (Part + 1) * VL.size()),
13529
- [&](int &Idx) {
13530
- if (Idx >= static_cast<int>(VF))
13531
- Idx = PoisonMaskElem;
13532
- });
13526
+ copy(FirstMask, std::next(Mask.begin(), Part * VL.size()));
13533
13527
BestEntry = Entries.front();
13534
13528
ShuffleCost = FirstShuffleCost;
13535
13529
}
13536
13530
if (SecondShuffleCost < ShuffleCost) {
13537
- std::for_each(std::next(Mask.begin(), Part * VL.size()),
13538
- std::next(Mask.begin(), (Part + 1) * VL.size()),
13539
- [&](int &Idx) {
13540
- if (Idx < static_cast<int>(VF))
13541
- Idx = PoisonMaskElem;
13542
- else
13543
- Idx -= VF;
13544
- });
13531
+ copy(SecondMask, std::next(Mask.begin(), Part * VL.size()));
13545
13532
BestEntry = Entries[1];
13546
13533
ShuffleCost = SecondShuffleCost;
13547
13534
}
0 commit comments