Skip to content

Commit abbbe4a

Browse files
authored
[mlir][vector] Fix attaching write effects on transfer_write's base (#142940)
This fixes an issue with `TransferWriteOp`'s implementation of the `MemoryEffectOpInterface` where the write effect was attached to the stored value rather than the base. This had the effect that when asking for the memory effects for the input memref buffer using `getEffectsOnValue(...)`, the function would return no-effects (as the effect would have been attached to the stored value rather than the input buffer).
1 parent 44a7ecd commit abbbe4a

File tree

7 files changed

+81
-64
lines changed

7 files changed

+81
-64
lines changed

flang/test/HLFIR/assign-side-effects.fir

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// RUN: fir-opt %s --test-side-effects --verify-diagnostics
33

44
func.func @test1(%x: !fir.ref<i32>, %i: i32) {
5-
// expected-remark @below {{found an instance of 'write' on a op operand, on resource '<Default>'}}
5+
// expected-remark @below {{found an instance of 'write' on op operand 1, on resource '<Default>'}}
66
hlfir.assign %i to %x : i32, !fir.ref<i32>
77
return
88
}
99

1010
func.func @test2(%x: !fir.ref<i32>, %y: !fir.ref<i32>) {
11-
// expected-remark @below {{found an instance of 'write' on a op operand, on resource '<Default>'}}
12-
// expected-remark @below {{found an instance of 'read' on a op operand, on resource '<Default>'}}
11+
// expected-remark @below {{found an instance of 'write' on op operand 1, on resource '<Default>'}}
12+
// expected-remark @below {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
1313
hlfir.assign %y to %x : !fir.ref<i32>, !fir.ref<i32>
1414
return
1515
}
@@ -22,7 +22,8 @@ func.func @test3(%x: !fir.ref<!fir.type<t>>, %y: !fir.ref<!fir.type<t>>) {
2222
}
2323

2424
func.func @test4(%x: !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, %y: !fir.box<!fir.array<?xi32>>) {
25-
// expected-remark @below {{found an instance of 'read' on a op operand, on resource '<Default>'}}
25+
// expected-remark @below {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
26+
// expected-remark @below {{found an instance of 'read' on op operand 1, on resource '<Default>'}}
2627
// expected-remark @below {{found an instance of 'write' on resource '<Default>'}}
2728
// expected-remark @below {{found an instance of 'free' on resource '<Default>'}}
2829
// expected-remark @below {{found an instance of 'allocate' on resource '<Default>'}}

flang/test/HLFIR/memory-effects.fir

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
func.func @concat(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<1, 20>>) {
44
// expected-remark@+1 {{operation has no memory effects}}
55
%c30 = arith.constant 30 : index
6-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
7-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
6+
// expected-remark@+3 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
7+
// expected-remark@+2 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
8+
// expected-remark@+1 {{found an instance of 'read' on op operand 1, on resource '<Default>'}}
89
%0 = hlfir.concat %arg0, %arg1 len %c30 : (!fir.ref<!fir.char<1,10>>, !fir.ref<!fir.char<1,20>>, index) -> (!hlfir.expr<!fir.char<1,30>>)
910
return
1011
}
@@ -16,8 +17,8 @@ func.func @all_no_effects(%arg0: !hlfir.expr<2x!fir.logical<4>>) {
1617
}
1718

1819
func.func @all_effects(%arg0: !fir.ref<!fir.array<2x10x!fir.logical<4>>>, %arg1: i32) {
19-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
20-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
20+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
21+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
2122
%all = hlfir.all %arg0 dim %arg1 : (!fir.ref<!fir.array<2x10x!fir.logical<4>>>, i32) -> !hlfir.expr<?x!fir.logical<4>>
2223
return
2324
}
@@ -29,8 +30,8 @@ func.func @any_no_effects(%arg0: !hlfir.expr<2x!fir.logical<4>>) {
2930
}
3031

3132
func.func @any_effects(%arg0: !fir.ref<!fir.array<2x10x!fir.logical<4>>>, %arg1: i32) {
32-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
33-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
33+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
34+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
3435
%all = hlfir.any %arg0 dim %arg1 : (!fir.ref<!fir.array<2x10x!fir.logical<4>>>, i32) -> !hlfir.expr<?x!fir.logical<4>>
3536
return
3637
}
@@ -42,7 +43,7 @@ func.func @count_no_effects(%arg0: !hlfir.expr<2x!fir.logical<4>>) {
4243
}
4344

4445
func.func @count_effects(%arg0: !fir.ref<!fir.array<2x10x!fir.logical<4>>>, %arg1: i32) {
45-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
46+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
4647
%all = hlfir.count %arg0 dim %arg1 : (!fir.ref<!fir.array<2x10x!fir.logical<4>>>, i32) -> i32
4748
return
4849
}
@@ -54,15 +55,15 @@ func.func @product_no_effects(%arg0: !hlfir.expr<?xf32>) {
5455
}
5556

5657
func.func @product_effects(%arg0: !fir.ref<!fir.array<2x2xf32>>, %arg1: i32) {
57-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
58-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
58+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
59+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
5960
%product = hlfir.product %arg0 dim %arg1 : (!fir.ref<!fir.array<2x2xf32>>, i32) -> !hlfir.expr<2xf32>
6061
return
6162
}
6263

6364
func.func @set_length_read(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: index) {
64-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
65-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
65+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
66+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
6667
%0 = hlfir.set_length %arg0 len %arg1 : (!fir.ref<!fir.char<1,10>>, index) -> !hlfir.expr<!fir.char<1,?>>
6768
return
6869
}
@@ -74,8 +75,8 @@ func.func @sum_no_effects(%arg0: !hlfir.expr<?xf32>) {
7475
}
7576

7677
func.func @sum_effects(%arg0: !fir.ref<!fir.array<2x2xf32>>, %arg1: i32) {
77-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
78-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
78+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
79+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
7980
%sum = hlfir.sum %arg0 dim %arg1 : (!fir.ref<!fir.array<2x2xf32>>, i32) -> !hlfir.expr<2xf32>
8081
return
8182
}
@@ -87,8 +88,8 @@ func.func @maxval_no_effects(%arg0: !hlfir.expr<?xf32>) {
8788
}
8889

8990
func.func @maxval_effects(%arg0: !fir.ref<!fir.array<2x2xf32>>, %arg1: i32) {
90-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
91-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
91+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
92+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
9293
%maxval = hlfir.maxval %arg0 dim %arg1 : (!fir.ref<!fir.array<2x2xf32>>, i32) -> !hlfir.expr<2xf32>
9394
return
9495
}
@@ -100,34 +101,34 @@ func.func @minval_no_effects(%arg0: !hlfir.expr<?xf32>) {
100101
}
101102

102103
func.func @minval_effects(%arg0: !fir.ref<!fir.array<2x2xf32>>, %arg1: i32) {
103-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
104-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
104+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
105+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
105106
%minval = hlfir.minval %arg0 dim %arg1 : (!fir.ref<!fir.array<2x2xf32>>, i32) -> !hlfir.expr<2xf32>
106107
return
107108
}
108109

109110
func.func @minloc_effects_simple(%arg0: !hlfir.expr<?xf32>) {
110-
// expected-remark@+1 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
111+
// expected-remark@+1 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
111112
%minloc = hlfir.minloc %arg0 : (!hlfir.expr<?xf32>) -> !hlfir.expr<?xi32>
112113
return
113114
}
114115

115116
func.func @minloc_effects(%arg0: !fir.ref<!fir.array<2x2xf32>>, %arg1: i32) {
116-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
117-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
117+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
118+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
118119
%minloc = hlfir.minloc %arg0 dim %arg1 : (!fir.ref<!fir.array<2x2xf32>>, i32) -> !hlfir.expr<2xi32>
119120
return
120121
}
121122

122123
func.func @maxloc_effects_simple(%arg0: !hlfir.expr<?xf32>) {
123-
// expected-remark@+1 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
124+
// expected-remark@+1 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
124125
%maxloc = hlfir.maxloc %arg0 : (!hlfir.expr<?xf32>) -> !hlfir.expr<?xi32>
125126
return
126127
}
127128

128129
func.func @maxloc_effects(%arg0: !fir.ref<!fir.array<2x2xf32>>, %arg1: i32) {
129-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
130-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
130+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
131+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
131132
%maxloc = hlfir.maxloc %arg0 dim %arg1 : (!fir.ref<!fir.array<2x2xf32>>, i32) -> !hlfir.expr<2xi32>
132133
return
133134
}
@@ -139,49 +140,49 @@ func.func @dot_product_no_effects(%arg0: !hlfir.expr<?xf32>, %arg1: !hlfir.expr<
139140
}
140141

141142
func.func @dot_product_effects(%arg0: !fir.ref<!fir.array<10xf32>>, %arg1: !fir.ref<!fir.array<10xf32>>) {
142-
// there are read effects on both arguments - the diagnostic verification just doesn't register duplicate identical diagnostics
143-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
143+
// expected-remark@+2 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
144+
// expected-remark@+1 {{found an instance of 'read' on op operand 1, on resource '<Default>'}}
144145
%0 = hlfir.dot_product %arg0 %arg1 : (!fir.ref<!fir.array<10xf32>>, !fir.ref<!fir.array<10xf32>>) -> f32
145146
return
146147
}
147148

148149
func.func @matmul_no_reads(%arg0: !hlfir.expr<?x?xf32>, %arg1: !hlfir.expr<?x?xf32>) {
149-
// expected-remark@+1 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
150+
// expected-remark@+1 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
150151
%0 = hlfir.matmul %arg0 %arg1 : (!hlfir.expr<?x?xf32>, !hlfir.expr<?x?xf32>) -> !hlfir.expr<?x?xf32>
151152
return
152153
}
153154

154155
func.func @matmul_reads(%arg0: !fir.ref<!fir.array<10x5xf32>>, %arg1: !fir.ref<!fir.array<5x10xf32>>) {
155-
// expected-remark@+3 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
156-
// there are read effects on both arguments - the diagnostic verification just doesn't register duplicate identical diagnostics
157-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
156+
// expected-remark@+3 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
157+
// expected-remark@+2 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
158+
// expected-remark@+1 {{found an instance of 'read' on op operand 1, on resource '<Default>'}}
158159
%0 = hlfir.matmul %arg0 %arg1 : (!fir.ref<!fir.array<10x5xf32>>, !fir.ref<!fir.array<5x10xf32>>) -> !hlfir.expr<10x10xf32>
159160
return
160161
}
161162

162163
func.func @transpose_no_reads(%arg0: !hlfir.expr<?x?xf32>) {
163-
// expected-remark@+1 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
164+
// expected-remark@+1 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
164165
%0 = hlfir.transpose %arg0 : (!hlfir.expr<?x?xf32>) -> !hlfir.expr<?x?xf32>
165166
return
166167
}
167168

168169
func.func @transpose_read(%arg0: !fir.ref<!fir.array<10x5xf32>>) {
169-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
170-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
170+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
171+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
171172
%0 = hlfir.transpose %arg0 : (!fir.ref<!fir.array<10x5xf32>>) -> !hlfir.expr<5x10xf32>
172173
return
173174
}
174175

175176
func.func @matmul_transpose_no_reads(%arg0: !hlfir.expr<?x?xf32>, %arg1: !hlfir.expr<?x?xf32>) {
176-
// expected-remark@+1 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
177+
// expected-remark@+1 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
177178
%0 = hlfir.matmul_transpose %arg0 %arg1 : (!hlfir.expr<?x?xf32>, !hlfir.expr<?x?xf32>) -> !hlfir.expr<?x?xf32>
178179
return
179180
}
180181

181182
func.func @matmul_transpose_reads(%arg0: !fir.ref<!fir.array<5x10xf32>>, %arg1: !fir.ref<!fir.array<5x10xf32>>) {
182-
// expected-remark@+3 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
183-
// there are read effects on both arguments - the diagnostic verification just doesn't register duplicate identical diagnostics
184-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
183+
// expected-remark@+3 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
184+
// expected-remark@+2 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
185+
// expected-remark@+1 {{found an instance of 'read' on op operand 1, on resource '<Default>'}}
185186
%0 = hlfir.matmul_transpose %arg0 %arg1 : (!fir.ref<!fir.array<5x10xf32>>, !fir.ref<!fir.array<5x10xf32>>) -> !hlfir.expr<10x10xf32>
186187
return
187188
}
@@ -195,37 +196,37 @@ func.func @associate(%arg0: i32) {
195196
}
196197

197198
func.func @as_expr_read(%arg0: !fir.ref<!fir.array<2xi32>>) {
198-
// expected-remark@+2 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
199-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
199+
// expected-remark@+2 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
200+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
200201
%0 = hlfir.as_expr %arg0 : (!fir.ref<!fir.array<2xi32>>) -> !hlfir.expr<?xi32>
201202
// expected-remark@+1 {{found an instance of 'free' on resource '<Default>'}}
202203
hlfir.destroy %0 : !hlfir.expr<?xi32>
203204
return
204205
}
205206

206207
func.func @char_extremum(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.char<1,20>>) {
207-
// expected-remark@+3 {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
208-
// there are read effects on both arguments - the diagnostic verification just doesn't register duplicate identical diagnostics
209-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
208+
// expected-remark@+3 {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
209+
// expected-remark@+2 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
210+
// expected-remark@+1 {{found an instance of 'read' on op operand 1, on resource '<Default>'}}
210211
%0 = hlfir.char_extremum min, %arg0, %arg1 : (!fir.ref<!fir.char<1, 10>>, !fir.ref<!fir.char<1,20>>) -> !hlfir.expr<!fir.char<1,10>>
211212
return
212213
}
213214

214215
func.func @copy_in(%box: !fir.box<!fir.array<?xf64>>, %temp: !fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>, %is_present: i1) {
215216
// expected-remark@+3 {{found an instance of 'allocate' on resource '<Default>'}}
216-
// expected-remark@+2 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
217-
// expected-remark@+1 {{found an instance of 'write' on a op operand, on resource '<Default>'}}
217+
// expected-remark@+2 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
218+
// expected-remark@+1 {{found an instance of 'write' on op operand 1, on resource '<Default>'}}
218219
%0:2 = hlfir.copy_in %box to %temp : (!fir.box<!fir.array<?xf64>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>) -> (!fir.box<!fir.array<?xf64>>, i1)
219220
return
220221
}
221222

222223
func.func @copy_out(%box: !fir.box<!fir.array<?xf64>>, %temp: !fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>, %was_copied: i1) {
223224
// expected-remark@+2 {{found an instance of 'free' on resource '<Default>'}}
224-
// expected-remark@+1 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
225+
// expected-remark@+1 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
225226
hlfir.copy_out %temp, %was_copied : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>, i1) -> ()
226227
// expected-remark@+3 {{found an instance of 'free' on resource '<Default>'}}
227-
// expected-remark@+2 {{found an instance of 'read' on a op operand, on resource '<Default>'}}
228-
// expected-remark@+1 {{found an instance of 'write' on a op operand, on resource '<Default>'}}
228+
// expected-remark@+2 {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
229+
// expected-remark@+1 {{found an instance of 'write' on op operand 2, on resource '<Default>'}}
229230
hlfir.copy_out %temp, %was_copied to %box : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>, i1, !fir.box<!fir.array<?xf64>>) -> ()
230231
return
231232
}

mlir/lib/Dialect/Vector/IR/VectorOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5038,7 +5038,7 @@ void TransferWriteOp::getEffects(
50385038
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
50395039
&effects) {
50405040
if (llvm::isa<MemRefType>(getShapedType()))
5041-
effects.emplace_back(MemoryEffects::Write::get(), &getValueToStoreMutable(),
5041+
effects.emplace_back(MemoryEffects::Write::get(), &getBaseMutable(),
50425042
SideEffects::DefaultResource::get());
50435043
}
50445044

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// RUN: mlir-opt %s --test-side-effects --verify-diagnostics
22

33
func.func @test_side_effects(%arg0: memref<2xi32>) -> memref<2xi32> {
4-
// expected-remark @below {{found an instance of 'read' on a op operand, on resource '<Default>'}}
5-
// expected-remark @below {{found an instance of 'write' on a op result, on resource '<Default>'}}
6-
// expected-remark @below {{found an instance of 'allocate' on a op result, on resource '<Default>'}}
4+
// expected-remark @below {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
5+
// expected-remark @below {{found an instance of 'write' on op result 0, on resource '<Default>'}}
6+
// expected-remark @below {{found an instance of 'allocate' on op result 0, on resource '<Default>'}}
77
%0 = bufferization.clone %arg0 : memref<2xi32> to memref<2xi32>
88
return %0 : memref<2xi32>
99
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: mlir-opt %s --test-side-effects --verify-diagnostics
2+
3+
func.func @test_side_effects(%arg0: memref<8xf32>) {
4+
// expected-remark @below {{operation has no memory effects}}
5+
%c0 = arith.constant 0 : index
6+
// expected-remark @below {{operation has no memory effects}}
7+
%c4 = arith.constant 4 : index
8+
// expected-remark @below {{operation has no memory effects}}
9+
%cst = arith.constant 0.0 : f32
10+
// expected-remark @below {{found an instance of 'read' on op operand 0, on resource '<Default>'}}
11+
%0 = vector.transfer_read %arg0[%c0], %cst : memref<8xf32>, vector<4xf32>
12+
// expected-remark @below {{found an instance of 'write' on op operand 1, on resource '<Default>'}}
13+
vector.transfer_write %0, %arg0[%c4] : vector<4xf32>, memref<8xf32>
14+
return
15+
}

0 commit comments

Comments
 (0)