Commit Graph

18 Commits

Author SHA1 Message Date
Justin Bogner
fe3176fc13 InstrProf: Add a test for multiple copies of the same with different hashes
This functionality wasn't being tested.

Patch by Betul Buyukkurt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240359 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 23:56:53 +00:00
Justin Bogner
42ab8c0a90 InstrProf: Treat functions with a coverage map but no profile as unreached
If we have a coverage mapping but no profile data for a function,
calling it mismatched is misleading. This can just as easily be
unreachable code that was stripped from the binary. Instead, treat
these the same as functions where we have an explicit "zero" coverage
map by setting the count to zero for each mapped region.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 22:03:04 +00:00
Justin Bogner
730ddb6f57 InstrProf: Strip filename prefixes from the names we display for coverage
For consumers of coverage data, any filename prefixes we store in the
profile data are just noise. Strip this prefix if it exists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236558 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-05 23:44:48 +00:00
Justin Bogner
798787cea4 InstrProf: Don't combine expansion regions with code regions
This was leading to duplicate counts when a code region happened to
overlap exactly with an expansion. The combining behaviour only makes
sense for code regions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229723 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 19:01:06 +00:00
Justin Bogner
e0eae15f6c InstrProf: Handle unknown functions if they consist only of zero-regions
This comes up when we generate coverage for a function but don't end
up emitting the function at all - dead static functions or inline
functions that aren't referenced in a particular TU, for example. In
these cases we'd like to show that the function was never called,
which is trivially true.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229717 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 18:40:46 +00:00
Justin Bogner
94da968134 InstrProf: Make CoverageMapping testable and add a basic unit test
Make CoverageMapping easier to create, so that we can write targeted
unit tests for its internals, and add a some infrastructure to write
these tests. Finally, add a simple unit test for basic functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229709 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 18:01:14 +00:00
Justin Bogner
09e5af7d61 Re-apply "InstrProf: Add unit tests for the profile reader and writer"
Have the InstrProfWriter return a MemoryBuffer instead of a
std::string. This fixes the alignment issues the reader would hit, and
it's a more appropriate type for this anyway.

I've also removed an ugly helper function that's not needed since
we're allowing initializer lists now, and updated some error code
checks based on MSVC's issues with r229473.

This reverts r229483, reapplying r229478.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 01:58:17 +00:00
Justin Bogner
ad295b5546 Re-apply "InstrProf: Use a test fixture in the coverage mapping tests"
This time we use a helper to format the assertion so we can just use
ASSERT_TRUE instead of relying on ASSERT_EQ being able to deal with
conversions between enum types.

This reverts r229496, re-applying r229473.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229547 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 21:33:43 +00:00
Aaron Ballman
93e8e46202 Reverting r229473; it does not compile with MSVC 2013, and I suspect it was meant to be reverted in r229483.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229496 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 13:18:43 +00:00
Justin Bogner
ca3fdca101 Revert "InstrProf: Add unit tests for the profile reader and writer"
This added API to the InstrProfWriter to write to a string so I could
write unittests without using temp files. This doesn't really work,
since the format has tighter alignment requirements than a char.

This reverts r229478 and its follow-up, r229481.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 09:21:43 +00:00
Justin Bogner
2c388f7653 InstrProf: Add missing header from r229478
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 08:26:06 +00:00
Justin Bogner
e7b8243e9a Re-apply "InstrProf: Add unit tests for the profile reader and writer"
Add these tests again, but use va_list instead of initializer lists.

This reverts r229456, reapplying r229455.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229478 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 07:50:59 +00:00
Justin Bogner
a6f04a4ba7 InstrProf: Use a test fixture in the coverage mapping tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229473 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 06:56:49 +00:00
Justin Bogner
a9c73c5bc0 Revert "InstrProf: Add unit tests for the profile reader and writer"
Looks like the bots don't like my initializer lists.

This reverts r229455

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229456 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-16 23:31:07 +00:00
Justin Bogner
77ae39453c InstrProf: Add unit tests for the profile reader and writer
This required some minor API to be added to these types to avoid
needing temp files.

Also, I've used initializer lists in the tests, as MSVC 2013 claims to
support them. I'll redo this without them if the bots complain.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229455 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-16 23:27:48 +00:00
Justin Bogner
0a45405fdb InstrProf: Avoid using std::to_string
Apparently std::to_string doesn't exist in mingw32:

    http://lab.llvm.org:8011/builders/clang-native-mingw32-win7/builds/7990
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228340 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-05 19:54:27 +00:00
Justin Bogner
341ed28f16 InstrProf: std::to_string needs to #include <string>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228136 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-04 11:19:16 +00:00
Justin Bogner
ff966308e1 InstrProf: Add some unit tests for CoverageMapping
The llvm-level tests for coverage mapping need a binary input file,
which means they're hard to understand, hard to update, and it's
difficult to add new ones. By adding some unit tests that build up the
coverage data structures in C++, we can write more meaningful and
targeted tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228084 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-04 00:15:12 +00:00