Tweak exclusivity access marker verification.

Narrow the list of address producers that verification can "peek through"
to avoid trigger an assertion in the previous commit with
-enable-verify-exclusivity.
This commit is contained in:
Andrew Trick
2018-07-13 14:58:37 -07:00
parent df0214a27b
commit 5373f346e9
2 changed files with 13 additions and 3 deletions

View File

@@ -241,6 +241,12 @@ AccessedStorage swift::findAccessedStorage(SILValue sourceAddr) {
if (kind != AccessedStorage::Unidentified)
return AccessedStorage(address, kind);
// If the address producer cannot immediately be classified, follow the
// use-def chain of address, box, or RawPointer producers.
assert(address->getType().isAddress()
|| isa<SILBoxType>(address->getType().getASTType())
|| isa<BuiltinRawPointerType>(address->getType().getASTType()));
// Handle other unidentified address sources.
switch (address->getKind()) {
default:
@@ -294,6 +300,12 @@ AccessedStorage swift::findAccessedStorage(SILValue sourceAddr) {
return AccessedStorage();
}
// ref_tail_addr project an address from a reference.
// This is a valid address producer for nested @inout argument
// access, but it is never used for formal access of identified objects.
case ValueKind::RefTailAddrInst:
return AccessedStorage(address, AccessedStorage::Unidentified);
// Inductive cases:
// Look through address casts to find the source address.
case ValueKind::MarkUninitializedInst:
@@ -338,11 +350,10 @@ AccessedStorage swift::findAccessedStorage(SILValue sourceAddr) {
address = cast<SingleValueInstruction>(address)->getOperand(0);
continue;
// Subobject projections.
// Address-to-address subobject projections.
case ValueKind::StructElementAddrInst:
case ValueKind::TupleElementAddrInst:
case ValueKind::UncheckedTakeEnumDataAddrInst:
case ValueKind::RefTailAddrInst:
case ValueKind::TailAddrInst:
case ValueKind::IndexAddrInst:
address = cast<SingleValueInstruction>(address)->getOperand(0);