xref: /llvm-project/llvm/test/Transforms/Inline/profile_meta_invoke.ll (revision 151602c7a9935558ca671b35359989b261045db0)
1; Make sure that profile metadata is preserved when cloning a call.
2; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s
3
4declare i32 @__gxx_personality_v0(...)
5
6define void @callee(ptr %func) !prof !15 {
7  call void %func(), !prof !16
8  ret void
9}
10
11define void @caller(ptr %func) personality ptr @__gxx_personality_v0 {
12  invoke void @callee(ptr %func)
13          to label %ret unwind label %lpad, !prof !17
14
15ret:
16  ret void
17
18lpad:
19  %exn = landingpad {ptr, i32}
20          cleanup
21  unreachable
22}
23
24!llvm.module.flags = !{!1}
25!1 = !{i32 1, !"ProfileSummary", !2}
26!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
27!3 = !{!"ProfileFormat", !"SampleProfile"}
28!4 = !{!"TotalCount", i64 10000}
29!5 = !{!"MaxCount", i64 10}
30!6 = !{!"MaxInternalCount", i64 1}
31!7 = !{!"MaxFunctionCount", i64 2000}
32!8 = !{!"NumCounts", i64 2}
33!9 = !{!"NumFunctions", i64 2}
34!10 = !{!"DetailedSummary", !11}
35!11 = !{!12, !13, !14}
36!12 = !{i32 10000, i64 100, i32 1}
37!13 = !{i32 999000, i64 100, i32 1}
38!14 = !{i32 999999, i64 1, i32 2}
39!15 = !{!"function_entry_count", i64 1000}
40!16 = !{!"VP", i32 0, i64 1000, i64 9191153033785521275, i64 400, i64 -1069303473483922844, i64 600}
41!17 = !{!"branch_weights", i32 500}
42
43; CHECK-LABEL: @caller(
44; CHECK:  invoke void %func()
45; CHECK-NEXT: {{.*}} !prof ![[PROF:[0-9]+]]
46; CHECK: ![[PROF]] = !{!"VP", i32 0, i64 500, i64 9191153033785521275, i64 200, i64 -1069303473483922844, i64 300}
47