1; RUN: llc -filetype=asm %s -o - -mtriple x86_64-pc-linux-gnu | FileCheck %s
2; RUN: llc -filetype=obj %s -o %t -mtriple x86_64-pc-linux-gnu
3; RUN: llvm-readobj --cg-profile %t | FileCheck %s --check-prefix=OBJ
4
5declare void @b()
6
7define void @a() {
8  call void @b()
9  ret void
10}
11
12define void @freq(i1 %cond) {
13  br i1 %cond, label %A, label %B
14A:
15  call void @a();
16  ret void
17B:
18  call void @b();
19  ret void
20}
21
22!llvm.module.flags = !{!0}
23
24!0 = !{i32 5, !"CG Profile", !1}
25!1 = !{!2, !3, !4, !5}
26!2 = !{void ()* @a, void ()* @b, i64 32}
27!3 = !{void (i1)* @freq, void ()* @a, i64 11}
28!4 = !{void (i1)* @freq, void ()* @b, i64 20}
29!5 = !{void (i1)* @freq, null, i64 20}
30
31; CHECK: .cg_profile a, b, 32
32; CHECK: .cg_profile freq, a, 11
33; CHECK: .cg_profile freq, b, 20
34
35; OBJ: CGProfile [
36; OBJ:  CGProfileEntry {
37; OBJ:    From: a
38; OBJ:    To: b
39; OBJ:    Weight: 32
40; OBJ:  }
41; OBJ:  CGProfileEntry {
42; OBJ:    From: freq
43; OBJ:    To: a
44; OBJ:    Weight: 11
45; OBJ:  }
46; OBJ:  CGProfileEntry {
47; OBJ:    From: freq
48; OBJ:    To: b
49; OBJ:    Weight: 20
50; OBJ:  }
51; OBJ:]
52