Skip to content

Commit a5493e4

Browse files
[wasm] Repair IRGen/async.swift test
The test has been crashed with WebAssembly target due to lack of tail-call support guard in the CoroSplit llvm pass. The crash has been fixed by llvm/llvm-project@8c5c4d9 but the new codegen produces slightly different IR (`call` instead of `tail call`, while they are lowered to the same wasm instruction). So this patch adds new checks for wasm target.
1 parent 57e1e39 commit a5493e4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/IRGen/async.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-availability-checking -enable-library-evolution
33

44
// REQUIRES: concurrency
5+
// UNSUPPORTED: CPU=wasm32
56

67
// CHECK: "$s5async1fyyYaF"
78
public func f() async { }

test/IRGen/async_wasm.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend -primary-file %S/async.swift -emit-ir -disable-availability-checking | %FileCheck %s --check-prefix=NOTAIL
2+
// TODO(katei): %target-swift-frontend -primary-file %S/async.swift -emit-ir -disable-availability-checking -Xcc -mtail-call | %FileCheck %s --check-prefix=TAIL
3+
4+
// REQUIRES: concurrency && CPU=wasm32
5+
6+
// NOTAIL: "$s5async1fyyYaF"
7+
// NOTAIL: "$s5async1gyyYaKF"
8+
// NOTAIL: "$s5async1hyyS2iYbXEF"
9+
10+
// NOTAIL: define{{.*}} swiftcc void @"$s5async8testThisyyAA9SomeClassCnYaF"(ptr swiftasync %0{{.*}}
11+
// NOTAIL-NOT: @swift_task_alloc
12+
// NOTAIL-NOT: musttail call
13+
// NOTAIL: call swiftcc void @swift_task_future_wait_throwing(ptr {{.*}}, ptr {{.*}}, ptr {{.*}}, ptr {{.*}}, ptr {{.*}})

0 commit comments

Comments
 (0)