@@ -102,6 +102,31 @@ bb3:
102
102
return %r : $()
103
103
}
104
104
105
+ sil @use_guaranteed : $@convention(thin) (@guaranteed C) -> ()
106
+
107
+ sil [ossa] @argTest : $@convention(method) (@owned C) -> () {
108
+ bb0(%0 : @owned $C):
109
+ test_specification "ossa-lifetime-completion @argument"
110
+ debug_value %0 : $C
111
+ cond_br undef, bb1, bb2
112
+
113
+ bb1:
114
+ br bb4
115
+
116
+ bb2:
117
+ br bb3
118
+
119
+ bb3:
120
+ %3 = function_ref @use_guaranteed : $@convention(thin) (@guaranteed C) -> ()
121
+ %4 = apply %3(%0) : $@convention(thin) (@guaranteed C) -> ()
122
+ destroy_value %0 : $C
123
+ %r = tuple ()
124
+ return %r : $()
125
+
126
+ bb4:
127
+ unreachable
128
+ }
129
+
105
130
// Ensure no assert fires while inserting dead end blocks to the worklist
106
131
sil [ossa] @testLexicalLifetimeCompletion : $@convention(thin) (@owned C) -> () {
107
132
bb0(%0 : @owned $C):
@@ -143,3 +168,29 @@ bb10:
143
168
br bb8
144
169
}
145
170
171
+ sil @foo : $@convention(thin) (@guaranteed C) -> ()
172
+
173
+ // Ensure no assert fires while handling lifetime end of partial_apply
174
+ sil [ossa] @testPartialApplyStack : $@convention(thin) (@guaranteed C) -> () {
175
+ bb0(%0 : @guaranteed $C):
176
+ test_specification "ossa-lifetime-completion @instruction[0]"
177
+ %8 = copy_value %0 : $C
178
+ %9 = begin_borrow %8 : $C
179
+ %80 = function_ref @foo : $@convention(thin) (@guaranteed C) -> ()
180
+ %81 = partial_apply [callee_guaranteed] [on_stack] %80(%9) : $@convention(thin) (@guaranteed C) -> ()
181
+ cond_br undef, bb1, bb2
182
+
183
+ bb1:
184
+ destroy_value %81 : $@noescape @callee_guaranteed () -> ()
185
+ br bb3
186
+
187
+ bb2:
188
+ unreachable
189
+
190
+ bb3:
191
+ end_borrow %9 : $C
192
+ destroy_value %8 : $C
193
+ %180 = tuple ()
194
+ return %180 : $()
195
+ }
196
+
0 commit comments