The generic allocation and deallocation instructions, which are optionally used during the MemRef -> LLVM conversion, should have a name that is specifically bound to their origin, that is the conversion pass itself. Reviewed By: silvas Differential Revision: https://reviews.llvm.org/D130588
24 lines
996 B
MLIR
24 lines
996 B
MLIR
// RUN: mlir-opt -pass-pipeline="convert-memref-to-llvm{use-generic-functions=1}" -split-input-file %s \
|
|
// RUN: | FileCheck %s --check-prefix="CHECK-NOTALIGNED"
|
|
|
|
// RUN: mlir-opt -pass-pipeline="convert-memref-to-llvm{use-generic-functions=1 use-aligned-alloc=1}" -split-input-file %s \
|
|
// RUN: | FileCheck %s --check-prefix="CHECK-ALIGNED"
|
|
|
|
// CHECK-LABEL: func @alloc()
|
|
func.func @zero_d_alloc() -> memref<f32> {
|
|
// CHECK-NOTALIGNED: llvm.call @_mlir_memref_to_llvm_alloc(%{{.*}}) : (i64) -> !llvm.ptr<i8>
|
|
// CHECK-ALIGNED: llvm.call @_mlir_memref_to_llvm_aligned_alloc(%{{.*}}, %{{.*}}) : (i64, i64) -> !llvm.ptr<i8>
|
|
%0 = memref.alloc() : memref<f32>
|
|
return %0 : memref<f32>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: func @dealloc()
|
|
func.func @dealloc(%arg0: memref<f32>) {
|
|
// CHECK-NOTALIGNED: llvm.call @_mlir_memref_to_llvm_free(%{{.*}}) : (!llvm.ptr<i8>) -> ()
|
|
// CHECK-ALIGNED: llvm.call @_mlir_memref_to_llvm_free(%{{.*}}) : (!llvm.ptr<i8>) -> ()
|
|
memref.dealloc %arg0 : memref<f32>
|
|
return
|
|
}
|