
Adds a new pass option `add-result-attr` that will make the pass add the attribute `{bufferize.result}` to each argument that was converted from a result. This is important e.g. when later using the python bindings / execution engine to understand which arguments are actually results. To be able to test this, the pass option was added to the tablegen. To avoid collisions with the existing, manually defined option struct `BufferResultsToOutParamsOptions`, that one was renamed to `BufferResultsToOutParamsOpts`.
18 lines
638 B
MLIR
18 lines
638 B
MLIR
// RUN: mlir-opt -p 'builtin.module(buffer-results-to-out-params{add-result-attr})' -split-input-file -verify-diagnostics %s | FileCheck %s
|
|
|
|
// CHECK-LABEL: @basic({{.*}}: memref<f32> {bufferize.result})
|
|
func.func @basic() -> (memref<f32>) {
|
|
%0 = "test.source"() : () -> (memref<f32>)
|
|
return %0 : memref<f32>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: multiple_results
|
|
// CHECK-SAME: memref<1xf32> {bufferize.result}
|
|
// CHECK-SAME: memref<2xf32> {bufferize.result}
|
|
func.func @multiple_results() -> (memref<1xf32>, memref<2xf32>) {
|
|
%0, %1 = "test.source"() : () -> (memref<1xf32>, memref<2xf32>)
|
|
return %0, %1 : memref<1xf32>, memref<2xf32>
|
|
}
|