River Riddle | f892358 | 2020-03-06 21:53:16 | [diff] [blame] | 1 | // RUN: mlir-opt %s -test-side-effects -verify-diagnostics |
| 2 | |
| 3 | // expected-remark@+1 {{operation has no memory effects}} |
| 4 | %0 = "test.side_effect_op"() {} : () -> i32 |
| 5 | |
| 6 | // expected-remark@+2 {{found an instance of 'read' on resource '<Default>'}} |
| 7 | // expected-remark@+1 {{found an instance of 'free' on resource '<Default>'}} |
| 8 | %1 = "test.side_effect_op"() {effects = [ |
| 9 | {effect="read"}, {effect="free"} |
| 10 | ]} : () -> i32 |
| 11 | |
| 12 | // expected-remark@+1 {{found an instance of 'write' on resource '<Test>'}} |
| 13 | %2 = "test.side_effect_op"() {effects = [ |
| 14 | {effect="write", test_resource} |
| 15 | ]} : () -> i32 |
| 16 | |
| 17 | // expected-remark@+1 {{found an instance of 'allocate' on a value, on resource '<Test>'}} |
| 18 | %3 = "test.side_effect_op"() {effects = [ |
| 19 | {effect="allocate", on_result, test_resource} |
| 20 | ]} : () -> i32 |
Alex Zinenko | 052d24a | 2020-11-15 14:25:01 | [diff] [blame^] | 21 | |
| 22 | // No _memory_ effects, but a parametric test effect. |
| 23 | // expected-remark@+2 {{operation has no memory effects}} |
| 24 | // expected-remark@+1 {{found a parametric effect with affine_map<(d0, d1) -> (d1, d0)>}} |
| 25 | %4 = "test.side_effect_op"() { |
| 26 | effect_parameter = affine_map<(i, j) -> (j, i)> |
| 27 | } : () -> i32 |