diff options
| author | Diego Novillo <dnovillo@google.com> | 2015-05-13 17:04:29 +0000 |
|---|---|---|
| committer | Diego Novillo <dnovillo@google.com> | 2015-05-13 17:04:29 +0000 |
| commit | ffc84e378a7c251b4c82733b5a3b30f48291aec7 (patch) | |
| tree | 2330fc2a714a0b0dd459f2e3ef19341781d3016f /llvm/test/Transforms/SampleProfile | |
| parent | 732e2681c710147e95b390db06bf72ded13efb1e (diff) | |
| download | bcm5719-llvm-ffc84e378a7c251b4c82733b5a3b30f48291aec7.tar.gz bcm5719-llvm-ffc84e378a7c251b4c82733b5a3b30f48291aec7.zip | |
Add function entry counts from sample profiles.
This patch uses the new function profile metadata "function_entry_count"
to annotate entry counts from sample profiles.
In a sampling profile, the total samples collected at the function entry
are an approximation for the number of times that function was invoked.
llvm-svn: 237265
Diffstat (limited to 'llvm/test/Transforms/SampleProfile')
| -rw-r--r-- | llvm/test/Transforms/SampleProfile/Inputs/entry_counts.prof | 3 | ||||
| -rw-r--r-- | llvm/test/Transforms/SampleProfile/entry_counts.ll | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/Inputs/entry_counts.prof b/llvm/test/Transforms/SampleProfile/Inputs/entry_counts.prof new file mode 100644 index 00000000000..5c2172b5a4d --- /dev/null +++ b/llvm/test/Transforms/SampleProfile/Inputs/entry_counts.prof @@ -0,0 +1,3 @@ +empty:100:13293 +0: 0 +1: 100 diff --git a/llvm/test/Transforms/SampleProfile/entry_counts.ll b/llvm/test/Transforms/SampleProfile/entry_counts.ll new file mode 100644 index 00000000000..bf66e693a9d --- /dev/null +++ b/llvm/test/Transforms/SampleProfile/entry_counts.ll @@ -0,0 +1,24 @@ +; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/entry_counts.prof -S | FileCheck %s + +; According to the profile, function empty() was called 13,293 times. +; CHECK: {{.*}} = !{!"function_entry_count", i64 13293} + +define void @empty() { +entry: + ret void, !dbg !9 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!6, !7} +!llvm.ident = !{!8} + +!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 237249) (llvm/trunk 237261)", isOptimized: false, runtimeVersion: 0, emissionKind: 2, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) +!1 = !DIFile(filename: "entry_counts.c", directory: "/usr/local/google/home/dnovillo/llvm/test/pgo") +!2 = !{} +!3 = !{!4} +!4 = !DISubprogram(name: "empty", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, function: void ()* @empty, variables: !2) +!5 = !DISubroutineType(types: !2) +!6 = !{i32 2, !"Dwarf Version", i32 4} +!7 = !{i32 2, !"Debug Info Version", i32 3} +!8 = !{!"clang version 3.7.0 (trunk 237249) (llvm/trunk 237261)"} +!9 = !DILocation(line: 1, column: 15, scope: !4) |

