@@ -1493,14 +1493,15 @@ bb0(%0 : @owned $B):
1493
1493
return %2 : $F
1494
1494
}
1495
1495
1496
- // We do not support this in OSSA today.
1497
- //
1498
- // CHECK-LABEL: sil [ossa] @unchecked_ref_cast_formation : $@convention(thin) (@owned B) -> @owned F {
1499
- // XHECK: bb0([[INPUT_REF:%[0-9]+]] : @owned $B):
1500
- // XHECK: ref_to_raw_pointer
1501
- // XHECK: raw_pointer_to_ref
1502
- // XHECK: } // end sil function 'unchecked_ref_cast_formation'
1503
- sil [ossa] @unchecked_ref_cast_formation : $@convention(thin) (@owned B) -> @owned F {
1496
+ // CHECK-LABEL: sil [ossa] @unchecked_ref_cast_formation_owned : $@convention(thin) (@owned B) -> @owned F {
1497
+ // CHECK: bb0([[INPUT_REF:%[0-9]+]] : @owned $B):
1498
+ // CHECK-NOT: ref_to_raw_pointer
1499
+ // CHECK-NOT: raw_pointer_to_ref
1500
+ // CHECK: unchecked_ref_cast
1501
+ // CHECK-NOT: ref_to_raw_pointer
1502
+ // CHECK-NOT: raw_pointer_to_ref
1503
+ // CHECK: } // end sil function 'unchecked_ref_cast_formation_owned'
1504
+ sil [ossa] @unchecked_ref_cast_formation_owned : $@convention(thin) (@owned B) -> @owned F {
1504
1505
bb0(%0 : @owned $B):
1505
1506
%1 = ref_to_raw_pointer %0 : $B to $Builtin.RawPointer
1506
1507
%2 = raw_pointer_to_ref %1 : $Builtin.RawPointer to $F
@@ -1509,6 +1510,37 @@ bb0(%0 : @owned $B):
1509
1510
return %3 : $F
1510
1511
}
1511
1512
1513
+ // CHECK-LABEL: sil [ossa] @unchecked_ref_cast_formation_guaranteed : $@convention(thin) (@guaranteed B) -> @owned F {
1514
+ // CHECK: bb0([[INPUT_REF:%[0-9]+]] : @guaranteed $B):
1515
+ // CHECK-NOT: ref_to_raw_pointer
1516
+ // CHECK-NOT: raw_pointer_to_ref
1517
+ // CHECK: unchecked_ref_cast
1518
+ // CHECK-NOT: ref_to_raw_pointer
1519
+ // CHECK-NOT: raw_pointer_to_ref
1520
+ // CHECK: } // end sil function 'unchecked_ref_cast_formation_guaranteed'
1521
+ sil [ossa] @unchecked_ref_cast_formation_guaranteed : $@convention(thin) (@guaranteed B) -> @owned F {
1522
+ bb0(%0 : @guaranteed $B):
1523
+ %1 = ref_to_raw_pointer %0 : $B to $Builtin.RawPointer
1524
+ %2 = raw_pointer_to_ref %1 : $Builtin.RawPointer to $F
1525
+ %3 = copy_value %2 : $F
1526
+ return %3 : $F
1527
+ }
1528
+
1529
+ // CHECK-LABEL: sil [ossa] @unchecked_ref_cast_formation_unowned : $@convention(thin) (B) -> F {
1530
+ // CHECK: bb0([[INPUT_REF:%[0-9]+]] :
1531
+ // CHECK-NOT: ref_to_raw_pointer
1532
+ // CHECK-NOT: raw_pointer_to_ref
1533
+ // CHECK: unchecked_ref_cast
1534
+ // CHECK-NOT: ref_to_raw_pointer
1535
+ // CHECK-NOT: raw_pointer_to_ref
1536
+ // CHECK: } // end sil function 'unchecked_ref_cast_formation_unowned'
1537
+ sil [ossa] @unchecked_ref_cast_formation_unowned : $@convention(thin) (B) -> F {
1538
+ bb0(%0 : @unowned $B):
1539
+ %1 = ref_to_raw_pointer %0 : $B to $Builtin.RawPointer
1540
+ %2 = raw_pointer_to_ref %1 : $Builtin.RawPointer to $F
1541
+ return %2 : $F
1542
+ }
1543
+
1512
1544
// CHECK-LABEL: sil [ossa] @upcast_unchecked_ref_cast_roundtrip : $@convention(thin) (@owned B) -> @owned B {
1513
1545
// CHECK-NOT: unchecked_ref_cast
1514
1546
// CHECK-NOT: upcast
0 commit comments