Skip to content

Commit 0f728f0

Browse files
committed
Fix BorrowingInstruction.visitEndBorrows to handle borrowed-from
For borrowed-from of a reborrow, the value is the block argument. So we need to look through the borrowed-from user.
1 parent 353bef7 commit 0f728f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SwiftCompilerSources/Sources/Optimizer/Utilities/BorrowUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ enum BorrowingInstruction : CustomStringConvertible, Hashable {
299299
extension BorrowingInstruction {
300300
private func visitEndBorrows(value: Value, _ context: Context, _ visitor: @escaping (Operand) -> WalkResult)
301301
-> WalkResult {
302-
return value.uses.filterUsers(ofType: EndBorrowInst.self).walk {
302+
return value.lookThroughBorrowedFromUser.uses.filterUsers(ofType: EndBorrowInst.self).walk {
303303
visitor($0)
304304
}
305305
}

0 commit comments

Comments
 (0)