1 ; RUN: opt < %s -passes='cg-profile<in-lto-post-link>' -S | FileCheck %s --check-prefixes=CHECK,LTO
2 ; RUN: opt < %s -passes='cg-profile' -S | FileCheck %s --check-prefixes=CHECK,NOLTO --implicit-check-not="!{ptr @freq, ptr @func3.llvm.12345"
6 define void @a() !prof !1 {
11 define void @func3.llvm.12345() !PGOFuncName !4 {
15 @foo = common global ptr null, align 8
20 declare dllimport i32 @func5()
23 define void @freq(i1 %cond) !prof !1 {
24 %tmp = load ptr, ptr @foo, align 8
25 call i32 %tmp(), !prof !3
26 br i1 %cond, label %A, label %B, !prof !2
35 !1 = !{!"function_entry_count", i64 32}
36 !2 = !{!"branch_weights", i32 5, i32 10}
37 !3 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410, i64 5415368997850289431, i64 150, i64 -2545542355363006406, i64 10, i64 3667884930908592509, i64 1, i64 15435711456043681792, i64 0}
38 !4 = !{!"cgprofile.ll;func3"}
40 ; CHECK: !llvm.module.flags = !{![[cgprof:[0-9]+]]}
41 ; CHECK: ![[cgprof]] = !{i32 5, !"CG Profile", ![[prof:[0-9]+]]}
42 ; LTO: ![[prof]] = distinct !{![[e0:[0-9]+]], ![[e1:[0-9]+]], ![[e2:[0-9]+]], ![[e3:[0-9]+]], ![[e4:[0-9]+]], ![[e5:[0-9]+]], ![[e6:[0-9]+]]}
43 ; NOLTO: ![[prof]] = distinct !{![[e0:[0-9]+]], ![[e1:[0-9]+]], ![[e2:[0-9]+]], ![[e4:[0-9]+]], ![[e5:[0-9]+]], ![[e6:[0-9]+]]}
44 ; CHECK: ![[e0]] = !{ptr @a, ptr @b, i64 32}
45 ; CHECK: ![[e1]] = !{ptr @freq, ptr @func4, i64 1030}
46 ; CHECK: ![[e2]] = !{ptr @freq, ptr @func2, i64 410}
47 ; LTO: ![[e3]] = !{ptr @freq, ptr @func3.llvm.12345, i64 150}
48 ; CHECK: ![[e4]] = !{ptr @freq, ptr @func1, i64 10}
49 ; CHECK: ![[e5]] = !{ptr @freq, ptr @a, i64 11}
50 ; CHECK: ![[e6]] = !{ptr @freq, ptr @b, i64 21}
51 ; CHECK-NOT: !{ptr @freq, ptr @func5, i64 1}
52 ; CHECK-NOT: !{ptr @freq, ptr @func6, i64 0}