[llvm] [TLI] Pass replace-with-veclib works with Scalable Vectors. (PR #73642)

Maciej Gabka via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 06:34:28 PST 2023


================
@@ -38,138 +42,135 @@ STATISTIC(NumTLIFuncDeclAdded,
 STATISTIC(NumFuncUsedAdded,
           "Number of functions added to `llvm.compiler.used`");
 
-static bool replaceWithTLIFunction(CallInst &CI, const StringRef TLIName) {
-  Module *M = CI.getModule();
-
-  Function *OldFunc = CI.getCalledFunction();
-
-  // Check if the vector library function is already declared in this module,
-  // otherwise insert it.
+/// Returns a vector Function that it adds to the Module \p M. When an \p
+/// ScalarFunc is not null, it copies its attributes to the newly created
+/// Function.
+Function *getTLIFunction(Module *M, FunctionType *VectorFTy,
+                         Function *ScalarFunc, const StringRef TLIName) {
----------------
mgabka wrote:

I think that ScalarFunc could be the last parameter with a default value to nullptr, as you are expecting to pass nullptr if the instruction to replace is not a call instruction

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


More information about the llvm-commits mailing list