@@ -164,17 +164,18 @@ bb1:
164164 return %86 : $()
165165}
166166
167- sil [ossa] @closureImpl : $@convention(thin) (@guaranteed Klass, @guaranteed Klass) -> Bool
167+ sil [ossa] @closureImpl1 : $@convention(thin) (@guaranteed Klass, @guaranteed Klass) -> Bool
168+ sil [ossa] @closureImpl2 : $@convention(thin) (@guaranteed Klass, @in_guaranteed Klass) -> Bool
168169sil [ossa] @useClosure : $@convention(thin) (@noescape @callee_guaranteed () -> Bool) -> ()
169170
170171// Don't crash.
171- // CHECK-LABEL: sil hidden [ossa] @testUndefined
172+ // CHECK-LABEL: sil hidden [ossa] @testUndefined1
172173// CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [on_stack]
173174// CHECK: destroy_value [[PA]] : $@noescape @callee_guaranteed () -> Bool
174175// CHECK: destroy_value
175- sil hidden [ossa] @testUndefined : $@convention(method) (@guaranteed Klass, @guaranteed Klass) -> () {
176+ sil hidden [ossa] @testUndefined1 : $@convention(method) (@guaranteed Klass, @guaranteed Klass) -> () {
176177bb0(%0 : @guaranteed $Klass, %1 : @guaranteed $Klass):
177- %4 = function_ref @closureImpl : $@convention(thin) (@guaranteed Klass, @guaranteed Klass) -> Bool
178+ %4 = function_ref @closureImpl1 : $@convention(thin) (@guaranteed Klass, @guaranteed Klass) -> Bool
178179 %5 = copy_value %1 : $Klass
179180 %6 = partial_apply [callee_guaranteed] %4(%5, undef) : $@convention(thin) (@guaranteed Klass, @guaranteed Klass) -> Bool
180181 %7 = convert_escape_to_noescape [not_guaranteed] %6 : $@callee_guaranteed () -> Bool to $@noescape @callee_guaranteed () -> Bool
@@ -186,6 +187,23 @@ bb0(%0 : @guaranteed $Klass, %1 : @guaranteed $Klass):
186187 return %42 : $()
187188}
188189
190+ // Don't crash on undef in insertDeallocOfCapturedArguments
191+ // CHECK-LABEL: sil hidden [ossa] @testUndefined2 :
192+ // CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [on_stack]
193+ sil hidden [ossa] @testUndefined2 : $@convention(method) (@guaranteed Klass, @in_guaranteed Klass) -> () {
194+ bb0(%0 : @guaranteed $Klass, %1 : $*Klass):
195+ %4 = function_ref @closureImpl2 : $@convention(thin) (@guaranteed Klass, @in_guaranteed Klass) -> Bool
196+ %5 = copy_value %0 : $Klass
197+ %6 = partial_apply [callee_guaranteed] %4(%5, undef) : $@convention(thin) (@guaranteed Klass, @in_guaranteed Klass) -> Bool
198+ %7 = convert_escape_to_noescape [not_guaranteed] %6 : $@callee_guaranteed () -> Bool to $@noescape @callee_guaranteed () -> Bool
199+ %21 = function_ref @useClosure : $@convention(thin) (@noescape @callee_guaranteed () -> Bool) -> ()
200+ %22 = apply %21(%7) : $@convention(thin) (@noescape @callee_guaranteed () -> Bool) -> ()
201+ destroy_value %7 : $@noescape @callee_guaranteed () -> Bool
202+ destroy_value %6 : $@callee_guaranteed () -> Bool
203+ %42 = tuple ()
204+ return %42 : $()
205+ }
206+
189207sil @simpleClosure : $@convention(thin) () -> ()
190208
191209// Don't crash.
0 commit comments