@@ -318,34 +318,49 @@ sil @stored_property_fixed_offsets : $@convention(thin) () -> () {
318318entry:
319319 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_A]], ptr undef)
320320 %a = keypath $KeyPath<S, Int>, (root $S; stored_property #S.x : $Int)
321+ strong_retain %a : $KeyPath<S, Int>
321322 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_B]], ptr undef)
322323 %b = keypath $KeyPath<S, String>, (root $S; stored_property #S.y : $String)
324+ strong_retain %b : $KeyPath<S, String>
323325 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_C]], ptr undef)
324326 %c = keypath $KeyPath<S, C>, (root $S; stored_property #S.z : $C)
327+ strong_retain %c : $KeyPath<S, C>
325328 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_D]], ptr undef)
326329 %d = keypath $KeyPath<C, Int>, (root $C; stored_property #C.x : $Int)
330+ strong_retain %d : $KeyPath<C, Int>
327331 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_D1]], ptr undef)
328332 %d1 = keypath $KeyPath<C1, Int>, (root $C1; stored_property #C.x : $Int)
333+ strong_retain %d1 : $KeyPath<C1, Int>
329334 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_E]], ptr undef)
330335 %e = keypath $KeyPath<C, String>, (root $C; stored_property #C.y : $String)
336+ strong_retain %e : $KeyPath<C, String>
331337 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_F]], ptr undef)
332338 %f = keypath $KeyPath<C, S>, (root $C; stored_property #C.z : $S)
339+ strong_retain %f : $KeyPath<C, S>
333340
334341 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_G]], ptr undef)
335342 %g = keypath $KeyPath<S, Int>, (root $S; stored_property #S.z : $C; stored_property #C.x : $Int)
343+ strong_retain %g : $KeyPath<S, Int>
336344 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_H]], ptr undef)
337345 %h = keypath $KeyPath<C, Int>, (root $C; stored_property #C.z : $S; stored_property #S.x : $Int)
346+ strong_retain %h : $KeyPath<C, Int>
338347
339348 %k = keypath $KeyPath<S, Int>, (root $S; gettable_property $Int, id @k_id : $@convention(thin) () -> (), getter @k_get : $@convention(keypath_accessor_getter) (@in_guaranteed S) -> @out Int)
349+ strong_retain %k : $KeyPath<S, Int>
340350 %l = keypath $KeyPath<C, Int>, (root $C; settable_property $Int, id #C.w!getter, getter @l_get : $@convention(keypath_accessor_getter) (@in_guaranteed C) -> @out Int, setter @l_set : $@convention(keypath_accessor_setter) (@in_guaranteed Int, @in_guaranteed C) -> ())
351+ strong_retain %l : $KeyPath<C, Int>
341352 %m = keypath $KeyPath<S, () -> ()>, (root $S; settable_property $() -> (), id ##S.reabstracted, getter @m_get : $@convention(keypath_accessor_getter) (@in_guaranteed S) -> @out @callee_guaranteed @substituted <A> () -> @out A for <()>, setter @m_set : $@convention(keypath_accessor_setter) (@in_guaranteed @callee_guaranteed @substituted <A> () -> @out A for <()>, @inout S) -> ())
353+ strong_retain %m : $KeyPath<S, () -> ()>
342354 %m2 = keypath $KeyPath<C2, () -> ()>, (root $C2; settable_property $() -> (), id ##C2.reabstracted, getter @m2_get : $@convention(keypath_accessor_getter) (@in_guaranteed C2) -> @out @callee_guaranteed @substituted <A> () -> @out A for <()>, setter @m2_set : $@convention(keypath_accessor_setter) (@in_guaranteed @callee_guaranteed @substituted <A> () -> @out A for <()>, @inout C2) -> ())
355+ strong_retain %m2 : $KeyPath<C2, () -> ()>
343356
344357 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_T0]], ptr undef)
345358 %t0 = keypath $KeyPath<T, Int>, (root $T; stored_property #T.a : $(Int, String); tuple_element #0 : $Int)
359+ strong_retain %t0 : $KeyPath<T, Int>
346360
347361 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_T1]], ptr undef)
348362 %t1 = keypath $KeyPath<T, Int>, (root $T; stored_property #T.b : $(f: String, g: Int); tuple_element #1 : $Int)
363+ strong_retain %t1 : $KeyPath<T, Int>
349364
350365 return undef : $()
351366}
@@ -395,18 +410,21 @@ entry:
395410 // CHECK: store ptr %T, ptr [[ARGS]]
396411 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_I]], ptr [[ARGS]])
397412 %i = keypath $KeyPath<Gen<T,T>, T>, <A> (root $Gen<A, A>; stored_property #Gen.x : $A) <T>
413+ strong_retain %i : $KeyPath<Gen<T,T>, T>
398414
399415 // CHECK: [[ARGS:%.*]] = alloca i{{.*}}
400416 // CHECK: store ptr %U, ptr [[ARGS]]
401417 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_J]], ptr [[ARGS]])
402418 %j = keypath $KeyPath<Gen<U,U>, U>, <A> (root $Gen<A, A>; stored_property #Gen.y : $A) <U>
419+ strong_retain %j : $KeyPath<Gen<U,U>, U>
403420
404421 // CHECK: [[ARGS:%.*]] = alloca i{{.*}}
405422 // CHECK: [[T0:%.*]] = call swiftcc %swift.metadata_response @"$s8keypaths3FooVMa"([[WORD]] 0, ptr %T)
406423 // CHECK: [[FOO_T:%.*]] = extractvalue %swift.metadata_response [[T0]], 0
407424 // CHECK: store ptr [[FOO_T]], ptr [[ARGS]]
408425 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_I]], ptr [[ARGS]])
409426 %i2 = keypath $KeyPath<Gen<Foo<T>,Foo<T>>, Foo<T>>, <A> (root $Gen<A, A>; stored_property #Gen.x : $A) <Foo<T>>
427+ strong_retain %i2 : $KeyPath<Gen<Foo<T>,Foo<T>>, Foo<T>>
410428
411429 return undef : $()
412430}
@@ -418,23 +436,27 @@ entry:
418436 // CHECK: store ptr %T, ptr [[ARGS]]
419437 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_TG0]], ptr [[ARGS]])
420438 %tg0 = keypath $KeyPath<TG<T,U,V>, T>, <A,B,C> (root $TG<A,B,C>; stored_property #TG.a : $(A,B,C); tuple_element #0 : $A) <T,U,V>
439+ strong_retain %tg0 : $KeyPath<TG<T,U,V>, T>
421440
422441 // CHECK: [[ARGS:%.*]] = alloca i{{.*}}
423442 // CHECK: store ptr %T, ptr [[ARGS]]
424443 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_TG1]], ptr [[ARGS]])
425444 %tg1 = keypath $KeyPath<TG<T,U,V>, V>, <A,B,C> (root $TG<A,B,C>; stored_property #TG.a : $(A,B,C); tuple_element #2 : $C) <T,U,V>
445+ strong_retain %tg1 : $KeyPath<TG<T,U,V>, V>
426446
427447 // CHECK: [[ARGS:%.*]] = alloca i{{.*}}
428448 // CHECK: store ptr %T, ptr [[ARGS]]
429449 // CHECK: call ptr @swift_getKeyPath(ptr [[KP_TG2]], ptr [[ARGS]])
430450 %tg2 = keypath $KeyPath<TGA<T,U>, U>, <A,B> (root $TGA<A,B>; tuple_element #1 : $B) <T,U>
451+ strong_retain %tg2 : $KeyPath<TGA<T,U>, U>
431452
432453 return undef : $()
433454}
434455
435456sil @generic_class_stored_final : $@convention(thin) <T> () -> () {
436457entry:
437458 %gcx = keypath $ReferenceWritableKeyPath<GC<T>, T>, <T> (root $GC<T>; stored_property #GC.x: $T) <T>
459+ strong_retain %gcx : $ReferenceWritableKeyPath<GC<T>, T>
438460
439461 return undef : $()
440462}
@@ -542,6 +564,10 @@ entry(%0 : $*A, %1 : $*B, %2 : $*A, %3 : $*B, %4 : $*A, %5 : $*B):
542564 indices_hash @s_hash : $@convention(keypath_accessor_hash) <T: Hashable, U: Hashable> (@in_guaranteed Int) -> Int
543565 ) <A, B> (%3, %4, %5)
544566
567+ strong_retain %s : $WritableKeyPath<A, B>
568+ strong_retain %t : $WritableKeyPath<A, B>
569+ strong_retain %v : $WritableKeyPath<A, A>
570+
545571 return undef : $()
546572}
547573
0 commit comments