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.
41 lines
1.6 KiB
Plaintext
41 lines
1.6 KiB
Plaintext
// RUN: %target-sil-opt -sil-print-types -enable-sil-opaque-values -function-signature-opts %s | %FileCheck %s
|
|
|
|
import Builtin
|
|
|
|
struct R<T> {
|
|
var base: T
|
|
}
|
|
|
|
struct S {
|
|
var val: Builtin.NativeObject
|
|
}
|
|
|
|
sil @testAggregateArgHelper : $@convention(thin) (@owned R<S>) -> ()
|
|
|
|
// Test owned-to-guaranteed transformation of opaque arguments.
|
|
//
|
|
// CHECK-LABEL: sil [signature_optimized_thunk] [always_inline] @testAggregateArg : $@convention(thin) (@in R<S>) -> @out () {
|
|
// CHECK: bb0(%0 : $R<S>):
|
|
// CHECK: [[F:%.*]] = function_ref @$s16testAggregateArgTf4g_n : $@convention(thin) (@in_guaranteed R<S>) -> @out ()
|
|
// CHECK: [[CALL:%.*]] = apply [[F]](%0) : $@convention(thin) (@in_guaranteed R<S>) -> @out ()
|
|
// CHECK: release_value %0 : $R<S>
|
|
// CHECK: return [[CALL]] : $()
|
|
// CHECK-LABEL: } // end sil function 'testAggregateArg'
|
|
//
|
|
// CHECK-LABEL: sil shared @$s16testAggregateArgTf4g_n : $@convention(thin) (@in_guaranteed R<S>) -> @out () {
|
|
// CHECK: bb0(%0 : $R<S>):
|
|
// CHECK: retain_value %0 : $R<S>
|
|
// CHECK: [[F:%.*]] = function_ref @testAggregateArgHelper : $@convention(thin) (@owned R<S>) -> ()
|
|
// CHECK: [[CALL:%.*]] = apply [[F]](%0) : $@convention(thin) (@owned R<S>) -> ()
|
|
// CHECK: return %{{.*}} : $()
|
|
// CHECK-LABEL: } // end sil function '$s16testAggregateArgTf4g_n'
|
|
sil @testAggregateArg : $@convention(thin) (@in R<S>) -> @out () {
|
|
bb0(%0 : $R<S>):
|
|
retain_value %0 : $R<S>
|
|
%10 = function_ref @testAggregateArgHelper : $@convention(thin) (@owned R<S>) -> ()
|
|
%12 = apply %10(%0) : $@convention(thin) (@owned R<S>) -> ()
|
|
release_value %0 : $R<S>
|
|
%1284 = tuple ()
|
|
return %1284 : $()
|
|
}
|