Commit Graph

118 Commits

Author SHA1 Message Date
Justin Bogner
38ac7e92d8 ProfileData: Treat missing function counts as malformed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207172 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25 02:45:33 +00:00
Justin Bogner
08a4d0b36f ProfileData: Avoid unnecessary copies of CounterData
We're currently copying CounterData from InstrProfWriter into the
OnDiskHashTable, even though we don't need to, and then carelessly
leaking those copies. A const pointer is much better here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207009 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 18:50:16 +00:00
Justin Bogner
be76c2adce ProfileData: Remove an extra semicolon
Spotted by Nick Lewycky in review, thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206708 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-19 23:42:50 +00:00
Justin Bogner
55c1e1bd26 OnDiskHashTable: Audit types and use offset_type consistently
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206675 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-19 00:33:15 +00:00
Justin Bogner
1c60993799 ProfileData: Don't forward declare ComputeHash and make it static inline
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206663 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-18 22:00:22 +00:00
Justin Bogner
e153fb33e4 ProfileData: Add support for the indexed instrprof format
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206656 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-18 21:48:40 +00:00
Duncan P. N. Exon Smith
b83e788db5 InstrProf: Silence spurious warnings in GCC 4.8
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204580 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 00:47:18 +00:00
Duncan P. N. Exon Smith
0695b20d9a InstrProf: Check pointer size in raw profile
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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204557 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-23 03:38:12 +00:00
NAKAMURA Takumi
c8ca83201c [CMake] LLVMProfileData: No need to add LINK_LIBS here. LLVMBuild should do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204553 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-23 01:23:36 +00:00
Duncan P. N. Exon Smith
50f9696f1d InstrProf: Move constructor to the header
Fixes 80-column violation at the same time.

<rdar://problem/15950346>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204516 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 20:59:19 +00:00
Duncan P. N. Exon Smith
813d0a2761 InstrProf: Change magic number to have non-text characters
Include non-text characters in the magic number so that text files can't
match.

<rdar://problem/15950346>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204513 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 20:42:37 +00:00
Duncan P. N. Exon Smith
bc2740a598 InstrProf: Use move semantics with unique_ptr
<rdar://problem/15950346>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204512 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 20:42:34 +00:00
Duncan P. N. Exon Smith
bb56c4808e InstrProf: Detect magic numbers in a more scalable way
No functionality change.

<rdar://problem/15950346>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204511 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 20:42:31 +00:00
Duncan P. N. Exon Smith
ebaeaa934e InstrProf: Actually detect bad headers
<rdar://problem/15950346>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204510 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 20:42:28 +00:00
Duncan P. N. Exon Smith
ddfcb21b3f InstrProf: Read raw binary profile in llvm-profdata
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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204496 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 18:26:05 +00:00
Justin Bogner
c61e1f53d9 ProfileData: Avoid brace initialization, windows doesn't like it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204494 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 18:22:16 +00:00
Justin Bogner
496d7f66a0 ProfileData: Introduce InstrProfWriter using the naive text format
This isn't a format we'll want to write out in practice, but moving it
to the writer library simplifies llvm-profdata and isolates it from
further changes to the format.

This also allows us to update the tests to not rely on the text output
format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204489 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 17:46:22 +00:00
Justin Bogner
c0f3b72555 ProfileData: Introduce the InstrProfReader interface and a text reader
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204482 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 17:24:48 +00:00