@@ -48,6 +48,10 @@ struct MyInt {
48
48
var value: Builtin.Int32
49
49
}
50
50
51
+ struct NativeObjectStruct {
52
+ var ele : Builtin.NativeObject
53
+ }
54
+
51
55
sil [global_init] @global_init_fun : $@convention(thin) () -> Builtin.RawPointer
52
56
53
57
sil [ossa] @user : $@convention(thin) (@owned Builtin.NativeObject) -> ()
@@ -1373,18 +1377,33 @@ bb0(%0 : @owned $B):
1373
1377
}
1374
1378
1375
1379
// (upcast X2->X (ref-to-object-pointer-inst (object-pointer-to-ref-inst x) typeof(x))) -> x
1376
- // CHECK-LABEL: sil [ossa] @upcast_unchecked_ref_cast_round_trip : $@convention(thin) (@owned E) -> @owned E {
1380
+ // CHECK-LABEL: sil [ossa] @upcast_unchecked_ref_cast_round_trip1 : $@convention(thin) (@owned E) -> @owned E {
1377
1381
// CHECK-NOT: upcast
1378
1382
// CHECK-NOT: unchecked_ref_cast
1379
- // CHECK: } // end sil function 'upcast_unchecked_ref_cast_round_trip '
1380
- sil [ossa] @upcast_unchecked_ref_cast_round_trip : $@convention(thin) (@owned E) -> @owned E {
1383
+ // CHECK: } // end sil function 'upcast_unchecked_ref_cast_round_trip1 '
1384
+ sil [ossa] @upcast_unchecked_ref_cast_round_trip1 : $@convention(thin) (@owned E) -> @owned E {
1381
1385
bb0(%0 : @owned $E):
1382
1386
%1 = upcast %0 : $E to $B
1383
1387
%2 = unchecked_ref_cast %1 : $B to $Builtin.NativeObject
1384
1388
%3 = unchecked_ref_cast %2 : $Builtin.NativeObject to $E
1385
1389
return %3 : $E
1386
1390
}
1387
1391
1392
+ // CHECK-LABEL: sil [ossa] @upcast_unchecked_ref_cast_round_trip2 :
1393
+ // CHECK-NOT: upcast
1394
+ // CHECK-NOT: unchecked_ref_cast
1395
+ // CHECK-LABEL: } // end sil function 'upcast_unchecked_ref_cast_round_trip2'
1396
+ sil [ossa] @upcast_unchecked_ref_cast_round_trip2 : $@convention(method) (@owned E) -> () {
1397
+ bb0(%0 : @owned $E):
1398
+ %1 = upcast %0 : $E to $B
1399
+ debug_value %1 : $B
1400
+ %2 = unchecked_ref_cast %1 : $B to $Builtin.NativeObject
1401
+ %3 = struct $NativeObjectStruct (%2 : $Builtin.NativeObject)
1402
+ destroy_value %3 : $NativeObjectStruct
1403
+ %res = tuple ()
1404
+ return %res : $()
1405
+ }
1406
+
1388
1407
// (load (upcast-addr %x)) -> (upcast-ref (load %x))
1389
1408
//
1390
1409
// CHECK-LABEL: sil [ossa] @load_upcast_addr_to_upcast_ref_load_canonicalization : $@convention(thin) (@inout E) -> @owned B {
0 commit comments