Files
swift-mirror/test/SIL/Parser/debug_info.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

28 lines
1.1 KiB
Plaintext

// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all -sil-print-debuginfo %s | %FileCheck %s
sil_stage canonical
import Builtin
import Swift
struct TheStruct {
var data : Builtin.Int64
init()
}
sil_scope 1 { parent @struct_debug_info_test : $@convention(thin) (TheStruct) -> TheStruct }
// https://github.com/apple/swift/issues/57162
// Make sure of the `forwarding` directive being optional in the presence of
// debug info directives (i.e. `loc` and `scope`).
// CHECK-LABEL: sil [transparent] @struct_debug_info_test :
sil [transparent] @struct_debug_info_test : $@convention(thin) (TheStruct) -> TheStruct {
bb0(%0 : $TheStruct):
// CHECK: %1 = struct_extract %0 : $TheStruct, #TheStruct.data, loc "input.swift":3:4, scope 1
%1 = struct_extract %0 : $TheStruct, #TheStruct.data, loc "input.swift":3:4, scope 1
// CHECK: %2 = struct $TheStruct (%1 : $Builtin.Int64), loc "input.swift":5:6, scope 1
%2 = struct $TheStruct (%1 : $Builtin.Int64), loc "input.swift":5:6, scope 1
return %2 : $TheStruct, loc "input.swift":7:8, scope 1
}
// CHECK: } // end sil function 'struct_debug_info_test'