@@ -12042,6 +12042,9 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
12042
12042
/// Adds 2 input vectors and the mask for their shuffling.
12043
12043
void add(Value *V1, Value *V2, ArrayRef<int> Mask) {
12044
12044
assert(V1 && V2 && !Mask.empty() && "Expected non-empty input vectors.");
12045
+ assert(isa<FixedVectorType>(V1->getType()) &&
12046
+ isa<FixedVectorType>(V2->getType()) &&
12047
+ "castToScalarTyElem expect V1 and V2 to be FixedVectorType");
12045
12048
V1 = castToScalarTyElem(V1);
12046
12049
V2 = castToScalarTyElem(V2);
12047
12050
if (InVectors.empty()) {
@@ -12071,22 +12074,18 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
12071
12074
}
12072
12075
/// Adds another one input vector and the mask for the shuffling.
12073
12076
void add(Value *V1, ArrayRef<int> Mask, bool = false) {
12077
+ assert(isa<FixedVectorType>(V1->getType()) &&
12078
+ "castToScalarTyElem expect V1 to be FixedVectorType");
12074
12079
V1 = castToScalarTyElem(V1);
12075
12080
if (InVectors.empty()) {
12076
- if (!isa<FixedVectorType>(V1->getType())) {
12077
- V1 = createShuffle(V1, nullptr, CommonMask);
12078
- CommonMask.assign(Mask.size(), PoisonMaskElem);
12079
- transformMaskAfterShuffle(CommonMask, Mask);
12080
- }
12081
12081
InVectors.push_back(V1);
12082
12082
CommonMask.assign(Mask.begin(), Mask.end());
12083
12083
return;
12084
12084
}
12085
12085
const auto *It = find(InVectors, V1);
12086
12086
if (It == InVectors.end()) {
12087
12087
if (InVectors.size() == 2 ||
12088
- InVectors.front()->getType() != V1->getType() ||
12089
- !isa<FixedVectorType>(V1->getType())) {
12088
+ InVectors.front()->getType() != V1->getType()) {
12090
12089
Value *V = InVectors.front();
12091
12090
if (InVectors.size() == 2) {
12092
12091
V = createShuffle(InVectors.front(), InVectors.back(), CommonMask);
@@ -12120,9 +12119,7 @@ class BoUpSLP::ShuffleInstructionBuilder final : public BaseShuffleAnalysis {
12120
12119
break;
12121
12120
}
12122
12121
}
12123
- int VF = CommonMask.size();
12124
- if (auto *FTy = dyn_cast<FixedVectorType>(V1->getType()))
12125
- VF = FTy->getNumElements();
12122
+ int VF = cast<FixedVectorType>(V1->getType())->getNumElements();
12126
12123
for (unsigned Idx = 0, Sz = CommonMask.size(); Idx < Sz; ++Idx)
12127
12124
if (Mask[Idx] != PoisonMaskElem && CommonMask[Idx] == PoisonMaskElem)
12128
12125
CommonMask[Idx] = Mask[Idx] + (It == InVectors.begin() ? 0 : VF);
0 commit comments