Skip to content

Commit a7e4e90

Browse files
committed
Fix LifetimeDependenceUtils to use OwnershipTransitionInstruction
1 parent 760fa24 commit a7e4e90

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

SwiftCompilerSources/Sources/Optimizer/Utilities/LifetimeDependenceUtils.swift

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -706,12 +706,8 @@ extension LifetimeDependenceUseDefWalker {
706706
mutating func walkUpDefault(dependent value: Value, owner: Value?)
707707
-> WalkResult {
708708
switch value.definingInstruction {
709-
case let copyInst as CopyValueInst:
710-
return walkUp(newLifetime: copyInst.fromValue)
711-
case let moveInst as MoveValueInst:
712-
return walkUp(value: moveInst.fromValue, owner)
713-
case let borrow as BeginBorrowInst:
714-
return walkUp(newLifetime: borrow.borrowedValue)
709+
case let transition as OwnershipTransitionInstruction:
710+
return walkUp(newLifetime: transition.operand.value)
715711
case let load as LoadInstruction:
716712
return walkUp(address: load.address)
717713
case let markDep as MarkDependenceInst:
@@ -862,11 +858,8 @@ extension LifetimeDependenceDefUseWalker {
862858
return leafUse(of: operand)
863859
}
864860
switch operand.instruction {
865-
case let copy as CopyingInstruction:
866-
return walkDownUses(of: copy, using: operand)
867-
868-
case let move as MoveValueInst:
869-
return walkDownUses(of: move, using: operand)
861+
case let transition as OwnershipTransitionInstruction:
862+
return walkDownUses(of: transition.ownershipResult, using: operand)
870863

871864
case let mdi as MarkDependenceInst where mdi.isUnresolved:
872865
// Override mark_dependence [unresolved] to handle them just

0 commit comments

Comments
 (0)