diff --git a/mlir/docs/TargetLLVMIR.md b/mlir/docs/TargetLLVMIR.md --- a/mlir/docs/TargetLLVMIR.md +++ b/mlir/docs/TargetLLVMIR.md @@ -560,9 +560,10 @@ and `free`. However, it is possible to convert them to more generic functions which can be implemented by a runtime library, thus allowing custom allocation strategies or runtime profiling. When the conversion pass is instructed to -perform such operation, the names of the calles are `_mlir_alloc`, -`_mlir_aligned_alloc` and `_mlir_free`. Their signatures are the same of -`malloc`, `aligned_alloc` and `free`. +perform such operation, the names of the calles are +`_mlir_memref_to_llvm_alloc`, `_mlir_memref_to_llvm_aligned_alloc` and +`_mlir_memref_to_llvm_free`. Their signatures are the same of `malloc`, +`aligned_alloc` and `free`. ### C-compatible wrapper emission diff --git a/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp b/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp --- a/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp @@ -35,9 +35,10 @@ static constexpr llvm::StringRef kMalloc = "malloc"; static constexpr llvm::StringRef kAlignedAlloc = "aligned_alloc"; static constexpr llvm::StringRef kFree = "free"; -static constexpr llvm::StringRef kGenericAlloc = "_mlir_alloc"; -static constexpr llvm::StringRef kGenericAlignedAlloc = "_mlir_aligned_alloc"; -static constexpr llvm::StringRef kGenericFree = "_mlir_free"; +static constexpr llvm::StringRef kGenericAlloc = "_mlir_memref_to_llvm_alloc"; +static constexpr llvm::StringRef kGenericAlignedAlloc = + "_mlir_memref_to_llvm_aligned_alloc"; +static constexpr llvm::StringRef kGenericFree = "_mlir_memref_to_llvm_free"; static constexpr llvm::StringRef kMemRefCopy = "memrefCopy"; /// Generic print function lookupOrCreate helper. diff --git a/mlir/test/Conversion/MemRefToLLVM/generic-functions.mlir b/mlir/test/Conversion/MemRefToLLVM/generic-functions.mlir --- a/mlir/test/Conversion/MemRefToLLVM/generic-functions.mlir +++ b/mlir/test/Conversion/MemRefToLLVM/generic-functions.mlir @@ -6,8 +6,8 @@ // CHECK-LABEL: func @alloc() func.func @zero_d_alloc() -> memref { -// CHECK-NOTALIGNED: llvm.call @_mlir_alloc(%{{.*}}) : (i64) -> !llvm.ptr -// CHECK-ALIGNED: llvm.call @_mlir_aligned_alloc(%{{.*}}, %{{.*}}) : (i64, i64) -> !llvm.ptr +// CHECK-NOTALIGNED: llvm.call @_mlir_memref_to_llvm_alloc(%{{.*}}) : (i64) -> !llvm.ptr +// CHECK-ALIGNED: llvm.call @_mlir_memref_to_llvm_aligned_alloc(%{{.*}}, %{{.*}}) : (i64, i64) -> !llvm.ptr %0 = memref.alloc() : memref return %0 : memref } @@ -16,8 +16,8 @@ // CHECK-LABEL: func @dealloc() func.func @dealloc(%arg0: memref) { -// CHECK-NOTALIGNED: llvm.call @_mlir_free(%{{.*}}) : (!llvm.ptr) -> () -// CHECK-ALIGNED: llvm.call @_mlir_free(%{{.*}}) : (!llvm.ptr) -> () +// CHECK-NOTALIGNED: llvm.call @_mlir_memref_to_llvm_free(%{{.*}}) : (!llvm.ptr) -> () +// CHECK-ALIGNED: llvm.call @_mlir_memref_to_llvm_free(%{{.*}}) : (!llvm.ptr) -> () memref.dealloc %arg0 : memref return }