@@ -29,7 +29,8 @@ struct A {
29
29
30
30
// CHECK-LABEL: sil hidden @_T010addressors1AV9subscripts5Int32VAFcfau : $@convention(method) (Int32, @inout A) -> UnsafeMutablePointer<Int32>
31
31
// CHECK: bb0([[INDEX:%.*]] : $Int32, [[SELF:%.*]] : $*A):
32
- // CHECK: [[T0:%.*]] = struct_element_addr [[SELF]] : $*A, #A.base
32
+ // CHECK: [[READ:%.*]] = begin_access [read] [static] [[SELF]] : $*A
33
+ // CHECK: [[T0:%.*]] = struct_element_addr [[READ]] : $*A, #A.base
33
34
// CHECK: [[BASE:%.*]] = load [[T0]] : $*UnsafeMutablePointer<Int32>
34
35
// CHECK: return [[BASE]] : $UnsafeMutablePointer<Int32>
35
36
@@ -49,17 +50,19 @@ func test0() {
49
50
// CHECK: [[Z:%.*]] = load [[T3]] : $*Int32
50
51
let z = a [ 10 ]
51
52
53
+ // CHECK: [[WRITE:%.*]] = begin_access [modify] [static] [[A]] : $*A
52
54
// CHECK: [[T0:%.*]] = function_ref @_T010addressors1AV9subscripts5Int32VAFcfau :
53
- // CHECK: [[T1:%.*]] = apply [[T0]]({{%.*}}, [[A ]])
55
+ // CHECK: [[T1:%.*]] = apply [[T0]]({{%.*}}, [[WRITE ]])
54
56
// CHECK: [[T2:%.*]] = struct_extract [[T1]] : $UnsafeMutablePointer<Int32>, #UnsafeMutablePointer._rawValue
55
57
// CHECK: [[T3:%.*]] = pointer_to_address [[T2]] : $Builtin.RawPointer to [strict] $*Int32
56
58
// CHECK: load
57
59
// CHECK: sadd_with_overflow_Int{{32|64}}
58
60
// CHECK: store {{%.*}} to [[T3]]
59
61
a [ 5 ] += z
60
62
63
+ // CHECK: [[WRITE:%.*]] = begin_access [modify] [static] [[A]] : $*A
61
64
// CHECK: [[T0:%.*]] = function_ref @_T010addressors1AV9subscripts5Int32VAFcfau :
62
- // CHECK: [[T1:%.*]] = apply [[T0]]({{%.*}}, [[A ]])
65
+ // CHECK: [[T1:%.*]] = apply [[T0]]({{%.*}}, [[WRITE ]])
63
66
// CHECK: [[T2:%.*]] = struct_extract [[T1]] : $UnsafeMutablePointer<Int32>, #UnsafeMutablePointer._rawValue
64
67
// CHECK: [[T3:%.*]] = pointer_to_address [[T2]] : $Builtin.RawPointer to [strict] $*Int32
65
68
// CHECK: store {{%.*}} to [[T3]]
@@ -122,8 +125,9 @@ struct B : Subscriptable {
122
125
// CHECK: [[T0:%.*]] = integer_literal $Builtin.Int32, 0
123
126
// CHECK: [[INDEX:%.*]] = struct $Int32 ([[T0]] : $Builtin.Int32)
124
127
// CHECK: [[RHS:%.*]] = integer_literal $Builtin.Int32, 7
128
+ // CHECK: [[WRITE:%.*]] = begin_access [modify] [static] [[B]] : $*B
125
129
// CHECK: [[T0:%.*]] = function_ref @_T010addressors1BV9subscripts5Int32VAFcfau
126
- // CHECK: [[PTR:%.*]] = apply [[T0]]([[INDEX]], [[B ]])
130
+ // CHECK: [[PTR:%.*]] = apply [[T0]]([[INDEX]], [[WRITE ]])
127
131
// CHECK: [[T0:%.*]] = struct_extract [[PTR]] : $UnsafeMutablePointer<Int32>,
128
132
// CHECK: [[ADDR:%.*]] = pointer_to_address [[T0]] : $Builtin.RawPointer to [strict] $*Int32
129
133
// Accept either of struct_extract+load or load+struct_element_addr.
@@ -149,14 +153,16 @@ func id_int(_ i: Int32) -> Int32 { return i }
149
153
// CHECK-LABEL: sil hidden @_T010addressors11test_carrays5Int32VAA6CArrayVyA2DcGzF : $@convention(thin) (@inout CArray<(Int32) -> Int32>) -> Int32 {
150
154
// CHECK: bb0([[ARRAY:%.*]] : $*CArray<(Int32) -> Int32>):
151
155
func test_carray( _ array: inout CArray < ( Int32 ) -> Int32 > ) -> Int32 {
156
+ // CHECK: [[WRITE:%.*]] = begin_access [modify] [static] [[ARRAY]] : $*CArray<(Int32) -> Int32>
152
157
// CHECK: [[T0:%.*]] = function_ref @_T010addressors6CArrayV9subscriptxSicfau :
153
- // CHECK: [[T1:%.*]] = apply [[T0]]<(Int32) -> Int32>({{%.*}}, [[ARRAY ]])
158
+ // CHECK: [[T1:%.*]] = apply [[T0]]<(Int32) -> Int32>({{%.*}}, [[WRITE ]])
154
159
// CHECK: [[T2:%.*]] = struct_extract [[T1]] : $UnsafeMutablePointer<(Int32) -> Int32>, #UnsafeMutablePointer._rawValue
155
160
// CHECK: [[T3:%.*]] = pointer_to_address [[T2]] : $Builtin.RawPointer to [strict] $*@callee_owned (@in Int32) -> @out Int32
156
161
// CHECK: store {{%.*}} to [[T3]] :
157
162
array [ 0 ] = id_int
158
163
159
- // CHECK: [[T0:%.*]] = load [[ARRAY]]
164
+ // CHECK: [[READ:%.*]] = begin_access [read] [static] [[ARRAY]] : $*CArray<(Int32) -> Int32>
165
+ // CHECK: [[T0:%.*]] = load [[READ]]
160
166
// CHECK: [[T1:%.*]] = function_ref @_T010addressors6CArrayV9subscriptxSicflu :
161
167
// CHECK: [[T2:%.*]] = apply [[T1]]<(Int32) -> Int32>({{%.*}}, [[T0]])
162
168
// CHECK: [[T3:%.*]] = struct_extract [[T2]] : $UnsafePointer<(Int32) -> Int32>, #UnsafePointer._rawValue
@@ -205,22 +211,25 @@ func take_int_inout(_ value: inout Int32) {}
205
211
func test_d( _ array: inout D ) -> Int32 {
206
212
// CHECK: [[T0:%.*]] = function_ref @_T010addressors8make_ints5Int32VyF
207
213
// CHECK: [[V:%.*]] = apply [[T0]]()
214
+ // CHECK: [[WRITE:%.*]] = begin_access [modify] [static] [[ARRAY]] : $*D
208
215
// CHECK: [[T0:%.*]] = function_ref @_T010addressors1DV9subscripts5Int32VAFcfau
209
- // CHECK: [[T1:%.*]] = apply [[T0]]({{%.*}}, [[ARRAY ]])
216
+ // CHECK: [[T1:%.*]] = apply [[T0]]({{%.*}}, [[WRITE ]])
210
217
// CHECK: [[T2:%.*]] = struct_extract [[T1]] : $UnsafeMutablePointer<Int32>,
211
218
// CHECK: [[ADDR:%.*]] = pointer_to_address [[T2]] : $Builtin.RawPointer to [strict] $*Int32
212
219
// CHECK: store [[V]] to [[ADDR]] : $*Int32
213
220
array [ 0 ] = make_int ( )
214
221
215
222
// CHECK: [[FN:%.*]] = function_ref @_T010addressors14take_int_inoutys5Int32VzF
223
+ // CHECK: [[WRITE:%.*]] = begin_access [modify] [static] [[ARRAY]] : $*D
216
224
// CHECK: [[T0:%.*]] = function_ref @_T010addressors1DV9subscripts5Int32VAFcfau
217
- // CHECK: [[T1:%.*]] = apply [[T0]]({{%.*}}, [[ARRAY ]])
225
+ // CHECK: [[T1:%.*]] = apply [[T0]]({{%.*}}, [[WRITE ]])
218
226
// CHECK: [[T2:%.*]] = struct_extract [[T1]] : $UnsafeMutablePointer<Int32>,
219
227
// CHECK: [[ADDR:%.*]] = pointer_to_address [[T2]] : $Builtin.RawPointer to [strict] $*Int32
220
228
// CHECK: apply [[FN]]([[ADDR]])
221
229
take_int_inout ( & array[ 1 ] )
222
230
223
- // CHECK: [[T0:%.*]] = load [[ARRAY]]
231
+ // CHECK: [[READ:%.*]] = begin_access [read] [static] [[ARRAY]] : $*D
232
+ // CHECK: [[T0:%.*]] = load [[READ]]
224
233
// CHECK: [[T1:%.*]] = function_ref @_T010addressors1DV9subscripts5Int32VAFcfg
225
234
// CHECK: [[T2:%.*]] = apply [[T1]]({{%.*}}, [[T0]])
226
235
// CHECK: return [[T2]]
0 commit comments