1// RUN: mlir-opt %s --pass-pipeline="builtin.module(func.func(buffer-deallocation-pipeline))" -verify-diagnostics 2 3// Test case requires a helper function but is run on a function. 4 5// CHECK-LABEL: func.func @test( 6// CHECK: func.call @[[helper:.*]]({{.*}}) : ({{.*}}) -> () 7func.func @test(%lb : index, %ub: index) -> (memref<5xf32>, memref<5xf32>) { 8 %0 = memref.alloc() : memref<5xf32> 9 %1 = memref.alloc() : memref<5xf32> 10 %c1 = arith.constant 1 : index 11 %a, %b = scf.for %iv = %lb to %ub step %c1 iter_args(%c = %0, %d = %1) 12 -> (memref<5xf32>, memref<5xf32>) { 13 // expected-error @below{{library function required for generic lowering, but cannot be automatically inserted when operating on functions}} 14 // expected-error @below{{failed to legalize operation 'bufferization.dealloc' that was explicitly marked illegal}} 15 scf.yield %d, %c : memref<5xf32>, memref<5xf32> 16 } 17 return %a, %b : memref<5xf32>, memref<5xf32> 18} 19 20// CHECK: func.func @[[helper]]( 21// CHECK-SAME: %{{.*}}: memref<?xindex>, %{{.*}}: memref<?xindex>, %{{.*}}: memref<?xi1>, %{{.*}}: memref<?xi1>, %{{.*}}: memref<?xi1>) 22 23