1 Tests for overflow when merging sampled profiles.
3 1- Merge profile having maximum counts with itself and verify overflow detected
4 RUN: llvm-profdata merge -sample %p/Inputs/overflow-sample.proftext %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW
5 RUN: llvm-profdata show -sample %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW
6 MERGE_OVERFLOW: {{.*}}: main: Counter overflow
7 SHOW_OVERFLOW-DAG: Function: main: 2000, 0, 2 sampled lines
8 SHOW_OVERFLOW-DAG: Samples collected in the function's body {
9 SHOW_OVERFLOW-DAG: 1: 1000, calls: _Z3bari:18446744073709551615
10 SHOW_OVERFLOW-DAG: 2: 1000, calls: _Z3fooi:18446744073709551615
12 SHOW_OVERFLOW-DAG: No inlined callsites in this function
13 SHOW_OVERFLOW-DAG: Function: _Z3fooi: 18446744073709551615, 2000, 1 sampled lines
14 SHOW_OVERFLOW-DAG: Samples collected in the function's body {
15 SHOW_OVERFLOW-DAG: 1: 18446744073709551615
17 SHOW_OVERFLOW-DAG: No inlined callsites in this function
18 SHOW_OVERFLOW-DAG: Function: _Z3bari: 18446744073709551615, 2000, 1 sampled lines
19 SHOW_OVERFLOW-DAG: Samples collected in the function's body {
20 SHOW_OVERFLOW-DAG: 1: 18446744073709551615
22 SHOW_OVERFLOW-DAG: No inlined callsites in this function
24 2- Merge profile having maximum counts by itself and verify no overflow
25 RUN: llvm-profdata merge -sample %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -allow-empty -check-prefix=MERGE_NO_OVERFLOW
26 RUN: llvm-profdata show -sample %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW
27 MERGE_NO_OVERFLOW-NOT: {{.*}}: main: Counter overflow
28 SHOW_NO_OVERFLOW-DAG: Function: main: 1000, 0, 2 sampled lines
29 SHOW_NO_OVERFLOW-DAG: Samples collected in the function's body {
30 SHOW_NO_OVERFLOW-DAG: 1: 500, calls: _Z3bari:18446744073709551615
31 SHOW_NO_OVERFLOW-DAG: 2: 500, calls: _Z3fooi:18446744073709551615
32 SHOW_NO_OVERFLOW-DAG: }
33 SHOW_NO_OVERFLOW-DAG: No inlined callsites in this function
34 SHOW_NO_OVERFLOW-DAG: Function: _Z3fooi: 18446744073709551615, 1000, 1 sampled lines
35 SHOW_NO_OVERFLOW-DAG: Samples collected in the function's body {
36 SHOW_NO_OVERFLOW-DAG: 1: 18446744073709551615
37 SHOW_NO_OVERFLOW-DAG: }
38 SHOW_NO_OVERFLOW-DAG: No inlined callsites in this function
39 SHOW_NO_OVERFLOW-DAG: Function: _Z3bari: 18446744073709551615, 1000, 1 sampled lines
40 SHOW_NO_OVERFLOW-DAG: Samples collected in the function's body {
41 SHOW_NO_OVERFLOW-DAG: 1: 18446744073709551615
42 SHOW_NO_OVERFLOW-DAG: }
43 SHOW_NO_OVERFLOW-DAG: No inlined callsites in this function