xref: /llvm-project/llvm/test/MC/COFF/cgprofile.ll (revision 270f63b84a612dfa438df3d59903bb76fa0c7740)
16c91e623SZequan Wu; RUN: llc -filetype=asm %s -o - -mtriple x86_64-pc-windows-msvc | FileCheck %s
26c91e623SZequan Wu; RUN: llc -filetype=obj %s -o %t -mtriple x86_64-pc-windows-msvc
36c91e623SZequan Wu; RUN: llvm-readobj --cg-profile %t | FileCheck %s --check-prefix=OBJ
46c91e623SZequan Wu
56c91e623SZequan Wudeclare void @b()
66c91e623SZequan Wu
76c91e623SZequan Wudefine void @a() {
86c91e623SZequan Wu  call void @b()
96c91e623SZequan Wu  ret void
106c91e623SZequan Wu}
116c91e623SZequan Wu
126c91e623SZequan Wudefine void @freq(i1 %cond) {
136c91e623SZequan Wu  br i1 %cond, label %A, label %B
146c91e623SZequan WuA:
156c91e623SZequan Wu  call void @a();
166c91e623SZequan Wu  ret void
176c91e623SZequan WuB:
186c91e623SZequan Wu  call void @b();
196c91e623SZequan Wu  ret void
206c91e623SZequan Wu}
216c91e623SZequan Wu
226c91e623SZequan Wu!llvm.module.flags = !{!0}
236c91e623SZequan Wu
246c91e623SZequan Wu!0 = !{i32 5, !"CG Profile", !1}
256c91e623SZequan Wu!1 = !{!2, !3, !4, !5}
26*270f63b8SFangrui Song!2 = !{ptr @a, ptr @b, i64 32}
27*270f63b8SFangrui Song!3 = !{ptr @freq, ptr @a, i64 11}
28*270f63b8SFangrui Song!4 = !{ptr @freq, ptr @b, i64 20}
29*270f63b8SFangrui Song!5 = !{ptr @freq, null, i64 20}
306c91e623SZequan Wu
316c91e623SZequan Wu; CHECK: .cg_profile a, b, 32
326c91e623SZequan Wu; CHECK: .cg_profile freq, a, 11
336c91e623SZequan Wu; CHECK: .cg_profile freq, b, 20
346c91e623SZequan Wu
356c91e623SZequan Wu; OBJ: CGProfile [
366c91e623SZequan Wu; OBJ:  CGProfileEntry {
376c91e623SZequan Wu; OBJ:    From: a
386c91e623SZequan Wu; OBJ:    To: b
396c91e623SZequan Wu; OBJ:    Weight: 32
406c91e623SZequan Wu; OBJ:  }
416c91e623SZequan Wu; OBJ:  CGProfileEntry {
426c91e623SZequan Wu; OBJ:    From: freq
436c91e623SZequan Wu; OBJ:    To: a
446c91e623SZequan Wu; OBJ:    Weight: 11
456c91e623SZequan Wu; OBJ:  }
466c91e623SZequan Wu; OBJ:  CGProfileEntry {
476c91e623SZequan Wu; OBJ:    From: freq
486c91e623SZequan Wu; OBJ:    To: b
496c91e623SZequan Wu; OBJ:    Weight: 20
506c91e623SZequan Wu; OBJ:  }
516c91e623SZequan Wu; OBJ:]
52