Skip to content

Commit 3e7d9db

Browse files
committed
AddressUseVisitor: follow mark_dependence [nonescaping].
Treat mark_dependence [nonescaping] as a dependent value even if the dependence base does not have a recognizable scope (e.g. a multiply-defined alloc_stack). This happens because ClosureLifetimeFixup creates redundant mark_dependence instructions for partial_apply captures. We constantly need to work around this broken representation of nonescaping closures.
1 parent 2e82db8 commit 3e7d9db

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

SwiftCompilerSources/Sources/Optimizer/Utilities/AddressUtils.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,18 @@ extension AddressUseVisitor {
9797
if markDep.type.isAddress {
9898
return projectedAddressUse(of: operand, into: markDep)
9999
}
100-
if LifetimeDependence(markDep, context) != nil {
101-
// This is unreachable from InteriorUseVisitor because the
102-
// base address of a `mark_dependence [nonescaping]` must be a
103-
// `begin_access`, and interior liveness does not check uses of
104-
// the accessed address.
100+
switch markDep.dependenceKind {
101+
case .Unresolved:
102+
if LifetimeDependence(markDep, context) == nil {
103+
break
104+
}
105+
fallthrough
106+
case .NonEscaping:
107+
// Note: This is unreachable from InteriorUseVisitor because the base address of a `mark_dependence
108+
// [nonescaping]` must be a `begin_access`, and interior liveness does not check uses of the accessed address.
105109
return dependentAddressUse(of: operand, into: markDep)
110+
case .Escaping:
111+
break
106112
}
107113
// A potentially escaping value depends on this address.
108114
return escapingAddressUse(of: operand)

0 commit comments

Comments
 (0)