xref: /llvm-project/llvm/test/tools/llvm-profdata/sample-fs.test (revision 24201b6437b2acad035fe474ec37f733e9045174)
1Basic tests for sample profiles using fs discriminators.
2
31- Show command and keep all the discrimiantor bits
4RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs | FileCheck %s --check-prefix=SHOW1
5RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=PassLast | FileCheck %s --check-prefix=SHOW1
6SHOW1: Function: main: 6436, 0, 6 sampled lines
7SHOW1: Samples collected in the function's body {
8SHOW1:   4: 534
9SHOW1:   4.2: 534
10SHOW1:   4.738209026: 1068
11SHOW1:   5: 1075
12SHOW1:   5.1: 1075
13SHOW1:   5.738209025: 2150
14SHOW1: }
15
162- Show command and keep only the base discriminator bits
17RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base | FileCheck %s --check-prefix=SHOW2
18SHOW2: Function: main: 6436, 0, 4 sampled lines
19SHOW2: Samples collected in the function's body {
20SHOW2:   4: 534
21SHOW2:   4.2: 1602
22SHOW2:   5: 1075
23SHOW2:   5.1: 3225
24SHOW2: }
25
263- Show command and keep only the base discriminator bits and first pass of FS discriminator
27RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 | FileCheck %s --check-prefix=SHOW3
28Function: main: 6436, 0, 6 sampled lines
29SHOW3: Samples collected in the function's body {
30SHOW3:   4: 534
31SHOW3:   4.2: 534
32SHOW3:   4.11522: 1068
33SHOW3:   5: 1075
34SHOW3:   5.1: 1075
35SHOW3:   5.11521: 2150
36SHOW3: }
37
384- Merge command and keep all the discrimiantor bits
39RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=PassLast --binary -o - | llvm-profdata show --sample - -o %t1-binary_1
40RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --binary -o - | llvm-profdata show --sample - -o %t1-binary_2
41RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -o %t1-text
42RUN: diff %t1-binary_1 %t1-text
43RUN: diff %t1-binary_2 %t1-text
44
452- Merge command and keep only the base discriminator bits
46RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base --binary -o - | llvm-profdata show --sample - -o %t2-binary
47RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base -o %t2-text
48RUN: diff %t2-binary %t2-text
49
503- Merge command and keep only the base discriminator bits and first pass of FS discriminator
51RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 --binary -o - | llvm-profdata show --sample - -o %t3-binary
52RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 -o %t3-text
53RUN: diff %t3-binary %t3-text
54
554- ProfileIsFS is set properly in extbinary format from the internal option
56RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --extbinary -o %t_extbin.afdo
57RUN: llvm-profdata show --sample --show-sec-info-only %t_extbin.afdo | FileCheck %s --check-prefix=ISFSSET
58ISFSSET: Flags: {fs-discriminator}
59