25 lines · plain
1// RUN: mlir-opt -one-shot-bufferize="bufferize-function-boundaries" -split-input-file %s -verify-diagnostics2 3// expected-error @below{{failed to bufferize op}}4// expected-error @below{{incoming operands of block argument have inconsistent memory spaces}}5func.func @inconsistent_memory_space() -> tensor<5xf32> {6 %0 = bufferization.alloc_tensor() {memory_space = 0 : ui64} : tensor<5xf32>7 cf.br ^bb1(%0: tensor<5xf32>)8^bb1(%arg1: tensor<5xf32>):9 func.return %arg1 : tensor<5xf32>10^bb2():11 %1 = bufferization.alloc_tensor() {memory_space = 1 : ui64} : tensor<5xf32>12 cf.br ^bb1(%1: tensor<5xf32>)13}14 15// -----16 17// expected-error @below{{failed to bufferize op}}18// expected-error @below{{could not infer buffer type of block argument}}19func.func @cannot_infer_type() {20 return21 // The type of the block argument cannot be inferred.22^bb1(%t: tensor<5xf32>):23 cf.br ^bb1(%t: tensor<5xf32>)24}25