Files
swift-mirror/test/Concurrency/default_actor_definit.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

70 lines
2.7 KiB
Swift

// RUN: %target-swift-frontend -Xllvm -sil-print-types -emit-sil %s -target %target-swift-5.1-abi-triple | %FileCheck %s
// RUN: %target-swift-frontend -Xllvm -sil-print-types -emit-sil %s -target %target-swift-5.1-abi-triple -strict-concurrency=targeted | %FileCheck %s
// RUN: %target-swift-frontend -Xllvm -sil-print-types -emit-sil %s -target %target-swift-5.1-abi-triple -strict-concurrency=complete | %FileCheck %s
// RUN: %target-swift-frontend -Xllvm -sil-print-types -emit-sil %s -target %target-swift-5.1-abi-triple -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation | %FileCheck %s
// REQUIRES: concurrency
// REQUIRES: swift_in_compiler
// REQUIRES: swift_feature_RegionBasedIsolation
actor A {
var x: String = "Hello"
var y: String = "World"
}
// CHECK-LABEL: sil hidden @$s21default_actor_definit1ACACycfc
// CHECK: builtin "initializeDefaultActor"(%0 : $A) : $()
// CHECK-LABEL: end sil function '$s21default_actor_definit1ACACycfc'
actor B {
var x: String
var y: String
init() {
x = "Hello"
y = "World"
}
}
// CHECK-LABEL: sil hidden @$s21default_actor_definit1BCACycfc
// CHECK: builtin "initializeDefaultActor"(%0 : $B) : $()
// CHECK-LABEL: end sil function '$s21default_actor_definit1BCACycfc'
actor C {
var x: String
var y: Int
init?(y: Int) {
self.x = "Hello"
guard y >= 0 else { return nil }
self.y = y
}
convenience init?(yy: Int) {
guard yy <= 100 else { return nil }
self.init(y: yy)
}
}
// CHECK-LABEL: sil hidden @$s21default_actor_definit1CC1yACSgSi_tcfc
// CHECK: builtin "initializeDefaultActor"(%1 : $C)
// CHECK: [[EI:%.*]] = end_init_let_ref %1
// CHECK: [[X:%.*]] = ref_element_addr [[EI]] : $C, #C.x
// CHECK-NEXT: [[ACCESS:%.*]] = begin_access [init] [static] [[X]] : $*String
// CHECK-NEXT: store {{.*}} to [[ACCESS]] : $*String
// CHECK-NEXT: end_access [[ACCESS]] : $*String
// CHECK: cond_br {{%.*}}, bb1, bb2
// CHECK: bb1:
// CHECK: ref_element_addr [[EI]] : $C, #C.y
// CHECK: br bb3
// CHECK: bb2:
// CHECK: [[X:%.*]] = ref_element_addr [[EI]] : $C, #C.x
// CHECK-NEXT: [[ACCESS:%.*]] = begin_access [deinit] [static] [[X]] : $*String
// CHECK-NEXT: destroy_addr [[ACCESS]] : $*String
// CHECK-NEXT: end_access [[ACCESS]] : $*String
// CHECK: builtin "destroyDefaultActor"([[EI]] : $C)
// CHECK: br bb3
// CHECK-LABEL: end sil function '$s21default_actor_definit1CC1yACSgSi_tcfc'
// CHECK-LABEL: sil hidden @$s21default_actor_definit1CC2yyACSgSi_tcfC
// CHECK-NOT: builtin "initializeDefaultActor"
// CHECK-NOT: builtin "destroyDefaultActor"
// CHECK-LABEL: end sil function '$s21default_actor_definit1CC2yyACSgSi_tcfC'