xref: /llvm-project/llvm/test/Transforms/SampleProfile/cold-indirect-call.ll (revision 0271ae65a66367d802fa6866599d11e35f68450f)
1cee313d2SEric Christopher; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/cold-indirect-call.prof -S | FileCheck %s
2cee313d2SEric Christopher
3*0271ae65SFangrui Songdefine i32 @foo(ptr %func) #0 !dbg !3 {
4cee313d2SEric Christopher; CHECK: icmp {{.*}} @bar
5cee313d2SEric Christopher; CHECK-NOT: icmp {{.*}} @baz
6cee313d2SEric Christopher  %call = call i32 %func(), !dbg !4
7cee313d2SEric Christopher  ret i32 %call
8cee313d2SEric Christopher}
9cee313d2SEric Christopher
107a6c8942SWei Midefine i32 @bar() #0 !dbg !5 {
11cee313d2SEric Christopher  ret i32 41, !dbg !6
12cee313d2SEric Christopher}
13cee313d2SEric Christopher
147a6c8942SWei Midefine i32 @baz() #0 !dbg !7 {
15cee313d2SEric Christopher  ret i32 42, !dbg !8
16cee313d2SEric Christopher}
17cee313d2SEric Christopher
187a6c8942SWei Miattributes #0 = {"use-sample-profile"}
19cee313d2SEric Christopher
20cee313d2SEric Christopher!llvm.dbg.cu = !{!0}
21cee313d2SEric Christopher!llvm.module.flags = !{!2}
22cee313d2SEric Christopher
23cee313d2SEric Christopher!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
24cee313d2SEric Christopher!1 = !DIFile(filename: "foo.cc", directory: "/")
25cee313d2SEric Christopher!2 = !{i32 2, !"Debug Info Version", i32 3}
26cee313d2SEric Christopher!3 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, unit: !0)
27cee313d2SEric Christopher!4 = !DILocation(line: 5, scope: !3)
28cee313d2SEric Christopher!5 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 8, unit: !0)
29cee313d2SEric Christopher!6 = !DILocation(line: 9, scope: !5)
30cee313d2SEric Christopher!7 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 12, unit: !0)
31cee313d2SEric Christopher!8 = !DILocation(line: 13, scope: !7)
32