14ce7f446SJustin Bogner# Make sure we don't try to combine counters with the same function
24ce7f446SJustin Bogner# name and a matching hash if the number of counters differs
34ce7f446SJustin Bogner
44ce7f446SJustin Bogner# RUN: llvm-profdata merge %s -o %t.profdata 2>&1 | FileCheck -check-prefix=MERGE_ERRS %s
54ce7f446SJustin Bogner# RUN: llvm-profdata show %t.profdata -all-functions -counts > %t.out
64ce7f446SJustin Bogner# RUN: FileCheck %s -input-file %t.out
74ce7f446SJustin Bognerfoo
84ce7f446SJustin Bogner1024
94ce7f446SJustin Bogner4
104ce7f446SJustin Bogner1
114ce7f446SJustin Bogner2
124ce7f446SJustin Bogner4
134ce7f446SJustin Bogner8
144ce7f446SJustin Bogner
154ce7f446SJustin Bogner# The hash matches, but we can't combine these because the number of
164ce7f446SJustin Bogner# counters differs.
17*8ea2a58aSFangrui Song# MERGE_ERRS: count-mismatch.proftext: foo: function basic block count change detected (counter mismatch)
18e6e30d5eSNathan Slingerland# MERGE_ERRS: Make sure that all profile data to be merged is generated from the same binary.
194ce7f446SJustin Bognerfoo
204ce7f446SJustin Bogner1024
214ce7f446SJustin Bogner3
224ce7f446SJustin Bogner2
234ce7f446SJustin Bogner4
244ce7f446SJustin Bogner8
254ce7f446SJustin Bogner
264ce7f446SJustin Bogner# This one does match, so it should combine with the first just fine.
274ce7f446SJustin Bogner# CHECK: Hash: 0x{{0+}}400
284ce7f446SJustin Bogner# CHECK-NEXT: Counters: 4
294ce7f446SJustin Bogner# CHECK-NEXT: Function count: 5
304ce7f446SJustin Bogner# CHECK-NEXT: Block counts: [10, 20, 40]
314ce7f446SJustin Bognerfoo
324ce7f446SJustin Bogner1024
334ce7f446SJustin Bogner4
344ce7f446SJustin Bogner4
354ce7f446SJustin Bogner8
364ce7f446SJustin Bogner16
374ce7f446SJustin Bogner32
384ce7f446SJustin Bogner
394ce7f446SJustin Bogner# CHECK: Total functions: 1
404ce7f446SJustin Bogner# CHECK: Maximum function count: 5
414ce7f446SJustin Bogner# CHECK: Maximum internal block count: 40
42