diff options
| author | Wei Mi <wmi@google.com> | 2019-08-31 02:27:26 +0000 |
|---|---|---|
| committer | Wei Mi <wmi@google.com> | 2019-08-31 02:27:26 +0000 |
| commit | 798e59b81fb7a92cd5f3b1bb0761283f99adcd46 (patch) | |
| tree | 4d889c8c277676ff95bf9885a5a80ded011b3a07 /llvm/test/tools/llvm-profdata | |
| parent | 0377ca641c9af0262270d091578cab19523b1bc6 (diff) | |
| download | bcm5719-llvm-798e59b81fb7a92cd5f3b1bb0761283f99adcd46.tar.gz bcm5719-llvm-798e59b81fb7a92cd5f3b1bb0761283f99adcd46.zip | |
[SampleFDO] Add profile symbol list section to discriminate function being
cold versus function being newly added.
This is the second half of https://reviews.llvm.org/D66374.
Profile symbol list is the collection of function symbols showing up in
the binary which generates the current profile. It is used to discriminate
function being cold versus function being newly added. Profile symbol list
is only added for profile with ExtBinary format.
During profile use compilation, when profile-sample-accurate is enabled,
a function without profile will be regarded as cold only when it is
contained in that list.
Differential Revision: https://reviews.llvm.org/D66766
llvm-svn: 370563
Diffstat (limited to 'llvm/test/tools/llvm-profdata')
4 files changed, 56 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list-1.text b/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list-1.text new file mode 100644 index 00000000000..19d1ce4a1ed --- /dev/null +++ b/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list-1.text @@ -0,0 +1,5 @@ +_Z3goov +_Z3sumii +__libc_csu_fini +__libc_csu_init +_dl_relocate_static_pie diff --git a/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list-2.text b/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list-2.text new file mode 100644 index 00000000000..02fc36abf1c --- /dev/null +++ b/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list-2.text @@ -0,0 +1,4 @@ +_fini +_init +_start +main diff --git a/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list.expected b/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list.expected new file mode 100644 index 00000000000..d9af0de37d2 --- /dev/null +++ b/llvm/test/tools/llvm-profdata/Inputs/profile-symbol-list.expected @@ -0,0 +1,42 @@ +Function: main: 368038, 0, 7 sampled lines +Samples collected in the function's body { + 4: 1068 + 4.2: 1068 + 5: 2150 + 5.1: 2150 + 6: 4160 + 7: 1068 + 9: 4128, calls: _Z3bari:2942 _Z3fooi:1262 +} +Samples collected in inlined callsites { + 10: inlined callee: inline1: 2000, 0, 1 sampled lines + Samples collected in the function's body { + 1: 2000 + } + No inlined callsites in this function + 10: inlined callee: inline2: 4000, 0, 1 sampled lines + Samples collected in the function's body { + 1: 4000 + } + No inlined callsites in this function +} +Function: _Z3fooi: 15422, 1220, 1 sampled lines +Samples collected in the function's body { + 1: 1220 +} +No inlined callsites in this function +Function: _Z3bari: 40602, 2874, 1 sampled lines +Samples collected in the function's body { + 1: 2874 +} +No inlined callsites in this function +======== Dump profile symbol list ======== +_Z3goov +_Z3sumii +__libc_csu_fini +__libc_csu_init +_dl_relocate_static_pie +_fini +_init +_start +main diff --git a/llvm/test/tools/llvm-profdata/profile-symbol-list.test b/llvm/test/tools/llvm-profdata/profile-symbol-list.test new file mode 100644 index 00000000000..fc24a92302d --- /dev/null +++ b/llvm/test/tools/llvm-profdata/profile-symbol-list.test @@ -0,0 +1,5 @@ +; RUN: llvm-profdata merge -sample -extbinary -prof-sym-list=%S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile.proftext -o %t.1.output +; RUN: llvm-profdata merge -sample -extbinary -prof-sym-list=%S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output +; RUN: llvm-profdata merge -sample -extbinary %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output +; RUN: diff %S/Inputs/profile-symbol-list.expected %t.4.output |

