|
| 1 | +// RUN: %target-sil-opt -enable-sil-verify-all %s -test-runner | %FileCheck %s |
| 2 | + |
| 3 | +import Builtin |
| 4 | + |
| 5 | +struct Input {} |
| 6 | +struct Output {} |
| 7 | +enum Nunca {} |
| 8 | + |
| 9 | +sil @rdar127452206_callee : $@convention(thin) @Sendable @substituted <τ_0_0, τ_0_1, τ_0_2> (@in_guaranteed τ_0_0) -> (@out τ_0_2, @error_indirect τ_0_1) for <Input, Nunca, Output> |
| 10 | + |
| 11 | +// CHECK-LABEL: sil @rdar127452206 : {{.*}} { |
| 12 | +// CHECK: bb0([[INPUT:%[^,]+]] : |
| 13 | +// CHECK: [[OUTPUT:%[^,]+]] = alloc_stack $Output |
| 14 | +// CHECK: [[NUNCA:%[^,]+]] = alloc_stack $Nunca |
| 15 | +// CHECK: [[OUTPUT_AS_OUTPUT:%[^,]+]] = unchecked_addr_cast [[OUTPUT]] |
| 16 | +// CHECK: [[NUNCA_AS_NUNCA:%[^,]+]] = unchecked_addr_cast [[NUNCA]] |
| 17 | +// CHECK: [[INPUT_AS_INPUT:%[^,]+]] = unchecked_addr_cast [[INPUT]] |
| 18 | +// CHECK: apply [nothrow] {{%[^,]+}}([[OUTPUT_AS_OUTPUT]], [[NUNCA_AS_NUNCA]], [[INPUT_AS_INPUT]]) |
| 19 | +// CHECK-LABEL: } // end sil function 'rdar127452206' |
| 20 | +sil @rdar127452206 : $@convention(thin) (@in Input) -> () { |
| 21 | +entry(%input : $*Input): |
| 22 | + %output = alloc_stack $Output |
| 23 | + %nunca = alloc_stack $Nunca |
| 24 | + %callee = function_ref @rdar127452206_callee : $@convention(thin) @Sendable @substituted <τ_0_0, τ_0_1, τ_0_2> (@in_guaranteed τ_0_0) -> (@out τ_0_2, @error_indirect τ_0_1) for <Input, Nunca, Output> |
| 25 | + %convert = convert_function %callee : $@convention(thin) @Sendable @substituted <τ_0_0, τ_0_1, τ_0_2> (@in_guaranteed τ_0_0) -> (@out τ_0_2, @error_indirect τ_0_1) for <Input, Nunca, Output> to $@convention(thin) @substituted <τ_0_0, τ_0_1, τ_0_2> (@in_guaranteed τ_0_0) -> (@out τ_0_2, @error_indirect τ_0_1) for <Input, Nunca, Output> // user: %216 |
| 26 | + specify_test "sil_combine_instruction @instruction[4]" |
| 27 | + apply [nothrow] %convert(%output, %nunca, %input) : $@convention(thin) @substituted <τ_0_0, τ_0_1, τ_0_2> (@in_guaranteed τ_0_0) -> (@out τ_0_2, @error_indirect τ_0_1) for <Input, Nunca, Output> |
| 28 | + dealloc_stack %nunca : $*Nunca |
| 29 | + dealloc_stack %output : $*Output |
| 30 | + %retval = tuple () |
| 31 | + return %retval : $() |
| 32 | +} |
| 33 | + |
| 34 | + |
0 commit comments