Files
swift-mirror/test/SIL/Serialization/async.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

101 lines
3.9 KiB
Plaintext

// First parse this and then emit a *.sib. Then read in the *.sib, then recreate
// RUN: %empty-directory(%t)
// RUN: %target-sil-opt -sil-print-types %s -emit-sib -o %t/tmp.sib -module-name async
// RUN: %target-sil-opt -sil-print-types %t/tmp.sib -module-name async | %FileCheck %s
// REQUIRES: concurrency
import Builtin
import Swift
import _Concurrency
sil [serialized] @aaa : $@async @convention(thin) () -> () {
entry:
%a = function_ref @async_continuation : $@convention(thin) @async () -> ()
%b = function_ref @async_continuation_throws : $@convention(thin) @async () -> ()
%c = function_ref @async_continuation_addr : $@convention(thin) @async () -> ()
%d = function_ref @async_continuation_throws_addr : $@convention(thin) @async () -> ()
return undef : $()
}
// CHECK: sil [serialized] @async_continuation : $@convention(thin) @async () -> () {
sil [serialized] @async_continuation : $@async () -> () {
// CHECK-NEXT: bb
entry:
// CHECK-NEXT: [[CONT:%.*]] = get_async_continuation Builtin.Int32
%c = get_async_continuation Builtin.Int32
// CHECK-NEXT: await_async_continuation [[CONT]] : $Builtin.RawUnsafeContinuation, resume [[RESUME:bb[0-9]+]]
await_async_continuation %c : $Builtin.RawUnsafeContinuation, resume bb1
// CHECK-NEXT: {{^ *$}}
// CHECK-NEXT: [[RESUME]]([[RVALUE:%.*]] : $Builtin.Int32):
bb1(%r : $Builtin.Int32):
return undef : $()
}
// CHECK: sil [serialized] @async_continuation_throws : $@convention(thin) @async () -> () {
sil [serialized] @async_continuation_throws : $@async () -> () {
// CHECK-NEXT: bb
entry:
// CHECK-NEXT: [[CONT:%.*]] = get_async_continuation [throws] Builtin.Int32
%c = get_async_continuation [throws] Builtin.Int32
// CHECK-NEXT: await_async_continuation [[CONT]] : $Builtin.RawUnsafeContinuation, resume [[RESUME:bb[0-9]+]], error [[ERROR:bb[0-9]+]]
await_async_continuation %c : $Builtin.RawUnsafeContinuation, resume bb1, error bb2
// CHECK-NEXT: {{^ *$}}
// CHECK-NEXT: [[ERROR]]([[EVALUE:%.*]] : $any Error):
bb2(%e : $Error):
// CHECK-NEXT: br
br bb3
// CHECK-NEXT: {{^ *$}}
// CHECK-NEXT: [[RESUME]]([[RVALUE:%.*]] : $Builtin.Int32):
bb1(%r : $Builtin.Int32):
// CHECK-NEXT: br
br bb3
bb3:
return undef : $()
}
// CHECK: sil [serialized] @async_continuation_addr : $@convention(thin) @async () -> () {
sil [serialized] @async_continuation_addr : $@async () -> () {
// CHECK-NEXT: bb
entry:
// CHECK: [[SLOT:%.*]] = alloc_stack
%a = alloc_stack $Builtin.Int32
// CHECK-NEXT: [[CONT:%.*]] = get_async_continuation_addr Builtin.Int32, [[SLOT]] : $*Builtin.Int32
%c = get_async_continuation_addr Builtin.Int32, %a : $*Builtin.Int32
// CHECK-NEXT: await_async_continuation [[CONT]] : $Builtin.RawUnsafeContinuation, resume [[RESUME:bb[0-9]+]]
await_async_continuation %c : $Builtin.RawUnsafeContinuation, resume bb1
// CHECK-NEXT: {{^ *$}}
// CHECK-NEXT: [[RESUME]]:
bb1:
dealloc_stack %a : $*Builtin.Int32
return undef : $()
}
// CHECK: sil [serialized] @async_continuation_throws_addr : $@convention(thin) @async () -> () {
sil [serialized] @async_continuation_throws_addr : $@async () -> () {
// CHECK-NEXT: bb
entry:
// CHECK: [[SLOT:%.*]] = alloc_stack
%a = alloc_stack $Builtin.Int32
// CHECK-NEXT: [[CONT:%.*]] = get_async_continuation_addr [throws] Builtin.Int32, [[SLOT]] : $*Builtin.Int32
%c = get_async_continuation_addr [throws] Builtin.Int32, %a : $*Builtin.Int32
// CHECK-NEXT: await_async_continuation [[CONT]] : $Builtin.RawUnsafeContinuation, resume [[RESUME:bb[0-9]+]], error [[ERROR:bb[0-9]+]]
await_async_continuation %c : $Builtin.RawUnsafeContinuation, resume bb1, error bb2
// CHECK-NEXT: {{^ *$}}
// CHECK-NEXT: [[ERROR]]([[EVALUE:%.*]] : $any Error):
bb2(%e : $any Error):
// CHECK-NEXT: dealloc_stack
dealloc_stack %a : $*Builtin.Int32
// CHECK-NEXT: br
br bb3
// CHECK-NEXT: {{^ *$}}
// CHECK-NEXT: [[RESUME]]:
bb1:
dealloc_stack %a : $*Builtin.Int32
br bb3
bb3:
return undef : $()
}