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