InstrProf: Allow multiple functions with the same name
authorJustin Bogner <mail@justinbogner.com>
Fri, 1 Aug 2014 22:50:07 +0000 (22:50 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 1 Aug 2014 22:50:07 +0000 (22:50 +0000)
commit4a6fa1390abc6018dc06892517184e33f7197b49
treee2d1203bea7f326861fa285e141e33d78a51cb60
parent7df1db57b3ae35afcc1df648f1446b7c7b60993b
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
include/llvm/ProfileData/InstrProfReader.h
include/llvm/ProfileData/InstrProfWriter.h
lib/ProfileData/InstrProfIndexed.h
lib/ProfileData/InstrProfReader.cpp
lib/ProfileData/InstrProfWriter.cpp
test/tools/llvm-profdata/Inputs/compat.profdata.v1 [new file with mode: 0644]
test/tools/llvm-profdata/compat.proftext [new file with mode: 0644]
test/tools/llvm-profdata/hash-mismatch.proftext