• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Some basic tests for supplementing instrumentation profile with sample profile.
2
3Test all of goo's counters will be set to -1.
4RUN: llvm-profdata merge \
5RUN:     -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \
6RUN:     -suppl-min-size-threshold=0 %p/Inputs/mix_instr.proftext -o %t
7RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX1
8
9MIX1: foo:
10MIX1-NEXT: Hash: 0x0000000000000007
11MIX1-NEXT: Counters: 5
12MIX1-NEXT: Block counts: [12, 13, 0, 0, 0]
13MIX1: goo:
14MIX1-NEXT: Hash: 0x0000000000000005
15MIX1-NEXT: Counters: 3
16MIX1-NEXT: Block counts: [18446744073709551615, 18446744073709551615, 18446744073709551615]
17MIX1: moo:
18MIX1-NEXT: Hash: 0x0000000000000009
19MIX1-NEXT: Counters: 4
20MIX1-NEXT: Block counts: [3000, 1000, 2000, 500]
21
22Test when the zero counter ratio of foo is higher than zero-counter-threshold.
23RUN: llvm-profdata merge \
24RUN:     -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \
25RUN:     -suppl-min-size-threshold=0 -zero-counter-threshold=0.5 \
26RUN:     -instr-prof-cold-threshold=30 %p/Inputs/mix_instr.proftext -o %t
27RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX2
28
29MIX2: foo:
30MIX2-NEXT: Hash: 0x0000000000000007
31MIX2-NEXT: Counters: 5
32MIX2-NEXT: Block counts: [18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615]
33MIX2: goo:
34MIX2-NEXT: Hash: 0x0000000000000005
35MIX2-NEXT: Counters: 3
36MIX2-NEXT: Block counts: [18446744073709551615, 18446744073709551615, 18446744073709551615]
37MIX2: moo:
38MIX2-NEXT: Hash: 0x0000000000000009
39MIX2-NEXT: Counters: 4
40MIX2-NEXT: Block counts: [3000, 1000, 2000, 500]
41
42Test when the zero counter ratio of foo is lower than zero-counter-threshold.
43RUN: llvm-profdata merge \
44RUN:     -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \
45RUN:     -suppl-min-size-threshold=0 -zero-counter-threshold=0.7 \
46RUN:     -instr-prof-cold-threshold=30 %p/Inputs/mix_instr.proftext -o %t
47RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX3
48
49MIX3: foo:
50MIX3-NEXT: Hash: 0x0000000000000007
51MIX3-NEXT: Counters: 5
52MIX3-NEXT: Block counts: [1384, 1500, 0, 0, 0]
53MIX3: goo:
54MIX3-NEXT: Hash: 0x0000000000000005
55MIX3-NEXT: Counters: 3
56MIX3-NEXT: Block counts: [18446744073709551615, 18446744073709551615, 18446744073709551615]
57MIX3: moo:
58MIX3-NEXT: Hash: 0x0000000000000009
59MIX3-NEXT: Counters: 4
60MIX3-NEXT: Block counts: [3000, 1000, 2000, 500]
61
62Test foo's profile won't be adjusted because its size is smaller
63than suppl-min-size-threshold.
64RUN: llvm-profdata merge \
65RUN:     -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \
66RUN:     -suppl-min-size-threshold=2 -zero-counter-threshold=0.7 \
67RUN:     -instr-prof-cold-threshold=30 %p/Inputs/mix_instr.proftext -o %t
68RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX4
69
70MIX4: foo:
71MIX4-NEXT: Hash: 0x0000000000000007
72MIX4-NEXT: Counters: 5
73MIX4-NEXT: Block counts: [12, 13, 0, 0, 0]
74MIX4: goo:
75MIX4-NEXT: Hash: 0x0000000000000005
76MIX4-NEXT: Counters: 3
77MIX4-NEXT: Block counts: [18446744073709551615, 18446744073709551615, 18446744073709551615]
78MIX4: moo:
79MIX4-NEXT: Hash: 0x0000000000000009
80MIX4-NEXT: Counters: 4
81MIX4-NEXT: Block counts: [3000, 1000, 2000, 500]
82
83Test profile summary won't be affected by -1 counter.
84RUN: llvm-profdata merge \
85RUN:     -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \
86RUN:     -suppl-min-size-threshold=0 %p/Inputs/mix_instr.proftext -o %t
87RUN: llvm-profdata show %t -detailed-summary | FileCheck %s --check-prefix=MIX5
88
89MIX5: Instrumentation level: IR
90MIX5-NEXT: Total functions: 3
91MIX5-NEXT: Maximum function count: 3000
92MIX5-NEXT: Maximum internal block count: 2000
93MIX5-NEXT: Total number of blocks: 9
94MIX5-NEXT: Total count: 6525
95MIX5-NEXT: Detailed summary:
96MIX5-NEXT: 3 blocks with count >= 1000 account for 80 percentage of the total counts.
97MIX5-NEXT: 3 blocks with count >= 1000 account for 90 percentage of the total counts.
98MIX5-NEXT: 4 blocks with count >= 500 account for 95 percentage of the total counts.
99MIX5-NEXT: 4 blocks with count >= 500 account for 99 percentage of the total counts.
100MIX5-NEXT: 6 blocks with count >= 12 account for 99.9 percentage of the total counts.
101MIX5-NEXT: 6 blocks with count >= 12 account for 99.99 percentage of the total counts.
102MIX5-NEXT: 6 blocks with count >= 12 account for 99.999 percentage of the total counts.
103