// RUN: mlir-opt %s -finalizing-bufferize -split-input-file -verify-diagnostics | FileCheck %s // CHECK-LABEL: func @eliminate_materializations( // CHECK-SAME: %[[ARG:.*]]: memref) -> memref { // CHECK: return %[[ARG]] : memref func @eliminate_materializations(%arg0: memref) -> memref { %0 = tensor_load %arg0 : memref %1 = tensor_to_memref %0 : memref return %1 : memref } // ----- func @unable_to_convert_lone_tensor_to_memref() -> memref { // expected-error @+1 {{failed to legalize operation 'test.source'}} %0 = "test.source"() : () -> tensor %1 = tensor_to_memref %0 : memref return %1 : memref } // ----- func @unable_to_convert_lone_tensor_load(%arg0: memref) { %0 = tensor_load %arg0 : memref // expected-error @+1 {{failed to legalize operation 'test.sink'}} "test.sink"(%0) : (tensor) -> () return }