43 lines · plain
1// RUN: mlir-opt %s -finalize-memref-to-llvm -split-input-file -verify-diagnostics | FileCheck %s2 3// expected-error@+1{{redefinition of reserved function 'malloc' of different type '!llvm.func<void (i64)>' is prohibited}}4llvm.func @malloc(i64)5func.func @redef_reserved() {6 %alloc = memref.alloc() : memref<1024x64xf32, 1>7 llvm.return8}9 10// -----11 12// expected-error@unknown{{conversion of memref memory space "foo" to integer address space failed. Consider adding memory space conversions.}}13// CHECK-LABEL: @bad_address_space14func.func @bad_address_space(%a: memref<2xindex, "foo">) {15 %c0 = arith.constant 0 : index16 // CHECK: memref.store17 memref.store %c0, %a[%c0] : memref<2xindex, "foo">18 return19}20 21// -----22 23// CHECK-LABEL: @invalid_int_conversion24func.func @invalid_int_conversion() {25 // expected-error@unknown{{conversion of memref memory space 1 : ui64 to integer address space failed. Consider adding memory space conversions.}}26 %alloc = memref.alloc() {alignment = 64 : i64} : memref<10xf32, 1 : ui64> 27 return28}29 30// -----31 32// expected-error@unknown{{conversion of memref memory space #gpu.address_space<workgroup> to integer address space failed. Consider adding memory space conversions}}33// CHECK-LABEL: @issue_7016034func.func @issue_70160() {35 %alloc = memref.alloc() : memref<1x32x33xi32, #gpu.address_space<workgroup>>36 %alloc1 = memref.alloc() : memref<i32>37 %c0 = arith.constant 0 : index38 // CHECK: memref.load39 %0 = memref.load %alloc[%c0, %c0, %c0] : memref<1x32x33xi32, #gpu.address_space<workgroup>>40 memref.store %0, %alloc1[] : memref<i32>41 func.return42}43