148dd080cSNathan SlingerlandTests for overflow when merging sampled profiles. 248dd080cSNathan Slingerland 348dd080cSNathan Slingerland1- Merge profile having maximum counts with itself and verify overflow detected 448dd080cSNathan SlingerlandRUN: 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 548dd080cSNathan SlingerlandRUN: llvm-profdata show -sample %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW 648dd080cSNathan SlingerlandMERGE_OVERFLOW: {{.*}}: main: Counter overflow 7*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: Function: main: 2000, 0, 2 sampled lines 8*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: Samples collected in the function's body { 9*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: 1: 1000, calls: _Z3bari:18446744073709551615 10*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: 2: 1000, calls: _Z3fooi:18446744073709551615 11*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: } 12*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: No inlined callsites in this function 13*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: Function: _Z3fooi: 18446744073709551615, 2000, 1 sampled lines 14*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: Samples collected in the function's body { 15*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: 1: 18446744073709551615 16*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: } 17*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: No inlined callsites in this function 18*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: Function: _Z3bari: 18446744073709551615, 2000, 1 sampled lines 19*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: Samples collected in the function's body { 20*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: 1: 18446744073709551615 21*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: } 22*7f5b3d6fSVedant KumarSHOW_OVERFLOW-DAG: No inlined callsites in this function 2348dd080cSNathan Slingerland 2448dd080cSNathan Slingerland2- Merge profile having maximum counts by itself and verify no overflow 2548dd080cSNathan SlingerlandRUN: llvm-profdata merge -sample %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -allow-empty -check-prefix=MERGE_NO_OVERFLOW 2648dd080cSNathan SlingerlandRUN: llvm-profdata show -sample %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW 2748dd080cSNathan SlingerlandMERGE_NO_OVERFLOW-NOT: {{.*}}: main: Counter overflow 28*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: Function: main: 1000, 0, 2 sampled lines 29*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: Samples collected in the function's body { 30*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: 1: 500, calls: _Z3bari:18446744073709551615 31*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: 2: 500, calls: _Z3fooi:18446744073709551615 32*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: } 33*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: No inlined callsites in this function 34*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: Function: _Z3fooi: 18446744073709551615, 1000, 1 sampled lines 35*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: Samples collected in the function's body { 36*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: 1: 18446744073709551615 37*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: } 38*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: No inlined callsites in this function 39*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: Function: _Z3bari: 18446744073709551615, 1000, 1 sampled lines 40*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: Samples collected in the function's body { 41*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: 1: 18446744073709551615 42*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: } 43*7f5b3d6fSVedant KumarSHOW_NO_OVERFLOW-DAG: No inlined callsites in this function 44