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