Files
swift-mirror/test/SILOptimizer/mm_inlinecaches_multiple.sil
Erik Eckstein 7cceaff5f3 SIL: don't print operand types in textual SIL
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.
2024-11-21 18:49:52 +01:00

59 lines
2.0 KiB
Plaintext

// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -specdevirt -code-sinking | %FileCheck %s
// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -specdevirt -code-sinking -wmo | %FileCheck --check-prefix=CHECK-WMO %s
sil_stage canonical
import Builtin
import Swift
// Make sure we convert a class_method into a diamond control flow
// where one of the sides is a direct call to FOO::ping.
class Foo {
func ping()
}
class Bar : Foo {
}
sil @_TFC8testcase3Foo4pingfS0_FT_T_ : $@convention(method) (@guaranteed Foo) -> () {
bb0(%0 : $Foo):
%2 = tuple () // user: %3
return %2 : $() // id: %3
}
sil @_TFC8testcase3FoocfMS0_FT_S0_ : $@convention(method) (@owned Foo) -> @owned Foo {
bb0(%0 : $Foo):
return %0 : $Foo // id: %1
}
//CHECK-LABEL: @_TF8testcase7my_mainFCS_3FooT_
//CHECK: checked_cast_br [exact] Foo in %0 : $Foo to Foo
//CHECK: return
//CHECK: checked_cast_br [exact] Foo in %0 : $Foo to Bar
//CHECK: class_method
//CHECK-WMO-LABEL: @_TF8testcase7my_mainFCS_3FooT_
//CHECK-WMO: checked_cast_br [exact] Foo in %0 : $Foo to Foo
//CHECK-WMO: return
//CHECK-WMO: unchecked_ref_cast %0 : $Foo to $Bar
//CHECK-WMO: class_method
sil @_TF8testcase7my_mainFCS_3FooT_ : $@convention(thin) (@owned Foo) -> () {
bb0(%0 : $Foo):
%1 = class_method %0 : $Foo, #Foo.ping : (Foo) -> () -> () , $@convention(method) (@guaranteed Foo) -> () // user: %2
%2 = apply %1(%0) : $@convention(method) (@guaranteed Foo) -> ()
%3 = tuple () // user: %4
return %3 : $() // id: %4
}
sil_vtable Foo {
#Foo.ping: @_TFC8testcase3Foo4pingfS0_FT_T_ // testcase.Foo.ping (testcase.Foo)() -> ()
#Foo.init!initializer: @_TFC8testcase3FoocfMS0_FT_S0_ // testcase.Foo.init (testcase.Foo.Type)() -> testcase.Foo
}
sil_vtable Bar {
#Foo.ping: @_TFC8testcase3Foo4pingfS0_FT_T_ [inherited]
#Foo.init!initializer: @_TFC8testcase3FoocfMS0_FT_S0_ [inherited]
}