forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MLIR][Bufferization] BufferResultsToOutParams: Add option to add att…
…ribute to output arguments 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. To be able to test this, the pass option was added to the tablegen. And then the existing manual option struct `BufferResultsToOutParamsOptions` was renamed to `BufferResultsToOutParamsOpts` to not conflict. Reviewers: TinaAMD Reviewed By: TinaAMD Pull Request: #116
- Loading branch information
1 parent
ef0da4b
commit ee4d46c
Showing
4 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
mlir/test/Transforms/buffer-results-to-out-params-add-result-attr.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// 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 | ||
// CHECK-SAME: 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> | ||
} |