mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
I found this while looking at problems around library evolution for noncopyable types. Specifically:
```
+public func borrowVal(_ x: borrowing CopyableStruct) {}
```
causes an error since we do not recognize the load_borrow here:
```
+sil [ossa] @testSimpleBorrowParameter : $@convention(thin) (@in_guaranteed CopyableStruct) -> () {
+bb0(%0 : @noImplicitCopy $*CopyableStruct):
+ %1 = load_borrow %0 : $*CopyableStruct // users: %7, %2
+ %2 = copyable_to_moveonlywrapper [guaranteed] %1 : $CopyableStruct // user: %3
+ %3 = copy_value %2 : $@moveOnly CopyableStruct // user: %4
+ %4 = mark_must_check [no_consume_or_assign] %3 : $@moveOnly CopyableStruct // users: %6, %5
+ debug_value %4 : $@moveOnly CopyableStruct, let, name "x", argno 1 // id: %5
+ destroy_value %4 : $@moveOnly CopyableStruct // id: %6
+ end_borrow %1 : $CopyableStruct // id: %7
+ %8 = tuple () // user: %9
+ return %8 : $() // id: %9
+}
```
rdar://112028837
29 KiB
29 KiB