File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -238,12 +238,17 @@ 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
+ if (auto *VecTy = dyn_cast<FixedVectorType>(Ty))
244
+ return VecTy->getNumElements();
245
+ return 1;
246
+ }
247
+
241
248
/// \returns the vector type of ScalarTy based on vectorization factor.
242
249
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);
250
+ return FixedVectorType::get(ScalarTy->getScalarType(),
251
+ VF * getNumElements(ScalarTy));
247
252
}
248
253
249
254
/// \returns True if the value is a constant (but not globals/constant
You can’t perform that action at this time.
0 commit comments