diff options
author | Dehao Chen <dehao@google.com> | 2017-02-28 18:09:44 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-02-28 18:09:44 +0000 |
commit | a60cdd38812d2f2cc32a2446b24bca607a1f6341 (patch) | |
tree | 491cf2321050cee91fb50fff4a65f58a900374fe /llvm/test/Transforms | |
parent | 2fdabb055d4179fc4e71d8708ab0a352b842fbba (diff) | |
download | bcm5719-llvm-a60cdd38812d2f2cc32a2446b24bca607a1f6341.tar.gz bcm5719-llvm-a60cdd38812d2f2cc32a2446b24bca607a1f6341.zip |
Add function importing info from samplepgo profile to the module summary.
Summary: For SamplePGO, the profile may contain cross-module inline stacks. As we need to make sure the profile annotation happens when all the hot inline stacks are expanded, we need to pass this info to the module importer so that it can import proper functions if necessary. This patch implemented this feature by emitting cross-module targets as part of function entry metadata. In the module-summary phase, the metadata is used to build call edges that points to functions need to be imported.
Reviewers: mehdi_amini, tejohnson
Reviewed By: tejohnson
Subscribers: davidxl, llvm-commits
Differential Revision: https://reviews.llvm.org/D30053
llvm-svn: 296498
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/SampleProfile/Inputs/import.prof | 4 | ||||
-rw-r--r-- | llvm/test/Transforms/SampleProfile/import.ll | 31 |
2 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/Inputs/import.prof b/llvm/test/Transforms/SampleProfile/Inputs/import.prof new file mode 100644 index 00000000000..efadc0c5c9c --- /dev/null +++ b/llvm/test/Transforms/SampleProfile/Inputs/import.prof @@ -0,0 +1,4 @@ +main:10000:0 + 3: foo:1000 + 3: bar:200 + 4: baz:10 diff --git a/llvm/test/Transforms/SampleProfile/import.ll b/llvm/test/Transforms/SampleProfile/import.ll new file mode 100644 index 00000000000..1ee45fb4fd3 --- /dev/null +++ b/llvm/test/Transforms/SampleProfile/import.ll @@ -0,0 +1,31 @@ +; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/import.prof -S | FileCheck %s + +; Tests whether the functions in the inline stack are added to the +; function_entry_count metadata. + +declare void @foo() + +define void @main() !dbg !7 { + call void @foo(), !dbg !18 + ret void +} + +; GUIDs of foo and bar should be included in the metadata to make sure hot +; inline stacks are imported. +; CHECK: !{!"function_entry_count", i64 1, i64 6699318081062747564, i64 -2012135647395072713} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!8, !9} +!llvm.ident = !{!10} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: NoDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) +!1 = !DIFile(filename: "calls.cc", directory: ".") +!2 = !{} +!6 = !DISubroutineType(types: !2) +!7 = distinct !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !1, type: !6, variables: !2) +!8 = !{i32 2, !"Dwarf Version", i32 4} +!9 = !{i32 1, !"Debug Info Version", i32 3} +!10 = !{!"clang version 3.5 "} +!15 = !DILexicalBlockFile(discriminator: 1, file: !1, scope: !7) +!17 = distinct !DILexicalBlock(line: 10, column: 0, file: !1, scope: !7) +!18 = !DILocation(line: 10, scope: !17) |