mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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.
40 lines
1.4 KiB
Swift
40 lines
1.4 KiB
Swift
// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
|
|
// RUN: %target-swift-frontend %s -Xllvm -sil-print-types -emit-sil -g -o - | %FileCheck -check-prefix=CHECK-SIL %s
|
|
|
|
// Verify that -Onone shadow copies are emitted for debug_value_addr
|
|
// instructions.
|
|
|
|
// CHECK-SIL: sil hidden @$s16debug_value_addr4testyyxlF
|
|
// CHECK-SIL: debug_value %0 : $*T, let, name "t", {{.*}}, expr op_deref
|
|
|
|
// CHECK: define {{.*}}$s16debug_value_addr4testyyxlF
|
|
// CHECK: entry:
|
|
// CHECK-NEXT: %[[TADDR:.*]] = alloca
|
|
// CHECK-NEXT: #dbg_declare({{.*}}%[[TADDR]]
|
|
// CHECK: store ptr %0, ptr %[[TADDR:.*]], align
|
|
|
|
struct S<T> {
|
|
var a : T
|
|
func foo() {}
|
|
}
|
|
|
|
func test<T>(_ t : T) {
|
|
let a = S(a: t)
|
|
a.foo()
|
|
}
|
|
|
|
func use<T>(_ t : T) {}
|
|
|
|
// CHECK-SIL: sil hidden @$s16debug_value_addr11GenericSelfV1xACyxGx_tcfC : $@convention(method) <T> (@in T, @thin GenericSelf<T>.Type) -> GenericSelf<T> {
|
|
// CHECK-SIL: bb0(%0 : $*T, %1 : $@thin GenericSelf<T>.Type):
|
|
// TODO: Why is the type repeated below?
|
|
// CHECK-SIL-NEXT: alloc_stack [var_decl] $GenericSelf<T>, var, name "self", type $GenericSelf<T>, loc {{.*}}
|
|
// CHECK-SIL-NEXT: debug_value %0 : $*T, let, name "x", argno 1, expr op_deref, loc {{.*}}
|
|
struct GenericSelf<T> {
|
|
init(x: T) {
|
|
// 'self' is a valid debug variable here even though there is
|
|
// nothing to initialize (the dead alloc_stack cannot be removed).
|
|
use(x)
|
|
}
|
|
}
|