ProfileData: Allow multiple profiles in RawInstrProfReader
authorJustin Bogner <mail@justinbogner.com>
Fri, 16 May 2014 00:38:00 +0000 (00:38 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 16 May 2014 00:38:00 +0000 (00:38 +0000)
commit6d81fc75c495e8ed20f1508042bcd2edba1a8058
tree2e9bf4b426f9639b8a27cca4fffad706bdddced1
parent9364e63d79c5efb8b9a10df7f3f3f09a9c9cd2a4
ProfileData: Allow multiple profiles in RawInstrProfReader

Allow multiple raw profiles to coexist in a single .profraw file,
given the following conditions:

- Zero padding at the end of or between profiles will be skipped.
- Each profile must start with a valid header.
- Mixing endianness or pointer sizes in concatenated profiles files is
  not allowed.

This is needed to handle cases where a program's shared libraries are
profiled as well as the main executable itself, as we'll need to emit
each executable's counters. Combining the tables in the runtime would
be expensive for the instrumented program.

rdar://16918688

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208938 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ProfileData/InstrProfReader.h
lib/ProfileData/InstrProfReader.cpp
test/tools/llvm-profdata/raw-two-profiles.test [new file with mode: 0644]