llvm/test/tools/llvm-profdata/hash-mismatch.proftext
Justin Bogner 4a6fa1390a InstrProf: Allow multiple functions with the same name
This updates the instrumentation based profiling format so that when
we have multiple functions with the same name (but different function
hashes) we keep all of them instead of rejecting the later ones.

There are a number of scenarios where this can come up where it's more
useful to keep multiple function profiles:

* Name collisions in unrelated libraries that are profiled together.
* Multiple "main" functions from multiple tools built against a common
  library.
* Combining profiles from different build configurations (ie, asserts
  and no-asserts)

The profile format now stores the number of counters between the hash
and the counts themselves, so that multiple sets of counts can be
stored. Since this is backwards incompatible, I've bumped the format
version and added some trivial logic to skip this when reading the old
format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214585 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 22:50:07 +00:00

38 lines
816 B
Plaintext

# If we see the same function name, but with different hashes, make
# sure we keep both.
# RUN: llvm-profdata merge %s -o %t 2>&1
# RUN: llvm-profdata show %t -all-functions -counts > %t.out
# The function ordering is non-deterministic, so we need to do our
# checks in multiple runs.
# RUN: FileCheck -check-prefix=FOO3 -check-prefix=BOTH %s -input-file %t.out
# RUN: FileCheck -check-prefix=FOO4 -check-prefix=BOTH %s -input-file %t.out
# FOO3: Hash: 0x{{0+}}3
# FOO3-NEXT: Counters: 3
# FOO3-NEXT: Function count: 1
# FOO3-NEXT: Block counts: [2, 3]
foo
3
3
1
2
3
# FOO4: Hash: 0x{{0+}}4
# FOO4-NEXT: Counters: 4
# FOO4-NEXT: Function count: 11
# FOO4-NEXT: Block counts: [22, 33, 44]
foo
4
4
11
22
33
44
# BOTH: Total functions: 2
# BOTH: Maximum function count: 11
# BOTH: Maximum internal block count: 44