1 ; Test coroutine remarks.
2 ; RUN: opt < %s --disable-output -S -passes='default<O1>' \
3 ; RUN: --pass-remarks="coro-split|coro-elide" \
4 ; RUN: --pass-remarks-missed="coro-split|coro-elide" \
5 ; RUN: --pass-remarks-with-hotness 2>&1 | FileCheck %s
7 ; CHECK: Split 'foo' (frame_size=24, align=8) (hotness: 400)
8 ; CHECK: 'foo' not elided in 'bar' (frame_size=24, align=8) (hotness: 100)
9 ; CHECK: 'foo' elided in 'baz' (frame_size=24, align=8) (hotness: 200)
11 define ptr @foo() presplitcoroutine !prof !0 {
13 %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
14 %need.dyn.alloc = call i1 @llvm.coro.alloc(token %id)
15 br i1 %need.dyn.alloc, label %dyn.alloc, label %coro.begin
17 %size = call i32 @llvm.coro.size.i32()
18 %alloc = call ptr @malloc(i32 %size)
21 %phi = phi ptr [ null, %entry ], [ %alloc, %dyn.alloc ]
22 %hdl = call ptr @llvm.coro.begin(token %id, ptr %phi)
23 call void @print(i32 0)
24 %0 = call i8 @llvm.coro.suspend(token none, i1 false)
25 switch i8 %0, label %suspend [i8 0, label %resume
28 call void @print(i32 1)
32 %mem = call ptr @llvm.coro.free(token %id, ptr %hdl)
33 call void @free(ptr %mem)
36 call i1 @llvm.coro.end(ptr %hdl, i1 0, token none)
40 define i32 @bar() !prof !1 {
42 %hdl = call ptr @foo()
43 call void @llvm.coro.resume(ptr %hdl)
47 define i32 @baz() !prof !2 {
49 %hdl = call ptr @foo()
50 call void @llvm.coro.destroy(ptr %hdl)
54 declare ptr @llvm.coro.free(token, ptr)
55 declare i32 @llvm.coro.size.i32()
56 declare i8 @llvm.coro.suspend(token, i1)
57 declare void @llvm.coro.resume(ptr)
58 declare void @llvm.coro.destroy(ptr)
60 declare token @llvm.coro.id(i32, ptr, ptr, ptr)
61 declare i1 @llvm.coro.alloc(token)
62 declare ptr @llvm.coro.begin(token, ptr)
63 declare i1 @llvm.coro.end(ptr, i1, token)
65 declare noalias ptr @malloc(i32)
66 declare void @print(i32)
67 declare void @free(ptr)
69 !0 = !{!"function_entry_count", i64 400}
70 !1 = !{!"function_entry_count", i64 100}
71 !2 = !{!"function_entry_count", i64 200}