1 Basic tests for sample profiles using fs discriminators.
3 1- Show command and keep all the discrimiantor bits
4 RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs | FileCheck %s --check-prefix=SHOW1
5 RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=PassLast | FileCheck %s --check-prefix=SHOW1
6 SHOW1: Function: main: 6436, 0, 6 sampled lines
7 SHOW1: Samples collected in the function's body {
10 SHOW1: 4.738209026: 1068
13 SHOW1: 5.738209025: 2150
16 2- Show command and keep only the base discriminator bits
17 RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base | FileCheck %s --check-prefix=SHOW2
18 SHOW2: Function: main: 6436, 0, 4 sampled lines
19 SHOW2: Samples collected in the function's body {
26 3- Show command and keep only the base discriminator bits and first pass of FS discriminator
27 RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 | FileCheck %s --check-prefix=SHOW3
28 Function: main: 6436, 0, 6 sampled lines
29 SHOW3: Samples collected in the function's body {
38 4- Merge command and keep all the discrimiantor bits
39 RUN: 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
40 RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --binary -o - | llvm-profdata show --sample - -o %t1-binary_2
41 RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -o %t1-text
42 RUN: diff %t1-binary_1 %t1-text
43 RUN: diff %t1-binary_2 %t1-text
45 2- Merge command and keep only the base discriminator bits
46 RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base --binary -o - | llvm-profdata show --sample - -o %t2-binary
47 RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base -o %t2-text
48 RUN: diff %t2-binary %t2-text
50 3- Merge command and keep only the base discriminator bits and first pass of FS discriminator
51 RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 --binary -o - | llvm-profdata show --sample - -o %t3-binary
52 RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 -o %t3-text
53 RUN: diff %t3-binary %t3-text
55 4- ProfileIsFS is set properly in extbinary format from the internal option
56 RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --extbinary -o %t_extbin.afdo
57 RUN: llvm-profdata show --sample --show-sec-info-only %t_extbin.afdo | FileCheck %s --check-prefix=ISFSSET
58 ISFSSET: Flags: {fs-discriminator}