Fix a bug in test case -- duplicate entries
[oota-llvm.git] / test / tools / llvm-profdata / overflow-sample.test
1 Tests for overflow when merging sampled profiles.
2
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: Function: main: 2000, 0, 2 sampled lines
8 SHOW_OVERFLOW-NEXT: Samples collected in the function's body {
9 SHOW_OVERFLOW-NEXT:   1: 1000, calls: _Z3bari:18446744073709551615
10 SHOW_OVERFLOW-NEXT:   2: 1000, calls: _Z3fooi:18446744073709551615
11 SHOW_OVERFLOW-NEXT: }
12 SHOW_OVERFLOW-NEXT: No inlined callsites in this function
13 SHOW_OVERFLOW-NEXT: Function: _Z3fooi: 18446744073709551615, 2000, 1 sampled lines
14 SHOW_OVERFLOW-NEXT: Samples collected in the function's body {
15 SHOW_OVERFLOW-NEXT:   1: 18446744073709551615
16 SHOW_OVERFLOW-NEXT: }
17 SHOW_OVERFLOW-NEXT: No inlined callsites in this function
18 SHOW_OVERFLOW-NEXT: Function: _Z3bari: 18446744073709551615, 2000, 1 sampled lines
19 SHOW_OVERFLOW-NEXT: Samples collected in the function's body {
20 SHOW_OVERFLOW-NEXT:   1: 18446744073709551615
21 SHOW_OVERFLOW-NEXT: }
22 SHOW_OVERFLOW-NEXT: No inlined callsites in this function
23
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: Function: main: 1000, 0, 2 sampled lines
29 SHOW_NO_OVERFLOW-NEXT: Samples collected in the function's body {
30 SHOW_NO_OVERFLOW-NEXT:   1: 500, calls: _Z3bari:18446744073709551615
31 SHOW_NO_OVERFLOW-NEXT:   2: 500, calls: _Z3fooi:18446744073709551615
32 SHOW_NO_OVERFLOW-NEXT: }
33 SHOW_NO_OVERFLOW-NEXT: No inlined callsites in this function
34 SHOW_NO_OVERFLOW-NEXT: Function: _Z3fooi: 18446744073709551615, 1000, 1 sampled lines
35 SHOW_NO_OVERFLOW-NEXT: Samples collected in the function's body {
36 SHOW_NO_OVERFLOW-NEXT:   1: 18446744073709551615
37 SHOW_NO_OVERFLOW-NEXT: }
38 SHOW_NO_OVERFLOW-NEXT: No inlined callsites in this function
39 SHOW_NO_OVERFLOW-NEXT: Function: _Z3bari: 18446744073709551615, 1000, 1 sampled lines
40 SHOW_NO_OVERFLOW-NEXT: Samples collected in the function's body {
41 SHOW_NO_OVERFLOW-NEXT:   1: 18446744073709551615
42 SHOW_NO_OVERFLOW-NEXT: }
43 SHOW_NO_OVERFLOW-NEXT: No inlined callsites in this function