xref: /aosp_15_r20/external/llvm/test/tools/llvm-profdata/overflow-instr.test (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard WorkerTests for overflow when merging instrumented profiles.
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker1- Merge profile having maximum counts with itself and verify overflow detected and saturation occurred
4*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW
5*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata show -instr %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW
6*9880d681SAndroid Build Coastguard WorkerMERGE_OVERFLOW: {{.*}}: overflow: Counter overflow
7*9880d681SAndroid Build Coastguard WorkerSHOW_OVERFLOW: Total functions: 1
8*9880d681SAndroid Build Coastguard WorkerSHOW_OVERFLOW-NEXT: Maximum function count: 18446744073709551615
9*9880d681SAndroid Build Coastguard WorkerSHOW_OVERFLOW-NEXT: Maximum internal block count: 18446744073709551615
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker2- Merge profile having maximum counts by itself and verify no overflow
12*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_NO_OVERFLOW -allow-empty
13*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata show -instr %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW
14*9880d681SAndroid Build Coastguard WorkerMERGE_NO_OVERFLOW-NOT: {{.*}}: overflow: Counter overflow
15*9880d681SAndroid Build Coastguard WorkerSHOW_NO_OVERFLOW: Total functions: 1
16*9880d681SAndroid Build Coastguard WorkerSHOW_NO_OVERFLOW-NEXT: Maximum function count: 18446744073709551615
17*9880d681SAndroid Build Coastguard WorkerSHOW_NO_OVERFLOW-NEXT: Maximum internal block count: 18446744073709551615
18