1 ; RUN: opt -passes='module(coro-early),cgscc(coro-split)' -S < %s | FileCheck %s
3 declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)
5 declare ptr @llvm.coro.begin(token, ptr writeonly)
7 declare token @llvm.coro.save(ptr)
9 declare i8 @llvm.coro.suspend(token, i1)
13 ; CHECK-LABEL: define void @foo()
14 ; CHECK-LABEL: define {{.*}}void @foo.resume(
15 ; CHECK: call void @foo()
16 ; CHECK-LABEL: define {{.*}}void @foo.destroy(
18 define void @foo() presplitcoroutine {
20 %__promise = alloca i32, align 8
21 %0 = call token @llvm.coro.id(i32 16, ptr %__promise, ptr null, ptr null)
22 %1 = call ptr @llvm.coro.begin(token %0, ptr null)
23 %c = call i1 @get.i1()
24 br i1 %c, label %if.then154, label %init.suspend
26 init.suspend: ; preds = %entry
27 %save = call token @llvm.coro.save(ptr null)
28 %i3 = call i8 @llvm.coro.suspend(token %save, i1 false)
29 %cond = icmp eq i8 %i3, 0
30 br i1 %cond, label %if.then154, label %invoke.cont163
32 if.then154: ; preds = %init.suspend, %entry
34 br label %invoke.cont163
36 invoke.cont163: ; preds = %if.then154, %init.suspend