[llvm] [SLP][REVEC] Initial commits. (PR #98269)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 05:58:25 PDT 2024


================
@@ -227,15 +231,26 @@ static const unsigned MaxPHINumOperands = 128;
 /// avoids spending time checking the cost model and realizing that they will
 /// be inevitably scalarized.
 static bool isValidElementType(Type *Ty) {
+  if (RunSLPReVectorization && isa<FixedVectorType>(Ty))
+    Ty = Ty->getScalarType();
   return VectorType::isValidElementType(Ty) && !Ty->isX86_FP80Ty() &&
          !Ty->isPPC_FP128Ty();
 }
 
 /// \returns the vector type of ScalarTy based on vectorization factor.
 static FixedVectorType *getWidenedType(Type *ScalarTy, unsigned VF) {
+  if (auto *VecTy = dyn_cast<FixedVectorType>(ScalarTy))
+    return FixedVectorType::get(VecTy->getElementType(),
+                                VF * VecTy->getNumElements());
   return FixedVectorType::get(ScalarTy, VF);
 }
 
+static unsigned getNumElements(Type *Ty) {
----------------
alexey-bataev wrote:

Add a comment with the function description. Also, will it return 1 for scalable vectors too?

https://github.com/llvm/llvm-project/pull/98269


More information about the llvm-commits mailing list