// First parse this and then emit a *.sib. Then read in the *.sib, then recreate // RUN: %empty-directory(%t) // RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name borrow // RUN: %target-sil-opt %t/tmp.sib -o %t/tmp.2.sib -module-name borrow // RUN: %target-sil-opt %t/tmp.2.sib -module-name borrow | %FileCheck %s import Builtin // CHECK-LABEL: sil [serialized] [ossa] @test_unchecked_ownership_conversion : $@convention(thin) (@guaranteed Builtin.NativeObject) -> () { // CHECK: unchecked_ownership_conversion {{%.*}} : $Builtin.NativeObject, @guaranteed to @owned sil [serialized] [ossa] @test_unchecked_ownership_conversion : $@convention(thin) (@guaranteed Builtin.NativeObject) -> () { bb0(%0 : @guaranteed $Builtin.NativeObject): %1 = unchecked_ownership_conversion %0 : $Builtin.NativeObject, @guaranteed to @owned destroy_value %1 : $Builtin.NativeObject return undef : $() } // CHECK-LABEL: sil [serialized] [ossa] @test_end_lifetime : $@convention(thin) (@owned Builtin.NativeObject) -> () { // CHECK: end_lifetime {{%.*}} : $Builtin.NativeObject sil [serialized] [ossa] @test_end_lifetime : $@convention(thin) (@owned Builtin.NativeObject) -> () { bb0(%0 : @owned $Builtin.NativeObject): end_lifetime %0 : $Builtin.NativeObject return undef : $() } class TestArrayStorage { @_hasStorage var count: Int32 init() } struct TestArray2 { var storage : TestArrayStorage var someValue : Int32 var storage2 : TestArrayStorage } struct Int32 { var x: Builtin.Int32 } // CHECK-LABEL: sil [serialized] [ossa] @test_subst_function_type : $@convention(thin) (@guaranteed @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in τ_0_0, @in τ_0_1) -> () for ) -> () sil [serialized] [ossa] @test_subst_function_type : $@convention(thin) (@guaranteed @callee_guaranteed @substituted (@in A, @in B) -> () for ) -> () { entry(%0 : @guaranteed $@callee_guaranteed @substituted (@in C, @in D) -> () for ): return undef : $() } sil [ossa] @test_destructure_struct_tuple : $@convention(thin) (@owned (Builtin.NativeObject, Builtin.Int32), @owned TestArray2) -> @owned (Builtin.NativeObject, Builtin.Int32, TestArrayStorage, Int32, TestArrayStorage) { bb0(%0 : @owned $(Builtin.NativeObject, Builtin.Int32), %1 : @owned $TestArray2): (%2, %3) = destructure_tuple %0 : $(Builtin.NativeObject, Builtin.Int32) (%4, %5, %6) = destructure_struct %1 : $TestArray2 %7 = tuple(%2 : $Builtin.NativeObject, %3 : $Builtin.Int32, %4 : $TestArrayStorage, %5 : $Int32, %6 : $TestArrayStorage) return %7 : $(Builtin.NativeObject, Builtin.Int32, TestArrayStorage, Int32, TestArrayStorage) } // CHECK-LABEL: sil [serialized] [ossa] @test_subst_function_type_generic_context : $@convention(thin) (@guaranteed @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in τ_0_0, @in τ_0_1) -> () for ) -> () sil [serialized] [ossa] @test_subst_function_type_generic_context : $@convention(thin) (@guaranteed @callee_guaranteed @substituted (@in A, @in B) -> () for ) -> () { entry(%0 : @guaranteed $@callee_guaranteed @substituted (@in C, @in D) -> () for ): return undef : $() } // CHECK-LABEL: sil [lazy_getter] @test_lazy_getter sil [lazy_getter] @test_lazy_getter : $@convention(thin) () -> () { bb0: %0 = tuple () return %0 : $() } struct EmptyStruct {} sil @test_empty_destructure : $@convention(thin) () -> () { bb0: %0 = struct $EmptyStruct() () = destructure_struct %0 : $EmptyStruct %1 = tuple() () = destructure_tuple %1 : $() return %1 : $() } sil [ossa] @strong_copy_unmanaged_value_test : $@convention(thin) (@sil_unmanaged Builtin.NativeObject) -> @owned Builtin.NativeObject { bb0(%0 : $@sil_unmanaged Builtin.NativeObject): %1 = strong_copy_unmanaged_value %0 : $@sil_unmanaged Builtin.NativeObject return %1 : $Builtin.NativeObject }