1*9880d681SAndroid Build Coastguard Worker# Make sure we don't try to combine counters with the same function 2*9880d681SAndroid Build Coastguard Worker# name and a matching hash if the number of counters differs 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker# RUN: llvm-profdata merge %s -o %t.profdata 2>&1 | FileCheck -check-prefix=MERGE_ERRS %s 5*9880d681SAndroid Build Coastguard Worker# RUN: llvm-profdata show %t.profdata -all-functions -counts > %t.out 6*9880d681SAndroid Build Coastguard Worker# RUN: FileCheck %s -input-file %t.out 7*9880d681SAndroid Build Coastguard Workerfoo 8*9880d681SAndroid Build Coastguard Worker1024 9*9880d681SAndroid Build Coastguard Worker4 10*9880d681SAndroid Build Coastguard Worker1 11*9880d681SAndroid Build Coastguard Worker2 12*9880d681SAndroid Build Coastguard Worker4 13*9880d681SAndroid Build Coastguard Worker8 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker# The hash matches, but we can't combine these because the number of 16*9880d681SAndroid Build Coastguard Worker# counters differs. 17*9880d681SAndroid Build Coastguard Worker# MERGE_ERRS: count-mismatch.proftext: foo: Function basic block count change detected (counter mismatch) 18*9880d681SAndroid Build Coastguard Worker# MERGE_ERRS: Make sure that all profile data to be merged is generated from the same binary. 19*9880d681SAndroid Build Coastguard Workerfoo 20*9880d681SAndroid Build Coastguard Worker1024 21*9880d681SAndroid Build Coastguard Worker3 22*9880d681SAndroid Build Coastguard Worker2 23*9880d681SAndroid Build Coastguard Worker4 24*9880d681SAndroid Build Coastguard Worker8 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Worker# This one does match, so it should combine with the first just fine. 27*9880d681SAndroid Build Coastguard Worker# CHECK: Hash: 0x{{0+}}400 28*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: Counters: 4 29*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: Function count: 5 30*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: Block counts: [10, 20, 40] 31*9880d681SAndroid Build Coastguard Workerfoo 32*9880d681SAndroid Build Coastguard Worker1024 33*9880d681SAndroid Build Coastguard Worker4 34*9880d681SAndroid Build Coastguard Worker4 35*9880d681SAndroid Build Coastguard Worker8 36*9880d681SAndroid Build Coastguard Worker16 37*9880d681SAndroid Build Coastguard Worker32 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Worker# CHECK: Total functions: 1 40*9880d681SAndroid Build Coastguard Worker# CHECK: Maximum function count: 5 41*9880d681SAndroid Build Coastguard Worker# CHECK: Maximum internal block count: 40 42