summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/CoverageMapping.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move coverage related code into a separate library.Easwaran Raman2016-04-291-548/+0
| | | | | | Differential Revision: http://reviews.llvm.org/D19333 llvm-svn: 268089
* [Coverage] Restore the correct count value after processing a nested region ↵Igor Kudrin2016-04-251-37/+58
| | | | | | | | | | | | | 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
* Reapply "[Coverage] Prevent detection of false instantiations in case of ↵Igor Kudrin2016-04-181-18/+12
| | | | | | | | | | | | | | | | | | 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
* Revert "[Coverage] Prevent detection of false instantiations in case of ↵Igor Kudrin2016-04-151-12/+18
| | | | | | | | macro expansion." This reverts commit r266436 as it broke buildbot. llvm-svn: 266458
* [Coverage] Prevent detection of false instantiations in case of macro expansion.Igor Kudrin2016-04-151-18/+12
| | | | | | | | | | | | | 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
* [Coverage] Avoid unnecessary copying of std::vectorIgor Kudrin2016-04-141-7/+16
| | | | | | | | Approved by: Justin Bogner <mail@justinbogner.com> Differential Revision: http://reviews.llvm.org/D18756 llvm-svn: 266284
* [Coverage] Strip <unknown> from PGO names if no filenames are availableVedant Kumar2016-03-281-1/+3
| | | | | | Patch suggested by David Li! llvm-svn: 264586
* Move coveragemap_error enum into coverage namespace and InstrProf.h /NFCXinliang David Li2016-01-101-1/+1
| | | | llvm-svn: 257295
* Coverage code refactoring /NFCXinliang David Li2015-12-151-13/+5
| | | | llvm-svn: 255670
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-2/+2
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* [Object] Search for architecures by name in ↵Frederic Riss2015-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | MachOUniversalBinary::getObjectForArch() The reason we need to search by name rather than by Triple::ArchType is to handle subarchitecture correclty. There is no different ArchType for the x86_64h architecture (it identifies itself as x86_64), or for the various ARM subarches. The only way to get to the subarch slice in an universal binary is to search by name. This issue led to hard to debug and transient symbolication failures in Asan tests (it mostly works, because the files are very similar). This also affects the Profiling infrastucture as it is the other user of that API. Reviewers: samsonov, bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10604 llvm-svn: 240339
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-2/+2
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Don't use std::errc.Rafael Espindola2015-06-131-2/+3
| | | | | | | | | | | | | | | | | | | | | As noted on Errc.h: // * std::errc is just marked with is_error_condition_enum. This means that // common patters like AnErrorCode == errc::no_such_file_or_directory take // 4 virtual calls instead of two comparisons. And on some libstdc++ those virtual functions conclude that ------------------------ int main() { std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory); return foo == std::errc::no_such_file_or_directory; } ------------------------- should exit with 0. llvm-svn: 239683
* InstrProf: Treat functions with a coverage map but no profile as unreachedJustin Bogner2015-05-131-2/+3
| | | | | | | | | | 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
* InstrProf: Give coverage its own errors instead of piggy backing on instrprofJustin Bogner2015-05-061-0/+31
| | | | | | | | | | | | Since the coverage mapping reader and the instrprof reader were emitting a shared set of error codes, the error messages you'd get back from llvm-cov were ambiguous about what was actually wrong. Add another error category to fix this. I've also improved the wording on a couple of the instrprof errors, for consistency. llvm-svn: 236665
* InstrProf: Strip filename prefixes from the names we display for coverageJustin Bogner2015-05-051-1/+15
| | | | | | | 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
* Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.Benjamin Kramer2015-03-231-0/+1
| | | | llvm-svn: 232998
* InstrProf: Teach llvm-cov to handle universal binaries when given -archJustin Bogner2015-03-111-2/+3
| | | | llvm-svn: 231902
* InstrProf: Simplify the construction of BinaryCoverageReaderJustin Bogner2015-02-261-4/+6
| | | | | | | | | | | | | Creating BinaryCoverageReader is a strange and complicated dance where the constructor sets error codes that member functions will later read, and the object is in an invalid state if readHeader isn't immediately called after construction. Instead, make the constructor private and add a static create method to do the construction properly. This also has the benefit of removing readHeader completely and simplifying the interface of the object. llvm-svn: 230676
* InstrProf: Rename ObjectFileCoverageMappingReader to BinaryCoverageReaderJustin Bogner2015-02-261-1/+1
| | | | | | | The current name is long and confusing. A shorter one is both easier to understand and easier to work with. llvm-svn: 230675
* Disallow implicit conversions from None to integer typesJustin Bogner2015-02-201-2/+6
| | | | | | | | | | | | This fixes an error introduced in r228934 where None was converted to an int instead of the int being converted to an Optional as intended. We make that sort of mistake a compile error by changing NoneType into a scoped enum. Finally, provide a static NoneType called None to avoid forcing all users to spell it NoneType::None. llvm-svn: 229980
* InstrProf: Don't combine expansion regions with code regionsJustin Bogner2015-02-181-1/+1
| | | | | | | | 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
* InstrProf: Handle unknown functions if they consist only of zero-regionsJustin Bogner2015-02-181-10/+11
| | | | | | | | | | 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
* InstrProf: Make CoverageMapping testable and add a basic unit testJustin Bogner2015-02-181-1/+1
| | | | | | | | 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
* Prefer SmallVector::append/insert over push_back loops.Benjamin Kramer2015-02-171-4/+4
| | | | | | Same functionality, but hoists the vector growth out of the loop. llvm-svn: 229500
* InstrProf: Use ErrorOr for IndexedInstrProfReader::create (NFC)Justin Bogner2015-02-161-2/+3
| | | | | | | The other InstrProfReader::create factories were updated to return ErrorOr in r221120, and it's odd for these APIs not to match. llvm-svn: 229433
* Fix accidental bit flip.Benjamin Kramer2015-02-121-2/+2
| | | | llvm-svn: 228936
* CoverageMapping: Bitvectorize code. No functionality change.Benjamin Kramer2015-02-121-27/+20
| | | | llvm-svn: 228934
* llvm-cov: Only combine segments if they overlap exactlyJustin Bogner2015-01-241-2/+8
| | | | | | | | | | | | | If two coverage segments cover the same area we need to combine them, as per r218432. OTOH, just because they start at the same place doesn't mean they cover the same area. This fixes the check to be more exact about this. This is pretty hard to test right now. The frontend doesn't currently emit regions that start at the same place but don't overlap, but some upcoming work changes this. llvm-svn: 227017
* Replace size method call of containers to empty method where appropriateAlexander Kornienko2015-01-151-1/+1
| | | | | | | | | | | | | | | | This patch was generated by a clang tidy checker that is being open sourced. The documentation of that checker is the following: /// The emptiness of a container should be checked using the empty method /// instead of the size method. It is not guaranteed that size is a /// constant-time function, and it is generally more efficient and also shows /// clearer intent to use empty. Furthermore some containers may implement the /// empty method but not implement the size method. Using empty whenever /// possible makes it easier to switch to another container in the future. Patch by Gábor Horváth! llvm-svn: 226161
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-1/+0
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* llvm-cov: Sink some reporting logic into CoverageMappingJustin Bogner2014-11-141-1/+9
| | | | | | | | This teaches CoverageMapping::getCoveredFunctions to filter to a particular file and uses that to replace most of the logic found in llvm-cov report. llvm-svn: 221962
* Eliminate some deep std::vector copies. NFC.Benjamin Kramer2014-10-031-1/+1
| | | | llvm-svn: 218999
* InstrProf: Avoid linear search in a hot loopJustin Bogner2014-10-021-5/+6
| | | | | | | | | | Every time we were adding or removing an expression when generating a coverage mapping we were doing a linear search to try and deduplicate the list. The indices in the list are important, so we can't just replace it by a DenseMap entirely, but an auxilliary DenseMap for fast lookup massively improves the performance issues I was seeing here. llvm-svn: 218892
* Reapply "InstrProf: Don't keep a large sparse list around just to zero it"Justin Bogner2014-10-021-24/+43
| | | | | | | | | | When I was preparing r218879 for commit, I removed an early return that I decided was just noise. It wasn't. This is r218879 no-crash edition. This reverts commit r218881, reapplying r218879. llvm-svn: 218887
* Revert "InstrProf: Don't keep a large sparse list around just to zero it"Justin Bogner2014-10-021-38/+24
| | | | | | | | This seems to be crashing on some buildbots. Reverting to investigate. This reverts commit r218879. llvm-svn: 218881
* InstrProf: Don't keep a large sparse list around just to zero itJustin Bogner2014-10-021-24/+38
| | | | | | | | | | | | | | | | | | | | The Terms vector here represented a polynomial of of all possible counters, and is used to simplify expressions when generating coverage mapping. There are a few problems with this: 1. Keeping the vector as a member is wasteful, since we clear it every time we use it. 2. Most expressions refer to a subset of the counters, so we end up iterating over a large number of zeros doing nothing a lot of the time. This updates the user of the vector to store the terms locally, and uses a sort and combine approach so that we only operate on counters that are actually used in a given expression. For small cases this makes very little difference, but in cases with a very large number of counted regions this is a significant performance fix. llvm-svn: 218879
* llvm-cov: Use the number of executed functions for the function coverage metric.Alex Lorenz2014-09-301-1/+3
| | | | | | | | This commit fixes llvm-cov's function coverage metric by using the number of executed functions instead of the number of fully covered functions. Differential Revision: http://reviews.llvm.org/D5196 llvm-svn: 218672
* llvm-cov: Combine segments that cover the same locationJustin Bogner2014-09-251-4/+18
| | | | | | | | If we have multiple coverage counts for the same segment, we need to add them up rather than arbitrarily choosing one. This fixes that and adds a test with template instantiations to exercise it. llvm-svn: 218432
* llvm-cov: Allow creating CoverageMappings from filenamesJustin Bogner2014-09-201-0/+14
| | | | llvm-svn: 218185
* llvm-cov: Disentangle the coverage data logic from the display (NFC)Justin Bogner2014-09-201-0/+275
| | | | | | | | | | This splits the logic for actually looking up coverage information from the logic that displays it. These were tangled rather thoroughly so this change is a bit large, but it mostly consists of moving things around. The coverage lookup logic itself now lives in the library, rather than being spread between the library and the tool. llvm-svn: 218184
* llvm-cov: Try to appease MSVC after r217404Justin Bogner2014-09-081-2/+2
| | | | llvm-svn: 217406
* llvm-cov: Use ErrorOr rather than an error_code* (NFC)Justin Bogner2014-09-081-24/+17
| | | | llvm-svn: 217404
* Coverage: fix the missing output stream in recursive call to ↵Alex Lorenz2014-07-291-2/+2
| | | | | | CoverageMappingContext::dump llvm-svn: 214206
* Add code coverage mapping data, reader, and writer.Alex Lorenz2014-07-241-0/+149
This patch implements the data structures, the reader and the writers for the new code coverage mapping system. The new code coverage mapping system uses the instrumentation based profiling to provide code coverage analysis. llvm-svn: 213910
OpenPOWER on IntegriCloud