mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
EscapeUtils: consider that a begin_apply can yield it's indirect arguments
This is the only apply instruction where address arguments actually can "escape"
This commit is contained in:
@@ -547,7 +547,9 @@ fileprivate struct EscapeWalker<V: EscapeVisitor> : ValueDefUseWalker,
|
||||
}
|
||||
|
||||
// Indirect arguments cannot escape the function, but loaded values from such can.
|
||||
if !followLoads(at: path.projectionPath) {
|
||||
if !followLoads(at: path.projectionPath) &&
|
||||
// Except for begin_apply: it can yield an address value.
|
||||
!apply.isBeginApplyWithIndirectResults {
|
||||
return .continueWalk
|
||||
}
|
||||
|
||||
@@ -824,3 +826,13 @@ private extension SmallProjectionPath {
|
||||
EscapeUtilityTypes.EscapePath(projectionPath: self, followStores: false, knownType: nil)
|
||||
}
|
||||
}
|
||||
|
||||
private extension ApplySite {
|
||||
var isBeginApplyWithIndirectResults: Bool {
|
||||
guard let ba = self as? BeginApplyInst else {
|
||||
return false
|
||||
}
|
||||
// Note that the token result is always a non-address type.
|
||||
return ba.results.contains { $0.type.isAddress }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user