@@ -62,6 +62,9 @@ public protocol Comparable {
62
62
static func < (lhs: Self, rhs: Self) -> Bool
63
63
}
64
64
65
+ sil [ossa] @unknown : $@convention(thin) () -> ()
66
+ sil [ossa] @getT : $@convention(thin) <T> () -> @out T
67
+ sil [ossa] @getPair : $@convention(thin) <T> () -> @out Pair<T>
65
68
sil [ossa] @takeGuaranteedObject : $@convention(thin) (@guaranteed AnyObject) -> ()
66
69
sil [ossa] @takeIndirectClass : $@convention(thin) (@in_guaranteed C) -> ()
67
70
sil [ossa] @takeTuple : $@convention(thin) <τ_0_0> (@in_guaranteed (τ_0_0, C)) -> ()
@@ -1225,6 +1228,51 @@ bb2(%9 : $Error):
1225
1228
throw %9 : $Error
1226
1229
}
1227
1230
1231
+ // CHECK-LABEL: sil [ossa] @lexical_borrow_struct_extract {{.*}} {
1232
+ // CHECK: [[PAIR_ADDR:%[^,]+]] = alloc_stack [lexical]
1233
+ // CHECK: [[X_ADDR:%[^,]+]] = struct_element_addr [[PAIR_ADDR]]
1234
+ // CHECK: apply {{%[^,]+}}<T>([[X_ADDR]])
1235
+ // CHECK: destroy_addr [[PAIR_ADDR]]
1236
+ // CHECK: dealloc_stack [[PAIR_ADDR]]
1237
+ // CHECK-LABEL: } // end sil function 'lexical_borrow_struct_extract'
1238
+ sil [ossa] @lexical_borrow_struct_extract : $@convention(thin) <T> () -> () {
1239
+ %getPair = function_ref @getPair : $@convention(thin) <Tee> () -> @out Pair<Tee>
1240
+ %instance = apply %getPair<T>() : $@convention(thin) <Tee> () -> @out Pair<Tee>
1241
+ %scope = begin_borrow %instance : $Pair<T>
1242
+ %x = struct_extract %scope : $Pair<T>, #Pair.x
1243
+ %lifetime = begin_borrow [lexical] %x : $T
1244
+ %takeInGuaranteed = function_ref @takeInGuaranteed : $@convention(thin) <Tee> (@in_guaranteed Tee) -> ()
1245
+ apply %takeInGuaranteed<T>(%lifetime) : $@convention(thin) <Tee> (@in_guaranteed Tee) -> ()
1246
+ %unknown = function_ref @unknown : $@convention(thin) () -> ()
1247
+ apply %unknown() : $@convention(thin) () -> ()
1248
+ end_borrow %lifetime : $T
1249
+ end_borrow %scope : $Pair<T>
1250
+ destroy_value %instance : $Pair<T>
1251
+ %retval = tuple ()
1252
+ return %retval : $()
1253
+ }
1254
+
1255
+ // CHECK-LABEL: sil [ossa] @lexical_borrow_struct_extract_arg {{.*}} {
1256
+ // CHECK: [[X_ADDR:%[^,]+]] = struct_element_addr [[PAIR_ADDR]]
1257
+ // CHECK: apply {{%[^,]+}}<T>([[X_ADDR]])
1258
+ // CHECK: destroy_addr [[PAIR_ADDR]]
1259
+ // CHECK-LABEL: } // end sil function 'lexical_borrow_struct_extract_arg'
1260
+ sil [ossa] @lexical_borrow_struct_extract_arg : $@convention(thin) <T> (@in Pair<T>) -> () {
1261
+ entry(%instance : @owned $Pair<T>):
1262
+ %scope = begin_borrow %instance : $Pair<T>
1263
+ %x = struct_extract %scope : $Pair<T>, #Pair.x
1264
+ %lifetime = begin_borrow [lexical] %x : $T
1265
+ %takeInGuaranteed = function_ref @takeInGuaranteed : $@convention(thin) <Tee> (@in_guaranteed Tee) -> ()
1266
+ apply %takeInGuaranteed<T>(%lifetime) : $@convention(thin) <Tee> (@in_guaranteed Tee) -> ()
1267
+ %unknown = function_ref @unknown : $@convention(thin) () -> ()
1268
+ apply %unknown() : $@convention(thin) () -> ()
1269
+ end_borrow %lifetime : $T
1270
+ end_borrow %scope : $Pair<T>
1271
+ destroy_value %instance : $Pair<T>
1272
+ %retval = tuple ()
1273
+ return %retval : $()
1274
+ }
1275
+
1228
1276
sil hidden [ossa] @testBeginApplyDeadYield : $@convention(thin) <T> (@guaranteed TestGeneric<T>) -> () {
1229
1277
bb0(%0 : @guaranteed $TestGeneric<T>):
1230
1278
%2 = class_method %0 : $TestGeneric<T>, #TestGeneric.borrowedGeneric!read : <T> (TestGeneric<T>) -> () -> (), $@yield_once @convention(method) <τ_0_0> (@guaranteed TestGeneric<τ_0_0>) -> @yields @in_guaranteed τ_0_0
@@ -1493,4 +1541,3 @@ bb0(%0 : @guaranteed $T):
1493
1541
destroy_value %3 : $U
1494
1542
return %6 : $U
1495
1543
}
1496
-
0 commit comments