summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData
Commit message (Collapse)AuthorAgeFilesLines
* GCC AutoFDO profile reader - Initial support.Diego Novillo2015-09-172-9/+271
| | | | | | | | | | | | | | | | | | This adds enough machinery to support reading simple GCC AutoFDO profiles. It now supports reading flat profiles (no function calls). Subsequent patches will add support for: - Inlined calls (in particular, the inline call stack is not traversed to accumulate samples). - Working sets and modules. These are used mostly for GCC's LIPO optimizations, so they're not needed in LLVM atm. I'm not sure that we will ever need them. For now, I've if0'd around the calls. The patch also adds support in GCOV.h for gcov version V704 (generated by GCC's profile conversion tool). llvm-svn: 247874
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-237-8/+8
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Re-apply "InstrProf: When reading, copy the data instead of taking a ↵Justin Bogner2015-06-221-47/+65
| | | | | | | | | | | | | | reference. NFC" This version fixes a missing include that MSVC noticed and clarifies the ownership of the counter buffer that's passed to InstrProfRecord. This restores r240206, which was reverted in r240208. Patch by Betul Buyukkurt. llvm-svn: 240360
* [Object] Search for architecures by name in ↵Frederic Riss2015-06-222-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "InstrProf: When reading, copy the data instead of taking a ↵Justin Bogner2015-06-201-65/+47
| | | | | | | | | | | | reference. NFC" Seems like MSVC doesn't like this: InstrProf.h(49) : error C2614: 'llvm::InstrProfRecord' : illegal member initialization: 'Hash' is not a base or member This reverts r240206. llvm-svn: 240208
* InstrProf: When reading, copy the data instead of taking a reference. NFCJustin Bogner2015-06-201-47/+65
| | | | | | | | | | | This consolidates the logic to read instrprof records into the on disk hash table's lookup trait and makes us copy the counter data instead of taking references to it as we read. This will simplify further changes to the format. Patch by Betul Buyukkurt. llvm-svn: 240206
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-197-8/+8
| | | | | | | | | | | | | 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
* modules: Add explicit dependency on intrinsics_genDuncan P. N. Exon Smith2015-06-161-0/+3
| | | | | | | | | `LLVM_ENABLE_MODULES` builds sometimes fail because `Intrinsics.td` needs to regenerate `Instrinsics.h` before anyone can include anything from the LLVM_IR module. Represent the dependency explicitly to prevent that. llvm-svn: 239796
* 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: Fix reading of consecutive 32 bit coverage mapsJustin Bogner2015-06-051-0/+5
| | | | | | | | | | | | | | | | | When we generate coverage data, we explicitly set each coverage map's alignment to 8 (See InstrProfiling::lowerCoverageData), but when we read the coverage data, we assume consecutive maps are exactly adjacent. When we're dealing with 32 bit, maps can end on a 4 byte boundary, causing us to think the padding is part of the next record. Fix this by adjusting the buffer to an appropriately aligned address between records. This is pretty awkward to test, as it requires a binary with multiple coverage maps to hit, so we'd need to check in multiple source files and a binary blob as inputs. llvm-svn: 239129
* 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: Simplify looking up sections for coverage dataJustin Bogner2015-05-071-18/+19
| | | | llvm-svn: 236685
* InstrProf: Give coverage its own errors instead of piggy backing on instrprofJustin Bogner2015-05-063-33/+64
| | | | | | | | | | | | 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: Remove a function that just returns its argument (NFC)Justin Bogner2015-05-061-20/+20
| | | | llvm-svn: 236664
* 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-232-0/+2
| | | | llvm-svn: 232998
* InstrProf: Fix CoverageMappingReader on big endianJustin Bogner2015-03-161-16/+28
| | | | | | | | This makes the reader check the endianness of the object file its given and behave appropriately. For the test I dug up a really old linker and created a ppc-apple-darwin file for llvm-cov to read. llvm-svn: 232422
* InstrProf: Do a better job of reading coverage mapping data.Justin Bogner2015-03-161-59/+41
| | | | | | | | | | | | | | | | | | | | | | This code was casting regions of a memory buffer to a couple of different structs. This is wrong in a few ways: 1. It breaks aliasing rules. 2. If the buffer isn't aligned, it hits undefined behaviour. 3. It completely ignores endianness differences. 4. The structs being defined for this aren't specifying their padding properly, so this doesn't even represent the data properly on some platforms. This commit is mostly NFC, except that it fixes reading coverage for 32 bit binaries as a side effect of getting rid of the mispadded structs. I've included a test for that. I've also baked in that we only handle little endian more explicitly, since that was true in practice already. I'll fix this to handle endianness properly in a followup commit. llvm-svn: 232346
* InstrProf: Teach llvm-cov to handle universal binaries when given -archJustin Bogner2015-03-112-8/+31
| | | | llvm-svn: 231902
* InstrProf: Allow hexadecimal function hashes in proftext formatJustin Bogner2015-03-091-1/+1
| | | | llvm-svn: 231685
* Add missing includes. make_unique proliferated everywhere.Benjamin Kramer2015-03-011-0/+1
| | | | llvm-svn: 230909
* InstrProf: Simplify the construction of BinaryCoverageReaderJustin Bogner2015-02-262-64/+61
| | | | | | | | | | | | | 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-262-6/+6
| | | | | | | The current name is long and confusing. A shorter one is both easier to understand and easier to work with. llvm-svn: 230675
* InstrProf: Remove dead code in CoverageMappingReaderJustin Bogner2015-02-251-13/+3
| | | | | | | Remove a default argument that's never passed and a constructor that's never called. llvm-svn: 230563
* 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
* Re-apply "InstrProf: Add unit tests for the profile reader and writer"Justin Bogner2015-02-182-14/+46
| | | | | | | | | | | | | | 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. llvm-svn: 229602
* 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
* Revert "InstrProf: Add unit tests for the profile reader and writer"Justin Bogner2015-02-172-45/+14
| | | | | | | | | | 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. llvm-svn: 229483
* Re-apply "InstrProf: Add unit tests for the profile reader and writer"Justin Bogner2015-02-172-14/+45
| | | | | | | | Add these tests again, but use va_list instead of initializer lists. This reverts r229456, reapplying r229455. llvm-svn: 229478
* Revert "InstrProf: Add unit tests for the profile reader and writer"Justin Bogner2015-02-162-45/+14
| | | | | | | | Looks like the bots don't like my initializer lists. This reverts r229455 llvm-svn: 229456
* InstrProf: Add unit tests for the profile reader and writerJustin Bogner2015-02-162-14/+45
| | | | | | | | | | 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. llvm-svn: 229455
* InstrProf: Use ErrorOr for IndexedInstrProfReader::create (NFC)Justin Bogner2015-02-162-5/+11
| | | | | | | 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
* Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects.Zachary Turner2015-02-111-0/+3
| | | | | | | | | | This allows IDEs to recognize the entire set of header files for each of the core LLVM projects. Differential Revision: http://reviews.llvm.org/D7526 Reviewed By: Chris Bieneman llvm-svn: 228798
* InstrProf: Use a stable sort when reading coverage regionsJustin Bogner2015-02-041-1/+1
| | | | | | | Keeping regions that start at the same location in insertion order makes this logic easier to test / more deterministic. llvm-svn: 228083
* InstrProf: Make CounterMappingRegions less confusing to constructJustin Bogner2015-02-031-4/+3
| | | | | | | Creating empty and expansion regions is awkward with the current API. Expose static methods to make this simpler. llvm-svn: 228075
* InstrProf: Remove CoverageMapping::HasCodeBefore, it isn't usedJustin Bogner2015-02-032-13/+6
| | | | | | | It's not entirely clear to me what this field was meant for, but it's always false. Remove it. llvm-svn: 228034
* InstrProf: Simplify RawCoverageMappingReader's API slightlyJustin Bogner2015-02-031-7/+9
| | | | | | | | This is still kind of a weird API, but dropping the (partial) update of the passed in CoverageMappingRecord makes it a little easier to understand and use. llvm-svn: 227900
* InstrProf: Simplify some logic by using ArrayRef::slice (NFC)Justin Bogner2015-02-031-1/+1
| | | | llvm-svn: 227898
* 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-145-7/+4
| | | | | | | | | | | 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
* Use ErrorOr for the ::create factory on instrumented and sample profilers.Diego Novillo2014-11-033-28/+39
| | | | | | | | | | | | | | | | | 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
* Add show and merge tools for sample PGO profiles.Diego Novillo2014-11-013-57/+57
| | | | | | | | | | | | | | | | | | | | | Summary: This patch extends the 'show' and 'merge' commands in llvm-profdata to handle sample PGO formats. Using the 'merge' command it is now possible to convert one sample PGO format to another. The only format that is currently not working is 'gcc'. I still need to implement support for it in lib/ProfileData. The changes in the sample profile support classes are needed for the merge operation. Reviewers: bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6065 llvm-svn: 221032
* [Object] Modify OwningBinary's interface to separate inspection from ownership.Lang Hames2014-10-311-1/+1
| | | | | | | | The getBinary and getBuffer method now return ordinary pointers of appropriate const-ness. Ownership is transferred by calling takeBinary(), which returns a pair of the Binary and a MemoryBuffer. llvm-svn: 221003
OpenPOWER on IntegriCloud