@@ -231,12 +231,18 @@ static const unsigned MaxPHINumOperands = 128;
231
231
/// avoids spending time checking the cost model and realizing that they will
232
232
/// be inevitably scalarized.
233
233
static bool isValidElementType(Type *Ty) {
234
+ // TODO: Support ScalableVectorType.
235
+ if (isa<FixedVectorType>(Ty))
236
+ Ty = Ty->getScalarType();
234
237
return VectorType::isValidElementType(Ty) && !Ty->isX86_FP80Ty() &&
235
238
!Ty->isPPC_FP128Ty();
236
239
}
237
240
238
241
/// \returns the vector type of ScalarTy based on vectorization factor.
239
242
static FixedVectorType *getWidenedType(Type *ScalarTy, unsigned VF) {
243
+ if (auto *VecTy = dyn_cast<FixedVectorType>(ScalarTy))
244
+ return FixedVectorType::get(VecTy->getElementType(),
245
+ VF * VecTy->getNumElements());
240
246
return FixedVectorType::get(ScalarTy, VF);
241
247
}
242
248
@@ -6784,15 +6790,15 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
6784
6790
}
6785
6791
6786
6792
// Don't handle vectors.
6787
- if (S.OpValue->getType()->isVectorTy() &&
6793
+ if (!SLPReVec && S.OpValue->getType()->isVectorTy() &&
6788
6794
!isa<InsertElementInst>(S.OpValue)) {
6789
6795
LLVM_DEBUG(dbgs() << "SLP: Gathering due to vector type.\n");
6790
6796
newTreeEntry(VL, std::nullopt /*not vectorized*/, S, UserTreeIdx);
6791
6797
return;
6792
6798
}
6793
6799
6794
6800
if (StoreInst *SI = dyn_cast<StoreInst>(S.OpValue))
6795
- if (SI->getValueOperand()->getType()->isVectorTy()) {
6801
+ if (!SLPReVec && SI->getValueOperand()->getType()->isVectorTy()) {
6796
6802
LLVM_DEBUG(dbgs() << "SLP: Gathering due to store vector type.\n");
6797
6803
newTreeEntry(VL, std::nullopt /*not vectorized*/, S, UserTreeIdx);
6798
6804
return;
0 commit comments