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.
34 lines
1.6 KiB
Swift
34 lines
1.6 KiB
Swift
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -parse-as-library -enable-builtin-module -Xllvm -sil-print-types -emit-sil -o - | %FileCheck %s
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
import Builtin
|
|
|
|
@MainActor
|
|
func suspend() async {}
|
|
|
|
// Builtin.hopToActor should generate a mandatory hop_to_executor
|
|
// before releasing the actor and reaching a suspend.
|
|
//
|
|
// CHECK-LABEL: sil private @$s14builtin_silgen11runDetachedyyFyyYacfU_ : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>) -> @out τ_0_0 for <()> {
|
|
// CHECK: [[ACTOR:%.*]] = apply {{%.*}}({{%.*}}) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor
|
|
// CHECK: hop_to_executor [mandatory] [[ACTOR]] : $MainActor
|
|
// CHECK: strong_release [[ACTOR]] : $MainActor
|
|
// CHECK: apply %{{.*}}() : $@convention(thin) @async () -> ()
|
|
@available(SwiftStdlib 5.1, *)
|
|
func runDetached() {
|
|
Task.detached {
|
|
Builtin.hopToActor(MainActor.shared)
|
|
await suspend()
|
|
}
|
|
}
|
|
|
|
// CHECK-LABEL: sil{{.*}} @$s14builtin_silgen13testRunInlineyxxyYaXElF : {{.*}} {
|
|
// CHECK: {{bb[0-9]+}}([[RESULT:%[^,]+]] : $*T, [[CLOSURE:%[^,]+]] : $@noescape @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <T>):
|
|
// CHECK: builtin "taskRunInline"<T>([[RESULT]] : $*T, [[CLOSURE]] : $@noescape @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <T>) : $()
|
|
// CHECK-LABEL: } // end sil function '$s14builtin_silgen13testRunInlineyxxyYaXElF'
|
|
@available(SwiftStdlib 5.1, *)
|
|
func testRunInline<T>(_ cl: () async -> T) -> T {
|
|
return Builtin.taskRunInline(cl)
|
|
}
|