blob: 947faff99d265f34b5d6f6e2b8dbd673200ecb5b [file] [log] [blame]
River Riddlef8923582020-03-06 21:53:161// 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 Zinenko052d24a2020-11-15 14:25:0121
River Riddlec0958b72020-11-19 02:31:4022// expected-remark@+1 {{found an instance of 'read' on a symbol '@foo_ref', on resource '<Test>'}}
23"test.side_effect_op"() {effects = [
24 {effect="read", on_reference = @foo_ref, test_resource}
25]} : () -> i32
26
Alex Zinenko052d24a2020-11-15 14:25:0127// No _memory_ effects, but a parametric test effect.
28// expected-remark@+2 {{operation has no memory effects}}
29// expected-remark@+1 {{found a parametric effect with affine_map<(d0, d1) -> (d1, d0)>}}
30%4 = "test.side_effect_op"() {
31 effect_parameter = affine_map<(i, j) -> (j, i)>
32} : () -> i32
Mehdi Aminid905c102021-03-24 08:25:2533
34// Check with this unregistered operation to test the fallback on the dialect.
35// expected-remark@+1 {{found a parametric effect with affine_map<(d0, d1) -> (d1, d0)>}}
36%5 = "test.unregistered_side_effect_op"() {
37 effect_parameter = affine_map<(i, j) -> (j, i)>
38} : () -> i32