Nathan Slingerland | 48dd080 | 2015-12-16 21:45:43 +0000 | [diff] [blame] | 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 |
Vedant Kumar | 7f5b3d6 | 2017-04-26 15:39:53 +0000 | [diff] [blame] | 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 |
| 11 | SHOW_OVERFLOW-DAG: } |
| 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 |
| 16 | SHOW_OVERFLOW-DAG: } |
| 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 |
| 21 | SHOW_OVERFLOW-DAG: } |
| 22 | SHOW_OVERFLOW-DAG: No inlined callsites in this function |
Nathan Slingerland | 48dd080 | 2015-12-16 21:45:43 +0000 | [diff] [blame] | 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 |
Vedant Kumar | 7f5b3d6 | 2017-04-26 15:39:53 +0000 | [diff] [blame] | 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 |