39 lines · plain
1; RUN: opt -passes='module(coro-early),cgscc(coro-split)' -S < %s | FileCheck %s2 3declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)4 5declare ptr @llvm.coro.begin(token, ptr writeonly)6 7declare token @llvm.coro.save(ptr)8 9declare i8 @llvm.coro.suspend(token, i1)10 11declare i1 @get.i1()12 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(17 18define void @foo() presplitcoroutine {19entry:20 %__promise = alloca i32, align 821 %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.suspend25 26init.suspend: ; preds = %entry27 %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, 030 br i1 %cond, label %if.then154, label %invoke.cont16331 32if.then154: ; preds = %init.suspend, %entry33 call void @foo()34 br label %invoke.cont16335 36invoke.cont163: ; preds = %if.then154, %init.suspend37 ret void38}39