@@ -241,6 +241,12 @@ AccessedStorage swift::findAccessedStorage(SILValue sourceAddr) {
241
241
if (kind != AccessedStorage::Unidentified)
242
242
return AccessedStorage (address, kind);
243
243
244
+ // If the address producer cannot immediately be classified, follow the
245
+ // use-def chain of address, box, or RawPointer producers.
246
+ assert (address->getType ().isAddress ()
247
+ || isa<SILBoxType>(address->getType ().getASTType ())
248
+ || isa<BuiltinRawPointerType>(address->getType ().getASTType ()));
249
+
244
250
// Handle other unidentified address sources.
245
251
switch (address->getKind ()) {
246
252
default :
@@ -294,6 +300,12 @@ AccessedStorage swift::findAccessedStorage(SILValue sourceAddr) {
294
300
return AccessedStorage ();
295
301
}
296
302
303
+ // ref_tail_addr project an address from a reference.
304
+ // This is a valid address producer for nested @inout argument
305
+ // access, but it is never used for formal access of identified objects.
306
+ case ValueKind::RefTailAddrInst:
307
+ return AccessedStorage (address, AccessedStorage::Unidentified);
308
+
297
309
// Inductive cases:
298
310
// Look through address casts to find the source address.
299
311
case ValueKind::MarkUninitializedInst:
@@ -338,11 +350,10 @@ AccessedStorage swift::findAccessedStorage(SILValue sourceAddr) {
338
350
address = cast<SingleValueInstruction>(address)->getOperand (0 );
339
351
continue ;
340
352
341
- // Subobject projections.
353
+ // Address-to-address subobject projections.
342
354
case ValueKind::StructElementAddrInst:
343
355
case ValueKind::TupleElementAddrInst:
344
356
case ValueKind::UncheckedTakeEnumDataAddrInst:
345
- case ValueKind::RefTailAddrInst:
346
357
case ValueKind::TailAddrInst:
347
358
case ValueKind::IndexAddrInst:
348
359
address = cast<SingleValueInstruction>(address)->getOperand (0 );
0 commit comments