Skip to content

Commit 62131d5

Browse files
add test case
1 parent 00b1d1b commit 62131d5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; Verify that we don't crash when eliding coro_elide_safe callsites.
2+
; RUN: opt < %s -passes='cgscc(function<>(simplifycfg<>),function-attrs,coro-split,coro-annotation-elide)' -S | FileCheck %s
3+
4+
; CHECK-LABEL: define void @foo()
5+
define void @foo() presplitcoroutine personality ptr null {
6+
entry:
7+
%0 = call token @llvm.coro.save(ptr null)
8+
br label %branch
9+
10+
branch:
11+
; Check that we don't call bar at all.
12+
; CHECK-NOT: call void @bar{{.*}}
13+
call void @bar() coro_elide_safe
14+
; CHECK: call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr @bar.resumers)
15+
ret void
16+
}
17+
18+
; CHECK-LABEL: define void @bar()
19+
define void @bar() presplitcoroutine personality ptr null {
20+
entry:
21+
%0 = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
22+
%1 = call ptr @llvm.coro.begin(token %0, ptr null)
23+
%2 = call token @llvm.coro.save(ptr null)
24+
%3 = call i8 @llvm.coro.suspend(token none, i1 false)
25+
ret void
26+
}
27+
28+
declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) nounwind
29+
declare ptr @llvm.coro.begin(token, ptr writeonly) nounwind
30+
declare token @llvm.coro.save(ptr) nomerge nounwind
31+
declare i8 @llvm.coro.suspend(token, i1) nounwind
32+

0 commit comments

Comments
 (0)