Skip to content

Commit 9c9124e

Browse files
Add test case for missing musttail in dynamic replacement.
(cherry picked from commit 94593e4)
1 parent e2135e9 commit 9c9124e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-swift-frontend %s -emit-ir -disable-objc-interop | %FileCheck %s
2+
3+
// REQUIRES: concurrency
4+
5+
public dynamic func number() async -> Int {
6+
return 100
7+
}
8+
9+
@_dynamicReplacement(for: number())
10+
internal func _replacement_number() async -> Int {
11+
return 200
12+
}
13+
14+
// rdar://78284346 - Dynamic replacement should use musttail
15+
// for tail calls from swifttailcc to swifttailcc
16+
// CHECK-LABEL: define {{.*}} swifttailcc void @"$s25async_dynamic_replacement01_C7_numberSiyYaFTI"
17+
// CHECK-NOT: musttail
18+
// CHECK: call swifttailcc void
19+
// CHECK-NEXT: ret void
20+
21+
public func calls_number() async -> Int {
22+
await number()
23+
}

0 commit comments

Comments
 (0)