1 ; Tests that CoroEarly pass correctly lowers coro.resume, coro.destroy
2 ; and other intrinsics managed by this pass.
3 ; RUN: opt < %s -S -passes=coro-early | FileCheck %s
5 ; CHECK: %NoopCoro.Frame = type { void (%NoopCoro.Frame*)*, void (%NoopCoro.Frame*)* }
6 ; CHECK: @NoopCoro.Frame.Const = private constant %NoopCoro.Frame { void (%NoopCoro.Frame*)* @NoopCoro.ResumeDestroy, void (%NoopCoro.Frame*)* @NoopCoro.ResumeDestroy }
8 ; CHECK-LABEL: @callResume(
9 define void @callResume(i8* %hdl) {
12 ; CHECK-NEXT: %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
13 ; CHECK-NEXT: %1 = bitcast i8* %0 to void (i8*)*
14 ; CHECK-NEXT: call fastcc void %1(i8* %hdl)
15 call void @llvm.coro.resume(i8* %hdl)
17 ; CHECK-NEXT: %2 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 1)
18 ; CHECK-NEXT: %3 = bitcast i8* %2 to void (i8*)*
19 ; CHECK-NEXT: call fastcc void %3(i8* %hdl)
20 call void @llvm.coro.destroy(i8* %hdl)
23 ; CHECK-NEXT: ret void
27 define void @eh(i8* %hdl) personality i8* null {
30 ; CHECK-NEXT: %0 = call i8* @llvm.coro.subfn.addr(i8* %hdl, i8 0)
31 ; CHECK-NEXT: %1 = bitcast i8* %0 to void (i8*)*
32 ; CHECK-NEXT: invoke fastcc void %1(i8* %hdl)
33 invoke void @llvm.coro.resume(i8* %hdl)
34 to label %cont unwind label %ehcleanup
39 %0 = cleanuppad within none []
40 cleanupret from %0 unwind to caller
48 ; CHECK-NEXT: ret i8* bitcast (%NoopCoro.Frame* @NoopCoro.Frame.Const to i8*)
49 %n = call i8* @llvm.coro.noop()
53 ; CHECK-LABEL: define private fastcc void @NoopCoro.ResumeDestroy(%NoopCoro.Frame* %0) {
55 ; CHECK-NEXT: ret void
58 declare void @llvm.coro.resume(i8*)
59 declare void @llvm.coro.destroy(i8*)
60 declare i8* @llvm.coro.noop()