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