Skip to content

Commit b8cd763

Browse files
authored
Merge branch 'main' into bump-swift-version-to-6
2 parents 9a1d86c + d3d4bd2 commit b8cd763

File tree

235 files changed

+4635
-947
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+4635
-947
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceDiagnostics.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@ extension DiagnoseDependenceWalker : LifetimeDependenceDefUseWalker {
375375
return diagnostics.checkFunctionResult(operand: operand)
376376
}
377377

378+
mutating func yieldedDependence(result: Operand) -> WalkResult {
379+
return diagnostics.checkFunctionResult(operand: result)
380+
}
381+
378382
// Override AddressUseVisitor here because LifetimeDependenceDefUseWalker
379383
// returns .abortWalk, and we want a more useful crash report.
380384
mutating func unknownAddressUse(of operand: Operand) -> WalkResult {

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceScopeFixup.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,9 @@ private struct LifetimeDependenceScopeFixupWalker : LifetimeDependenceDefUseWalk
168168
using operand: Operand) -> WalkResult {
169169
return .continueWalk
170170
}
171+
172+
mutating func yieldedDependence(result: Operand) -> WalkResult {
173+
return .continueWalk
174+
}
171175
}
172176

SwiftCompilerSources/Sources/Optimizer/Utilities/LifetimeDependenceUtils.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ extension LifetimeDependenceUseDefWalker {
780780
/// escapingDependence(on operand: Operand) -> WalkResult
781781
/// returnedDependence(result: Operand) -> WalkResult
782782
/// returnedDependence(address: FunctionArgument, using: Operand) -> WalkResult
783-
///
783+
/// yieldedDependence(result: Operand) -> WalkResult
784784
/// Start walking:
785785
/// walkDown(root: Value)
786786
protocol LifetimeDependenceDefUseWalker : ForwardingDefUseWalker,
@@ -796,6 +796,8 @@ protocol LifetimeDependenceDefUseWalker : ForwardingDefUseWalker,
796796

797797
mutating func returnedDependence(address: FunctionArgument, using: Operand)
798798
-> WalkResult
799+
800+
mutating func yieldedDependence(result: Operand) -> WalkResult
799801
}
800802

801803
extension LifetimeDependenceDefUseWalker {
@@ -841,6 +843,9 @@ extension LifetimeDependenceDefUseWalker {
841843
if operand.instruction is ReturnInst, !operand.value.type.isEscapable {
842844
return returnedDependence(result: operand)
843845
}
846+
if operand.instruction is YieldInst, !operand.value.type.isEscapable {
847+
return yieldedDependence(result: operand)
848+
}
844849
return escapingDependence(on: operand)
845850
}
846851
}
@@ -1009,6 +1014,9 @@ extension LifetimeDependenceDefUseWalker {
10091014
if operand.instruction is ReturnInst, !operand.value.type.isEscapable {
10101015
return returnedDependence(result: operand)
10111016
}
1017+
if operand.instruction is YieldInst, !operand.value.type.isEscapable {
1018+
return yieldedDependence(result: operand)
1019+
}
10121020
return escapingDependence(on: operand)
10131021
}
10141022

@@ -1208,6 +1216,11 @@ private struct LifetimeDependenceUsePrinter : LifetimeDependenceDefUseWalker {
12081216
print("Returned use: \(operand) in: \(address)")
12091217
return .continueWalk
12101218
}
1219+
1220+
mutating func yieldedDependence(result: Operand) -> WalkResult {
1221+
print("Yielded use: \(result)")
1222+
return .continueWalk
1223+
}
12111224
}
12121225

12131226
let lifetimeDependenceUseTest = FunctionTest("lifetime_dependence_use") {

0 commit comments

Comments
 (0)