[llvm] [TLI] Use tryDemangleForVFABI when declaring vector variants. (PR #76753)

Maciej Gabka via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 00:46:12 PST 2024


================
@@ -37,20 +37,39 @@ STATISTIC(NumCompUsedAdded,
 /// vectorizes the CallInst CI with a vectorization factor of VF
 /// lanes. The TLI assumes that all parameters and the return type of
 /// CI (other than void) need to be widened to a VectorType of VF
-/// lanes.
+/// lanes unless the VFABI says otherwise.
 static void addVariantDeclaration(CallInst &CI, const ElementCount &VF,
-                                  bool Predicate, const StringRef VFName) {
+                                  const VecDesc *VD) {
   Module *M = CI.getModule();
 
   // Add function declaration.
   Type *RetTy = ToVectorTy(CI.getType(), VF);
   SmallVector<Type *, 4> Tys;
-  for (Value *ArgOperand : CI.args())
-    Tys.push_back(ToVectorTy(ArgOperand->getType(), VF));
+
+  const std::optional<VFInfo> Info = VFABI::tryDemangleForVFABI(
+      VD->getVectorFunctionABIVariantString(), CI.getFunctionType());
+
+  assert(Info && Info->Shape.VF == VF && "Mangled name does not match VF");
+
+  for (VFParameter Param : Info->Shape.Parameters) {
----------------
mgabka wrote:

looks like you could just use the "VFABI:CreateFunctionType" as it does what you need.

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


More information about the llvm-commits mailing list