@@ -1458,6 +1458,45 @@ bb0:
1458
1458
return %2 : $X
1459
1459
}
1460
1460
1461
+ // CHECK-LABEL: Escape information for test_unchecked_ref_cast_from_optional_to_non_optional:
1462
+ // CHECK: return[]: %0 = alloc_ref $Derived
1463
+ // CHECK: - : %2 = alloc_ref $Derived
1464
+ // CHECK: End function test_unchecked_ref_cast_from_optional_to_non_optional
1465
+ sil @test_unchecked_ref_cast_from_optional_to_non_optional : $@convention(thin) () -> @owned X {
1466
+ bb0:
1467
+ %0 = alloc_ref $Derived
1468
+ %1 = enum $Optional<Derived>, #Optional.some!enumelt, %0 : $Derived
1469
+ %2 = alloc_ref $Derived
1470
+ %3 = enum $Optional<Derived>, #Optional.some!enumelt, %2 : $Derived
1471
+ %4 = unchecked_ref_cast %1 : $Optional<Derived> to $X
1472
+ %5 = unchecked_ref_cast %3 : $Optional<Derived> to $X
1473
+ return %4 : $X
1474
+ }
1475
+
1476
+ // CHECK-LABEL: Escape information for test_unchecked_ref_cast_from_optional_to_non_optional_2:
1477
+ // CHECK-NEXT: End function test_unchecked_ref_cast_from_optional_to_non_optional_2
1478
+ sil @test_unchecked_ref_cast_from_optional_to_non_optional_2 : $@convention(thin) () -> @owned X {
1479
+ bb0:
1480
+ %0 = enum $Optional<Derived>, #Optional.none!enumelt
1481
+ %1 = enum $Optional<Derived>, #Optional.none!enumelt
1482
+ %2 = unchecked_ref_cast %0 : $Optional<Derived> to $X
1483
+ %3 = unchecked_ref_cast %1 : $Optional<Derived> to $X
1484
+ return %2 : $X
1485
+ }
1486
+
1487
+ // CHECK-LABEL: Escape information for test_unchecked_ref_cast_from_non_optional_to_optional:
1488
+ // CHECK: return[e1]: %0 = alloc_ref $Derived
1489
+ // CHECK: - : %1 = alloc_ref $Derived
1490
+ // CHECK: End function test_unchecked_ref_cast_from_non_optional_to_optional
1491
+ sil @test_unchecked_ref_cast_from_non_optional_to_optional : $@convention(thin) () -> @owned Optional<X> {
1492
+ bb0:
1493
+ %0 = alloc_ref $Derived
1494
+ %1 = alloc_ref $Derived
1495
+ %2 = unchecked_ref_cast %0 : $Derived to $Optional<X>
1496
+ %3 = unchecked_ref_cast %1 : $Derived to $Optional<X>
1497
+ return %2 : $Optional<X>
1498
+ }
1499
+
1461
1500
// CHECK-LABEL: Escape information for test_unchecked_addr_cast:
1462
1501
// CHECK: global: %1 = alloc_ref $X
1463
1502
// CHECK: End function test_unchecked_addr_cast
0 commit comments