Files
swift-mirror/test/SILGen/complete_object_init.swift
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

26 lines
1.1 KiB
Swift

// RUN: %target-swift-emit-silgen -Xllvm -sil-print-types %s | %FileCheck %s
struct X { }
class A {
// CHECK-LABEL: sil hidden [ossa] @$s20complete_object_init1AC{{[_0-9a-zA-Z]*}}fC : $@convention(method) (@thick A.Type) -> @owned A
// CHECK: bb0([[SELF_META:%[0-9]+]] : $@thick A.Type):
// CHECK: [[SELF_BOX:%[0-9]+]] = alloc_box ${ var A }
// CHECK: [[UNINIT_SELF:%[0-9]+]] = mark_uninitialized [delegatingself] [[SELF_BOX]] : ${ var A }
// CHECK: [[UNINIT_SELF_LIFETIME:%[^,]+]] = begin_borrow [lexical] [var_decl] [[UNINIT_SELF]]
// CHECK: [[PB:%.*]] = project_box [[UNINIT_SELF_LIFETIME]]
// CHECK: [[INIT:%[0-9]+]] = class_method [[SELF_META]] : $@thick A.Type, #A.init!allocator
// CHECK: [[INIT_RESULT:%[0-9]+]] = apply [[INIT]]({{%[^,]*}}, [[SELF_META]])
// CHECK: assign [[INIT_RESULT]] to [[PB]] : $*A
// CHECK: [[RESULT:%[0-9]+]] = load [copy] [[PB]] : $*A
// CHECK: end_borrow [[UNINIT_SELF_LIFETIME]]
// CHECK: destroy_value [[UNINIT_SELF]] : ${ var A }
// CHECK: return [[RESULT]] : $A
convenience init() {
self.init(x: X())
}
init(x: X) { }
}