File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -238,12 +238,19 @@ static bool isValidElementType(Type *Ty) {
238
238
!Ty->isPPC_FP128Ty();
239
239
}
240
240
241
+ /// \returns the number of elements for Ty.
242
+ static unsigned getNumElements(Type *Ty) {
243
+ assert(!isa<ScalableVectorType>(Ty) &&
244
+ "ScalableVectorType is not supported.");
245
+ if (auto *VecTy = dyn_cast<FixedVectorType>(Ty))
246
+ return VecTy->getNumElements();
247
+ return 1;
248
+ }
249
+
241
250
/// \returns the vector type of ScalarTy based on vectorization factor.
242
251
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());
246
- return FixedVectorType::get(ScalarTy, VF);
252
+ return FixedVectorType::get(ScalarTy->getScalarType(),
253
+ VF * getNumElements(ScalarTy));
247
254
}
248
255
249
256
/// \returns True if the value is a constant (but not globals/constant
You can’t perform that action at this time.
0 commit comments