xref: /llvm-project/llvm/test/Transforms/SampleProfile/entry_counts.ll (revision 6f32e71b540bcba7d228cab344ff73aac1d5b305)
1; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/entry_counts.prof -S | FileCheck %s
2
3; According to the profile, function empty() was called 13,293 times.
4; CHECK: {{.*}} = !{!"function_entry_count", i64 13294}
5
6define void @empty() #0 !dbg !4 {
7entry:
8  ret void, !dbg !9
9}
10
11; This function does not have profile, check if function_entry_count is -1
12; CHECK: {{.*}} = !{!"function_entry_count", i64 -1}
13define void @no_profile() #0 {
14entry:
15  ret void
16}
17
18attributes #0 = {"use-sample-profile"}
19
20!llvm.dbg.cu = !{!0}
21!llvm.module.flags = !{!6, !7}
22!llvm.ident = !{!8}
23
24!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 237249) (llvm/trunk 237261)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
25!1 = !DIFile(filename: "entry_counts.c", directory: ".")
26!2 = !{}
27!4 = distinct !DISubprogram(name: "empty", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, retainedNodes: !2)
28!5 = !DISubroutineType(types: !2)
29!6 = !{i32 2, !"Dwarf Version", i32 4}
30!7 = !{i32 2, !"Debug Info Version", i32 3}
31!8 = !{!"clang version 3.7.0 (trunk 237249) (llvm/trunk 237261)"}
32!9 = !DILocation(line: 1, column: 15, scope: !4)
33