[llvm] [TLI] Fix replace-with-veclib crash with invalid arguments (PR #77112)

Maciej Gabka via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 05:16:34 PST 2024


================
@@ -174,6 +176,24 @@ static bool replaceWithCallToVeclib(const TargetLibraryInfo &TLI,
 
   Function *TLIFunc = getTLIFunction(I.getModule(), VectorFTy,
                                      VD->getVectorFnName(), FuncToReplace);
+
+  // For calls, bail out when their arguments do not match with the TLI mapping.
+  if (CI) {
+    int IdxNonPred = 0;
+    for (auto [OrigTy, VFParam] :
+         zip(OrigArgTypes, OptInfo->Shape.Parameters)) {
+      if (VFParam.ParamKind == VFParamKind::GlobalPredicate)
----------------
mgabka wrote:

the VFParam are obtained via VFABI, so we know that if the GlobalPredicate exists  is the last one, can we use this knowledge to remove this if stmt?

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


More information about the llvm-commits mailing list