aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ProfileData/CoverageMappingTest.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-04-29Move coverage related code into a separate library.Easwaran Raman1-3/+3
Differential Revision: http://reviews.llvm.org/D19333 llvm-svn: 268089
2016-04-25[Coverage] Restore the correct count value after processing a nested region ↵Igor Kudrin1-0/+20
in case of combined regions. If several regions cover the same area of code, we have to restore the combined value for that area when return from a nested region. This patch achieves that by combining regions before calling buildSegments. Differential Revision: http://reviews.llvm.org/D18610 llvm-svn: 267390
2016-04-18Reapply "[Coverage] Prevent detection of false instantiations in case of ↵Igor Kudrin1-0/+38
macro expansion." The root of the problem was that findMainViewFileID(File, Function) could return some ID for any given file, even though that file was not the main file for that function. This patch ensures that the result of this function is conformed with the result of findMainViewFileID(Function). This commit reapplies r266436, which was reverted by r266458, with the .covmapping file serialized in v1 format. Differential Revision: http://reviews.llvm.org/D18787 llvm-svn: 266620
2016-04-18[NFC] Header cleanupMehdi Amini1-1/+1
Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266595
2016-04-15Revert "[Coverage] Prevent detection of false instantiations in case of ↵Igor Kudrin1-38/+0
macro expansion." This reverts commit r266436 as it broke buildbot. llvm-svn: 266458
2016-04-15[Coverage] Prevent detection of false instantiations in case of macro expansion.Igor Kudrin1-0/+38
The root of the problem was that findMainViewFileID(File, Function) could return some ID for any given file, even though that file was not the main file for that function. This patch ensures that the result of this function is conformed with the result of findMainViewFileID(Function). Differential Revision: http://reviews.llvm.org/D18787 llvm-svn: 266436
2016-04-15[Coverage] Add support for making test data for more than one function.Igor Kudrin1-83/+169
Differential Revision: http://reviews.llvm.org/D18758 llvm-svn: 266434
2016-04-14[Coverage] Update testing methods to support more than two filesIgor Kudrin1-11/+58
Differential Revision: http://reviews.llvm.org/D18757 llvm-svn: 266289
2016-03-28[Coverage] Strip <unknown> from PGO names if no filenames are availableVedant Kumar1-4/+6
Patch suggested by David Li! llvm-svn: 264586
2016-03-28[Coverage] Fix the way we load "<unknown>:func" recordsVedant Kumar1-0/+15
When emitting coverage mappings for functions with local linkage and an unknown filename, we use "<unknown>:func" for the PGO function name. The problem is that we don't strip "<unknown>" from the name when loading coverage data, like we do for other file names. Fix that and add a test. llvm-svn: 264559
2016-01-29[Profiling] Add a -sparse mode to llvm-profdata mergeVedant Kumar1-11/+26
Add an option to llvm-profdata merge for writing out sparse indexed profiles. These profiles omit InstrProfRecords for functions which are never executed. Differential Revision: http://reviews.llvm.org/D16727 llvm-svn: 259258
2015-09-29InstrProf: Support for value profiling in the indexed profile formatJustin Bogner1-4/+8
Add support to the indexed instrprof reader and writer for the format that will be used for value profiling. Patch by Betul Buyukkurt, with minor modifications. llvm-svn: 248833
2015-05-13InstrProf: Treat functions with a coverage map but no profile as unreachedJustin Bogner1-0/+15
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. llvm-svn: 237298
2015-05-05InstrProf: Strip filename prefixes from the names we display for coverageJustin Bogner1-0/+14
For consumers of coverage data, any filename prefixes we store in the profile data are just noise. Strip this prefix if it exists. llvm-svn: 236558
2015-02-18InstrProf: Don't combine expansion regions with code regionsJustin Bogner1-0/+37
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. llvm-svn: 229723
2015-02-18InstrProf: Handle unknown functions if they consist only of zero-regionsJustin Bogner1-0/+13
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. llvm-svn: 229717
2015-02-18InstrProf: Make CoverageMapping testable and add a basic unit testJustin Bogner1-0/+82
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. llvm-svn: 229709
2015-02-17Re-apply "InstrProf: Use a test fixture in the coverage mapping tests"Justin Bogner1-67/+81
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. llvm-svn: 229547
2015-02-17Reverting r229473; it does not compile with MSVC 2013, and I suspect it was ↵Aaron Ballman1-77/+69
meant to be reverted in r229483. llvm-svn: 229496
2015-02-17InstrProf: Use a test fixture in the coverage mapping testsJustin Bogner1-69/+77
llvm-svn: 229473
2015-02-05InstrProf: Avoid using std::to_stringJustin Bogner1-2/+4
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 llvm-svn: 228340
2015-02-04InstrProf: std::to_string needs to #include <string>Justin Bogner1-0/+2
llvm-svn: 228136
2015-02-04InstrProf: Add some unit tests for CoverageMappingJustin Bogner1-0/+112
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. llvm-svn: 228084