1 ; Check that coro-split doesn't choke on intrinsics in unreachable blocks
2 ; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S
4 define ptr @f(i1 %arg) presplitcoroutine personality i32 0 {
7 store i1 %arg, ptr %arg.addr
8 %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
9 %size = call i32 @llvm.coro.size.i32()
10 %alloc = call ptr @malloc(i32 %size)
11 %hdl = call ptr @llvm.coro.begin(token %id, ptr %alloc)
15 %0 = call i8 @llvm.coro.suspend(token none, i1 false)
16 switch i8 %0, label %suspend [i8 0, label %resume
22 %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
23 call void @free(ptr %mem)
27 call i1 @llvm.coro.end(ptr %hdl, i1 0, token none)
31 %argval = load i1, ptr %arg.addr
32 call void @print(i1 %argval)
37 declare ptr @llvm.coro.free(token, ptr)
38 declare i32 @llvm.coro.size.i32()
39 declare i8 @llvm.coro.suspend(token, i1)
40 declare void @llvm.coro.resume(ptr)
41 declare void @llvm.coro.destroy(ptr)
43 declare token @llvm.coro.id(i32, ptr, ptr, ptr)
44 declare i1 @llvm.coro.alloc(token)
45 declare ptr @llvm.coro.begin(token, ptr)
46 declare i1 @llvm.coro.end(ptr, i1, token)
48 declare noalias ptr @malloc(i32)
49 declare void @print(i1)
50 declare void @free(ptr)