1 ; RUN: opt < %s -passes='default<O2>' -S | FileCheck --check-prefixes=CHECK %s
2 target datalayout = "p:64:64:64"
4 %swift.async_func_pointer = type <{ i32, i32 }>
5 %swift.context = type { ptr, ptr }
6 %swift.opaque = type opaque
7 %swift.refcounted = type { ptr, i64 }
8 %swift.type = type { i64 }
9 %swift.error = type opaque
11 @repoTu = linkonce_odr hidden global %swift.async_func_pointer <{ i32 trunc (i64 sub (i64 ptrtoint (ptr @repo to i64), i64 ptrtoint (ptr @repoTu to i64)) to i32), i32 16 }>, align 8
13 declare token @llvm.coro.id.async(i32, i32, i32, ptr) #0
15 declare ptr @llvm.coro.begin(token, ptr writeonly) #0
17 declare i1 @llvm.coro.end.async(ptr, i1, ...) #0
19 define swifttailcc void @repo(ptr swiftasync %0, ptr noalias nocapture %1, ptr noalias nocapture %2, ptr %3, ptr %4, ptr %Self, ptr %Self.AsyncSequence, ptr %Self.Element.Comparable) #1 {
21 %5 = alloca ptr, align 8
22 %6 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, ptr @repoTu)
23 %7 = call ptr @llvm.coro.begin(token %6, ptr null)
24 store ptr %0, ptr %5, align 8
25 %8 = call swiftcc i1 %3(ptr noalias nocapture %1, ptr noalias nocapture %2, ptr swiftself %4) #2
26 %9 = load ptr, ptr %5, align 8
27 %10 = getelementptr inbounds <{ ptr, ptr }>, <{ ptr, ptr }>* %9, i32 0, i32 1
28 %11 = load ptr, ptr %10, align 8
29 %12 = load ptr, ptr %5, align 8
30 %13 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %7, i1 false, ptr @repo.0, ptr %11, ptr %12, i1 %8, ptr null)
34 ; CHECK: define swifttailcc void @repo
35 ; CHECK-NOT:llvm.coro.end.async
36 ; CHECK: musttail call swifttailcc void
37 ; CHECK-NOT:llvm.coro.end.async
38 ; CHECK-NOT: unreachable
41 define internal swifttailcc void @repo.0(ptr %0, ptr %1, i1 %2, ptr %3) #0 {
43 musttail call swifttailcc void %0(ptr swiftasync %1, i1 %2, ptr swiftself %3)
47 attributes #0 = { nounwind }
48 attributes #1 = { nounwind }