@@ -374,7 +374,9 @@ static AccessedStorageResult getAccessedStorageFromAddress(SILValue sourceAddr)
374
374
375
375
// Access to a Builtin.RawPointer. Treat this like the inductive cases
376
376
// above because some RawPointers originate from identified locations. See
377
- // the special case for global addressors, which return RawPointer, above.
377
+ // the special case for global addressors, which return RawPointer,
378
+ // above. AddressToPointer is also handled because it results from inlining a
379
+ // global addressor without folding the AddressToPointer->PointerToAddress.
378
380
//
379
381
// If the inductive search does not find a valid addressor, it will
380
382
// eventually reach the default case that returns in invalid location. This
@@ -393,6 +395,7 @@ static AccessedStorageResult getAccessedStorageFromAddress(SILValue sourceAddr)
393
395
// marks debug VarDecl access as 'Unsafe' and SIL passes don't need the
394
396
// AccessedStorage for 'Unsafe' access.
395
397
case ValueKind::PointerToAddressInst:
398
+ case ValueKind::AddressToPointerInst:
396
399
return AccessedStorageResult::incomplete (
397
400
cast<SingleValueInstruction>(sourceAddr)->getOperand (0 ));
398
401
@@ -432,6 +435,8 @@ AccessedStorage swift::findAccessedStorage(SILValue sourceAddr) {
432
435
storage = result.getStorage ();
433
436
continue ;
434
437
}
438
+ // `storage` may still be invalid. If both `storage` and `result` are
439
+ // invalid, this check passes, but we return an invalid storage below.
435
440
if (!accessingIdenticalLocations (storage.getValue (), result.getStorage ()))
436
441
return AccessedStorage ();
437
442
}
0 commit comments