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.
45 lines
1.4 KiB
Plaintext
45 lines
1.4 KiB
Plaintext
// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -specdevirt -code-sinking -emit-sorted-sil | %FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
class Foo {
|
|
func ping() -> Int
|
|
}
|
|
|
|
sil @_TFC4main3Foo4pingfS0_FT_Si : $@convention(method) (@guaranteed Foo) -> Int
|
|
sil @_TFC4main3FoocfMS0_FT_S0_ : $@convention(method) (@owned Foo) -> @owned Foo
|
|
|
|
// CHECK-LABEL: _TF4main7my_mainFCS_3FooSi
|
|
// CHECK: bb0
|
|
// CHECK-NOT: strong_retain
|
|
// CHECK: checked_cast_br [exact] Foo in %0 : $Foo to Foo
|
|
|
|
// CHECK: bb1
|
|
// CHECK: class_method
|
|
// CHECK-NEXT: apply
|
|
// CHECK: strong_release
|
|
|
|
// CHECK: bb2
|
|
// CHECK: function_ref
|
|
// CHECK: apply
|
|
// CHECK: strong_release
|
|
|
|
// CHECK: bb3
|
|
// CHECK-NOT: strong_release
|
|
sil @_TF4main7my_mainFCS_3FooSi : $@convention(thin) (@owned Foo) -> Int {
|
|
bb0(%0 : $Foo):
|
|
debug_value %0 : $Foo, let, name "x" // id: %1
|
|
%3 = class_method %0 : $Foo, #Foo.ping : (Foo) -> () -> Int, $@convention(method) (@guaranteed Foo) -> Int // user: %4
|
|
%4 = apply %3(%0) : $@convention(method) (@guaranteed Foo) -> Int // user: %6
|
|
strong_release %0 : $Foo // id: %5
|
|
return %4 : $Int // id: %6
|
|
}
|
|
|
|
sil_vtable Foo {
|
|
#Foo.ping: @_TFC4main3Foo4pingfS0_FT_Si // main.Foo.ping (main.Foo)() -> Swift.Int
|
|
#Foo.init!initializer: @_TFC4main3FoocfMS0_FT_S0_ // main.Foo.init (main.Foo.Type)() -> main.Foo
|
|
}
|