mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Type annotations for instruction operands are omitted, e.g. ``` %3 = struct $S(%1, %2) ``` Operand types are redundant anyway and were only used for sanity checking in the SIL parser. But: operand types _are_ printed if the definition of the operand value was not printed yet. This happens: * if the block with the definition appears after the block where the operand's instruction is located * if a block or instruction is printed in isolation, e.g. in a debugger The old behavior can be restored with `-Xllvm -sil-print-types`. This option is added to many existing test files which check for operand types in their check-lines.
79 lines
4.2 KiB
Plaintext
79 lines
4.2 KiB
Plaintext
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift -Xllvm -sil-disable-pass=simplification -emit-module -Xllvm -verify-skip-convert-escape-to-noescape-attributes -Xfrontend -disable-diagnostic-passes -whole-module-optimization -o %t/sil_partial_apply_ownership.swiftmodule %s
|
|
// RUN: %target-build-swift -Xllvm -sil-disable-pass=simplification -Xllvm -verify-skip-convert-escape-to-noescape-attributes -Xllvm -sil-print-types -emit-sil -I %t %s | %FileCheck %s
|
|
|
|
import Builtin
|
|
|
|
sil_stage canonical
|
|
|
|
sil @subject : $@convention(thin) (Builtin.Int64) -> ()
|
|
sil @generic_subject : $@convention(thin) <T> (@in T, @in T) -> ()
|
|
|
|
// CHECK-LABEL: sil @partial_apply_callee_owned_by_default : $@convention(thin) () -> @callee_owned () -> () {
|
|
sil @partial_apply_callee_owned_by_default : $@convention(thin) () -> @callee_owned () -> () {
|
|
entry:
|
|
%f = function_ref @subject : $@convention(thin) (Builtin.Int64) -> ()
|
|
%z = integer_literal $Builtin.Int64, 0
|
|
// CHECK: [[PA:%.*]] = partial_apply {{.*}} $@convention(thin) (Builtin.Int64) -> ()
|
|
%g = partial_apply %f(%z) : $@convention(thin) (Builtin.Int64) -> ()
|
|
// CHECK: return [[PA]] : $@callee_owned () -> ()
|
|
return %g : $@callee_owned () -> ()
|
|
}
|
|
|
|
// CHECK-LABEL: sil @partial_apply_callee_guaranteed_by_attr : $@convention(thin) () -> @callee_guaranteed () -> () {
|
|
sil @partial_apply_callee_guaranteed_by_attr : $@convention(thin) () -> @callee_guaranteed () -> () {
|
|
entry:
|
|
%f = function_ref @subject : $@convention(thin) (Builtin.Int64) -> ()
|
|
%z = integer_literal $Builtin.Int64, 0
|
|
// CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] {{.*}} $@convention(thin) (Builtin.Int64) -> ()
|
|
%g = partial_apply [callee_guaranteed] %f(%z) : $@convention(thin) (Builtin.Int64) -> ()
|
|
// CHECK: return [[PA]] : $@callee_guaranteed () -> ()
|
|
return %g : $@callee_guaranteed () -> ()
|
|
}
|
|
|
|
sil @partial_apply_generic : $@convention(thin) () -> @callee_owned (@in Builtin.Int64) -> () {
|
|
entry:
|
|
%f = function_ref @generic_subject : $@convention(thin) <T> (@in T, @in T) -> ()
|
|
%z = integer_literal $Builtin.Int64, 0
|
|
%s = alloc_stack $Builtin.Int64
|
|
store %z to %s : $*Builtin.Int64
|
|
// CHECK: [[PA:%.*]] = partial_apply {{.*}}<Builtin.Int64>({{.*}}) : $@convention(thin)
|
|
%g = partial_apply %f<Builtin.Int64>(%s) : $@convention(thin) <T> (@in T, @in T) -> ()
|
|
dealloc_stack %s : $*Builtin.Int64
|
|
return %g : $@callee_owned (@in Builtin.Int64) -> ()
|
|
}
|
|
|
|
sil @use : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
|
|
|
|
// CHECK-LABEL: sil @partial_apply_convert
|
|
// CHECK: convert_escape_to_noescape %{{.*}} : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
|
|
// CHECK: convert_escape_to_noescape [not_guaranteed] %
|
|
sil @partial_apply_convert : $@convention(thin) () -> () {
|
|
entry:
|
|
%f = function_ref @subject : $@convention(thin) (Builtin.Int64) -> ()
|
|
%z = integer_literal $Builtin.Int64, 0
|
|
%e = partial_apply [callee_guaranteed] %f(%z) : $@convention(thin) (Builtin.Int64) -> ()
|
|
%n = convert_escape_to_noescape %e : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
|
|
%x2 = convert_escape_to_noescape [not_guaranteed] %e : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
|
|
%n2 = mark_dependence %n : $@noescape @callee_guaranteed () -> () on %e : $@callee_guaranteed () -> ()
|
|
%f2 = function_ref @use : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
|
|
apply %f2(%n2) : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
|
|
release_value %e : $@callee_guaranteed () -> ()
|
|
%t = tuple ()
|
|
return %t : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil @partial_apply_on_stack
|
|
// CHECK: partial_apply [callee_guaranteed] [on_stack] %{{.*}} : $@convention(thin) (Builtin.Int64) -> ()
|
|
sil @partial_apply_on_stack : $@convention(thin) () -> () {
|
|
entry:
|
|
%f = function_ref @subject : $@convention(thin) (Builtin.Int64) -> ()
|
|
%z = integer_literal $Builtin.Int64, 0
|
|
%c = partial_apply [callee_guaranteed] [on_stack] %f(%z) : $@convention(thin) (Builtin.Int64) -> ()
|
|
%f2 = function_ref @use : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
|
|
apply %f2(%c) : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
|
|
dealloc_stack %c : $@noescape @callee_guaranteed () -> ()
|
|
%t = tuple ()
|
|
return %t : $()
|
|
}
|