@@ -28,6 +28,11 @@ class ArrayStorage {
28
28
init()
29
29
}
30
30
31
+ class Kl2 {
32
+ @_hasStorage var i: Int
33
+ }
34
+
35
+
31
36
protocol P { }
32
37
struct X : P { }
33
38
@@ -65,6 +70,19 @@ bb0(%0 : @owned $NontrivialDestructor):
65
70
return %7 : $()
66
71
}
67
72
73
+ sil [ossa] @$s4main3Kl2CfD : $@convention(method) (@owned Kl2) -> () {
74
+ bb0(%0 : @owned $Kl2):
75
+ %1 = begin_borrow %0
76
+ %2 = unchecked_ref_cast %1 to $Builtin.NativeObject
77
+ %3 = unchecked_ownership_conversion %2, @guaranteed to @owned
78
+ end_borrow %1
79
+ end_lifetime %0
80
+ %6 = unchecked_ref_cast %3 to $Kl2
81
+ dealloc_ref %6
82
+ %8 = tuple ()
83
+ return %8
84
+ }
85
+
68
86
sil @ptr_user : $@convention(thin) (Builtin.NativeObject) -> ()
69
87
sil @int_user : $@convention(thin) (Builtin.Int32) -> ()
70
88
@@ -541,3 +559,23 @@ bb0(%0 : @owned $_ContiguousArrayStorage<Element>):
541
559
return %15 : $()
542
560
}
543
561
562
+ // CHECK-LABEL: sil [ossa] @dead_alloc_with_complex_ossa_destructor
563
+ // CHECK-NOT: alloc_ref
564
+ // CHECK: } // end sil function 'dead_alloc_with_complex_ossa_destructor'
565
+ sil [ossa] @dead_alloc_with_complex_ossa_destructor : $@convention(thin) () -> Int {
566
+ bb0:
567
+ %0 = alloc_ref $Kl2
568
+ %1 = move_value [lexical] %0
569
+ %2 = end_init_let_ref %1
570
+ %3 = begin_borrow %2
571
+ %4 = integer_literal $Builtin.Int64, 27
572
+ %5 = struct $Int (%4)
573
+ %6 = ref_element_addr %3, #Kl2.i
574
+ store %5 to [trivial] %6
575
+ end_borrow %3
576
+ %9 = move_value [lexical] [var_decl] %2
577
+ debug_value %9, let, name "k"
578
+ destroy_value %9
579
+ return %5
580
+ }
581
+
0 commit comments