|
1 |
| -// RUN: %target-sil-opt -sil-print-types -sil-inline-generics -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck %s |
2 |
| -// RUN: %target-sil-opt -sil-print-types -sil-inline-generics -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck -check-prefix=CHECK-NEGATIVE %s |
| 1 | +// RUN: %target-sil-opt -sil-print-types -sil-inline-generics -enable-sil-verify-all -inline -function-signature-opts -enable-experimental-feature Lifetimes %s | %FileCheck %s |
| 2 | +// RUN: %target-sil-opt -sil-print-types -sil-inline-generics -enable-sil-verify-all -inline -function-signature-opts -enable-experimental-feature Lifetimes %s | %FileCheck -check-prefix=CHECK-NEGATIVE %s |
| 3 | + |
| 4 | +// REQUIRES: swift_in_compiler |
| 5 | +// REQUIRES: swift_feature_Lifetimes |
3 | 6 |
|
4 | 7 | import Builtin
|
5 | 8 | import Swift
|
@@ -1832,6 +1835,28 @@ bb0(%0 : $ValueGenericType<N>):
|
1832 | 1835 | return %2 : $Int
|
1833 | 1836 | }
|
1834 | 1837 |
|
| 1838 | +struct NE<T> : ~Escapable where T : ~Escapable { |
| 1839 | + @_lifetime(copy t) |
| 1840 | + init(_ t: borrowing T) |
| 1841 | +} |
| 1842 | + |
| 1843 | +// CHECK-NOT: sil [serialized] [signature_optimized_thunk] [always_inline] @neinit : |
| 1844 | +sil [noinline] @neinit : $@convention(method) <T where T : ~Escapable> (@in_guaranteed T, @thin NE<T>.Type) -> @lifetime(copy 0) @owned NE<T> { |
| 1845 | +bb0(%0 : @noImplicitCopy $*T, %1 : $@thin NE<T>.Type): |
| 1846 | + debug_value [moveable_value_debuginfo] %0, let, name "t", argno 1, expr op_deref |
| 1847 | + %3 = struct $NE<T> () |
| 1848 | + return %3 |
| 1849 | +} |
| 1850 | + |
| 1851 | +sil hidden @neinit_caller : $@convention(thin) <T where T : ~Escapable> (@in_guaranteed T) -> @lifetime(copy 0) @owned NE<T> { |
| 1852 | +bb0(%0 : @noImplicitCopy $*T): |
| 1853 | + debug_value [moveable_value_debuginfo] %0, let, name "t", argno 1, expr op_deref |
| 1854 | + %2 = metatype $@thin NE<T>.Type |
| 1855 | + %3 = function_ref @neinit : $@convention(method) <τ_0_0 where τ_0_0 : ~Escapable> (@in_guaranteed τ_0_0, @thin NE<τ_0_0>.Type) -> @lifetime(copy 0) @owned NE<τ_0_0> |
| 1856 | + %4 = apply %3<T>(%0, %2) : $@convention(method) <τ_0_0 where τ_0_0 : ~Escapable> (@in_guaranteed τ_0_0, @thin NE<τ_0_0>.Type) -> @lifetime(copy 0) @owned NE<τ_0_0> |
| 1857 | + return %4 |
| 1858 | +} |
| 1859 | + |
1835 | 1860 | // CHECK-LABEL: sil shared @$s36exploded_release_to_guaranteed_paramTf4gX_n
|
1836 | 1861 | // CHECK: bb0([[INPUT_ARG0:%[0-9]+]] : $Int):
|
1837 | 1862 | // CHECK-NOT: strong_release
|
|
0 commit comments