@@ -362,7 +362,9 @@ static AccessedStorageResult getAccessedStorageFromAddress(SILValue sourceAddr)
362
362
363
363
// Access to a Builtin.RawPointer. Treat this like the inductive cases
364
364
// above because some RawPointers originate from identified locations. See
365
- // the special case for global addressors, which return RawPointer, above.
365
+ // the special case for global addressors, which return RawPointer,
366
+ // above. AddressToPointer is also handled because it results from inlining a
367
+ // global addressor without folding the AddressToPointer->PointerToAddress.
366
368
//
367
369
// If the inductive search does not find a valid addressor, it will
368
370
// eventually reach the default case that returns in invalid location. This
@@ -381,6 +383,7 @@ static AccessedStorageResult getAccessedStorageFromAddress(SILValue sourceAddr)
381
383
// marks debug VarDecl access as 'Unsafe' and SIL passes don't need the
382
384
// AccessedStorage for 'Unsafe' access.
383
385
case ValueKind::PointerToAddressInst:
386
+ case ValueKind::AddressToPointerInst:
384
387
return AccessedStorageResult::incomplete (
385
388
cast<SingleValueInstruction>(sourceAddr)->getOperand (0 ));
386
389
@@ -420,6 +423,8 @@ AccessedStorage swift::findAccessedStorage(SILValue sourceAddr) {
420
423
storage = result.getStorage ();
421
424
continue ;
422
425
}
426
+ // `storage` may still be invalid. If both `storage` and `result` are
427
+ // invalid, this check passes, but we return an invalid storage below.
423
428
if (!accessingIdenticalLocations (storage.getValue (), result.getStorage ()))
424
429
return AccessedStorage ();
425
430
}
0 commit comments