Skip to content

Commit ff14633

Browse files
committed
Handle ConvertEscapeToNoEscapeInst in NonEscapingClosureDefUseWalker
1 parent 5e9e282 commit ff14633

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

SwiftCompilerSources/Sources/Optimizer/Utilities/ForwardingUtils.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,15 @@ extension NonEscapingClosureDefUseWalker: ForwardingDefUseWalker {
385385

386386
mutating func nonForwardingUse(of operand: Operand) -> WalkResult {
387387
// Nonescaping closures may be moved, copied, or borrowed.
388-
if let transition = operand.instruction as? OwnershipTransitionInstruction {
388+
switch operand.instruction {
389+
case let transition as OwnershipTransitionInstruction:
389390
return walkDownUses(of: transition.ownershipResult, using: operand)
391+
case let convert as ConvertEscapeToNoEscapeInst:
392+
return walkDownUses(of: convert, using: operand)
393+
default:
394+
// Otherwise, assume the use cannot propagate the closure context.
395+
return closureContextLeafUse(of: operand)
390396
}
391-
// Otherwise, assume the use cannot propagate the closure context.
392-
return closureContextLeafUse(of: operand)
393397
}
394398

395399
mutating func deadValue(_ value: Value, using operand: Operand?) -> WalkResult {

0 commit comments

Comments
 (0)