summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/InstrProfReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use ErrorOr for the ::create factory on instrumented and sample profilers.Diego Novillo2014-11-031-12/+18
| | | | | | | | | | | | | | | | | Summary: As discussed in http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141027/242445.html, the creation of reader and writer instances is better done using ErrorOr. There are no functional changes, but several callers needed to be adjusted. Reviewers: bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6076 llvm-svn: 221120
* llvm-profdata: Avoid undefined behaviour when reading raw profilesJustin Bogner2014-09-121-0/+3
| | | | | | | | | | The raw profiles that are generated in compiler-rt always add padding so that each profile is aligned, so we can simply treat files that don't have this property as malformed. Caught by Alexey's new ubsan bot. Thanks! llvm-svn: 217708
* InstrProf: Allow multiple functions with the same nameJustin Bogner2014-08-011-15/+48
| | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 214585
* llvm-profdata: Clean up and reorganize some testsJustin Bogner2014-07-291-2/+2
| | | | | | | | This moves some tests around to make it clearer what's being tested, and adds very rudimentary comment syntax to the text input format to make specifying this kind of test a little bit simpler. llvm-svn: 214235
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-1/+4
| | | | llvm-svn: 212405
* Renaming SwapByteOrder() to getSwappedBytes()Artyom Skrobov2014-06-141-1/+1
| | | | | | The next commit will add swapByteOrder(), acting in-place llvm-svn: 210973
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-131-19/+22
| | | | llvm-svn: 210871
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* ProfileData: Allow multiple profiles in RawInstrProfReaderJustin Bogner2014-05-161-4/+29
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 208938
* Fixing a cast-qual warning. getBufferStart() and getBufferEnd() both return ↵Aaron Ballman2014-05-011-2/+3
| | | | | | | | a const char *, so casting to non-const was triggering a warning (even though the assignment and usage was always const anyway). No functional changes intended. llvm-svn: 207774
* ProfileData: Treat missing function counts as malformedJustin Bogner2014-04-251-2/+6
| | | | llvm-svn: 207172
* ProfileData: Don't forward declare ComputeHash and make it static inlineJustin Bogner2014-04-181-0/+5
| | | | llvm-svn: 206663
* ProfileData: Add support for the indexed instrprof formatJustin Bogner2014-04-181-6/+112
| | | | | | | | This adds support for an indexed instrumentation based profiling format, which is just a small header and an on disk hash table. This format will be used by clang's -fprofile-instr-use= for PGO. llvm-svn: 206656
* InstrProf: Silence spurious warnings in GCC 4.8Duncan P. N. Exon Smith2014-03-241-9/+13
| | | | | | No functionality change. llvm-svn: 204580
* InstrProf: Check pointer size in raw profileDuncan P. N. Exon Smith2014-03-231-11/+40
| | | | | | | | | | | | | | | Since the profile can come from 32-bit machines, we need to check the pointer size. Change the magic number to facilitate this. Adds tests for reading 32-bit and 64-bit binaries (both big- and little-endian). The tests write a binary using printf in RUN lines (like raw-magic-but-no-header.test). Assuming the bots don't complain, this seems like a better way forward for testing RawInstrProfReader than committing binary files. <rdar://problem/16400648> llvm-svn: 204557
* InstrProf: Move constructor to the headerDuncan P. N. Exon Smith2014-03-211-3/+0
| | | | | | | | Fixes 80-column violation at the same time. <rdar://problem/15950346> llvm-svn: 204516
* InstrProf: Change magic number to have non-text charactersDuncan P. N. Exon Smith2014-03-211-8/+8
| | | | | | | | | Include non-text characters in the magic number so that text files can't match. <rdar://problem/15950346> llvm-svn: 204513
* InstrProf: Use move semantics with unique_ptrDuncan P. N. Exon Smith2014-03-211-4/+4
| | | | | | <rdar://problem/15950346> llvm-svn: 204512
* InstrProf: Detect magic numbers in a more scalable wayDuncan P. N. Exon Smith2014-03-211-34/+32
| | | | | | | | No functionality change. <rdar://problem/15950346> llvm-svn: 204511
* InstrProf: Actually detect bad headersDuncan P. N. Exon Smith2014-03-211-7/+5
| | | | | | <rdar://problem/15950346> llvm-svn: 204510
* InstrProf: Read raw binary profile in llvm-profdataDuncan P. N. Exon Smith2014-03-211-4/+106
| | | | | | | | | | | | | | Read a raw binary profile that corresponds to a memory dump from the runtime profile. The test is a binary file generated from cfe/trunk/test/Profile/c-general.c with the new compiler-rt runtime and the matching text version of the input. It includes instructions on how to regenerate. <rdar://problem/15950346> llvm-svn: 204496
* ProfileData: Introduce the InstrProfReader interface and a text readerJustin Bogner2014-03-211-0/+84
This introduces the ProfileData library and updates llvm-profdata to use this library for reading profiles. InstrProfReader is an abstract base class that will be subclassed for both the raw instrprof data from compiler-rt and the efficient instrprof format that will be used for PGO. llvm-svn: 204482
OpenPOWER on IntegriCloud