Skip to content

Commit 8167686

Browse files
committed
[ObjCBridgingOpt] Look through copy_value insts.
1 parent 969bfe1 commit 8167686

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ObjCBridgingOptimization.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,14 @@ private func removeBridgingCodeInPredecessors(of block: BasicBlock, _ context: F
246246
}
247247

248248
private func lookThroughOwnershipInsts(_ value: Value) -> Value {
249-
// Looks like it's sufficient to support begin_borrow for now.
250-
// TODO: add copy_value if needed.
249+
// Looks like it's sufficient to support begin_borrow and copy_value for now.
250+
// TODO: add move_value if needed.
251251
if let bbi = value as? BeginBorrowInst {
252252
return bbi.borrowedValue
253253
}
254+
if let cvi = value as? CopyValueInst {
255+
return cvi.fromValue
256+
}
254257
return value
255258
}
256259

0 commit comments

Comments
 (0)