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 }
7 @repoTU = 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
9 define swifttailcc void @repo(ptr swiftasync %0) {
11 %1 = alloca ptr, align 8
12 %2 = call token @llvm.coro.id.async(i32 16, i32 16, i32 0, ptr @repoTU)
13 %3 = call ptr @llvm.coro.begin(token %2, ptr null)
14 store ptr %0, ptr %1, align 8
15 %4 = load ptr, ptr %1, align 8
16 %5 = getelementptr inbounds <{ ptr, ptr }>, ptr %4, i32 0, i32 1
17 %6 = load ptr, ptr %5, align 8
18 %7 = load ptr, ptr %1, align 8
19 %8 = call i1 (ptr, i1, ...) @llvm.coro.end.async(ptr %3, i1 false, ptr @repo.0, ptr %6, ptr %7)
23 ; CHECK-NOT: llvm.coro.id.async
25 define internal swifttailcc void @repo.0(ptr %0, ptr %1) #1 {
27 musttail call swifttailcc void %0(ptr swiftasync %1)
31 ; Function Attrs: nounwind
32 declare token @llvm.coro.id.async(i32, i32, i32, ptr) #1
34 ; Function Attrs: nounwind
35 declare ptr @llvm.coro.begin(token, ptr writeonly) #1
37 ; Function Attrs: nounwind
38 declare i1 @llvm.coro.end.async(ptr, i1, ...) #1
40 attributes #1 = { nounwind }