llvm-project/mlir/test/Transforms/finalizing-bufferize.mlir

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
962 B
MLIR
Raw Normal View History

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