@@ -22,6 +22,7 @@ case some(T)
22
22
class C {}
23
23
class D {
24
24
var object: C
25
+ @_borrowed @_hasStorage var borrowed: C { get set }
25
26
}
26
27
27
28
// CHECK-LABEL: @testSelfLoop
@@ -132,3 +133,45 @@ bb0(%0 : @owned $D):
132
133
%99 = tuple()
133
134
return %99 : $()
134
135
}
136
+
137
+ // CHECK-LABEL: @testGuaranteedResult
138
+ // CHECK: SSA lifetime analysis: %0 = argument of bb0 : $D
139
+ // CHECK: bb0: LiveWithin
140
+ // CHECK: last user: end_apply
141
+ sil [ossa] @testGuaranteedResult : $@convention(thin) (@guaranteed D) -> () {
142
+ bb0(%0 : @guaranteed $D):
143
+ debug_value [trace] %0 : $D
144
+ %2 = class_method %0 : $D, #D.borrowed!read : (D) -> () -> (), $@yield_once @convention(method) (@guaranteed D) -> @yields @guaranteed C
145
+ (%3, %4) = begin_apply %2(%0) : $@yield_once @convention(method) (@guaranteed D) -> @yields @guaranteed C
146
+ end_apply %4
147
+ %99 = tuple()
148
+ return %99 : $()
149
+ }
150
+
151
+ // CHECK-LABEL: @testScopedAddress
152
+ // CHECK: SSA lifetime analysis: %{{.*}} = ref_element_addr %0
153
+ // CHECK: bb0: LiveWithin
154
+ // CHECK: last user: end_access
155
+ sil [ossa] @testScopedAddress : $@convention(thin) (@guaranteed D) -> () {
156
+ bb0(%0 : @guaranteed $D):
157
+ %f = ref_element_addr %0 : $D, #D.object
158
+ debug_value [trace] %f : $*C
159
+ %access = begin_access [read] [static] %f : $*C
160
+ %o = load [copy] %access : $*C
161
+ end_access %access : $*C
162
+ destroy_value %o : $C
163
+ %99 = tuple()
164
+ return %99 : $()
165
+ }
166
+
167
+ // CHECK-LABEL: @testDeadAddress
168
+ // CHECK: SSA lifetime analysis: %0 = argument of bb0 : $D
169
+ // CHECK: bb0: LiveWithin
170
+ // CHECK: last user: %{{.*}} = ref_element_addr
171
+ sil [ossa] @testDeadAddress : $@convention(thin) (@guaranteed D) -> () {
172
+ bb0(%0 : @guaranteed $D):
173
+ debug_value [trace] %0 : $D
174
+ %f = ref_element_addr %0 : $D, #D.object
175
+ %99 = tuple()
176
+ return %99 : $()
177
+ }
0 commit comments