Skip to content

Commit 56ca97f

Browse files
add non-inlineable test case
1 parent ea4c51b commit 56ca97f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
; Verify that we don't crash when eliding coro_elide_safe callsites.
2+
; RUN: opt < %s -passes='cgscc(function<>(simplifycfg<>),function-attrs,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 still call bar() because we can't inline bar.noalloc()
12+
; CHECK: call void @bar()
13+
call void @bar() coro_elide_safe
14+
ret void
15+
}
16+
17+
; CHECK-LABEL: define void @bar()
18+
define void @bar() personality ptr null {
19+
entry:
20+
%0 = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
21+
%1 = call ptr @llvm.coro.begin(token %0, ptr null)
22+
%2 = call token @llvm.coro.save(ptr null)
23+
%3 = call i8 @llvm.coro.suspend(token none, i1 false)
24+
ret void
25+
}
26+
27+
declare void @bar.noalloc(ptr)
28+
29+
declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) nounwind
30+
declare ptr @llvm.coro.begin(token, ptr writeonly) nounwind
31+
declare token @llvm.coro.save(ptr) nomerge nounwind
32+
declare i8 @llvm.coro.suspend(token, i1) nounwind
33+

0 commit comments

Comments
 (0)