[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:11 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");
----------------
mgabka wrote:

I think could be worth to split it into multiple asserts, so it is more clear if the issue is with tryDemangleForVFABI returning no value, i,e mangled prefix in the TLI is incorrect, or the VF does not match.

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


More information about the llvm-commits mailing list