summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Add profile writing capabilities for sampling profiles.Diego Novillo2014-10-304-38/+373
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch finishes up support for handling sampling profiles in both text and binary formats. The new binary format uses uleb128 encoding to represent numeric values. This makes profiles files about 25% smaller. The profile writer class can write profiles in the existing text and the new binary format. In subsequent patches, I will add the capability to read (and perhaps write) profiles in the gcov format used by GCC. Additionally, I will be adding support in llvm-profdata to manipulate sampling profiles. There was a bit of refactoring needed to separate some code that was in the reader files, but is actually common to both the reader and writer. The new test checks that reading the same profile encoded as text or raw, produces the same results. Reviewers: bogner, dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6000 llvm-svn: 220915
* Reduce double set lookups. NFC.Benjamin Kramer2014-10-101-2/+2
| | | | llvm-svn: 219505
* Remove bogus std::error_code returns form SectionRef.Rafael Espindola2014-10-081-1/+2
| | | | | | | | | | | | | | There are two methods in SectionRef that can fail: * getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents. Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment. llvm-svn: 219314
* Eliminate some deep std::vector copies. NFC.Benjamin Kramer2014-10-032-2/+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
* InstrProf: Simplify counting a file's regions when writing coverage (NFC)Justin Bogner2014-10-021-34/+24
| | | | | | | | | | | | When writing a coverage mapping we iterate through the mapping regions in order of FileID, but we were then repeatedly searching from the beginning of the list to count the number of regions with a given FileID. It is simpler and more efficient to search forward from the current iterator to find the number of regions. llvm-svn: 218842
* 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: Move some reader debug output out of the tool.Justin Bogner2014-09-201-0/+15
| | | | | | | This debug output is really for testing CoverageMappingReader, not the llvm-cov tool. Move it to where it can be more useful. llvm-svn: 218183
* Converting InstrProf's error_category to a ManagedStatic to avoid static ↵Chris Bieneman2014-09-191-2/+4
| | | | | | constructors and destructors. llvm-svn: 218168
* LineIterator: Provide a variant that keeps blank linesJustin Bogner2014-09-171-1/+1
| | | | | | | | It isn't always useful to skip blank lines, as evidenced by the somewhat awkward use of line_iterator in llvm-cov. This adds a knob to control whether or not to skip blanks. llvm-svn: 217960
* llvm-profdata: Avoid undefined behaviour when reading raw profilesJustin Bogner2014-09-121-0/+3
| | | | | | | | | | The raw profiles that are generated in compiler-rt always add padding so that each profile is aligned, so we can simply treat files that don't have this property as malformed. Caught by Alexey's new ubsan bot. Thanks! llvm-svn: 217708
* LLVMProfileData: Update LLVMBuild.txt corresponding to r217437.NAKAMURA Takumi2014-09-091-1/+1
| | | | llvm-svn: 217446
* Re-factor sample profile reader into lib/ProfileData.Diego Novillo2014-09-092-0/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch moves the profile reading logic out of the Sample Profile transformation into a generic profile reader facility in lib/ProfileData. The intent is to use this new reader to implement a sample profile reader/writer that can be used to convert sample profiles from external sources into LLVM. This first patch introduces no functional changes. It moves the profile reading code from lib/Transforms/SampleProfile.cpp into lib/ProfileData/SampleProfReader.cpp. In subsequent patches I will: - Add a bitcode format for sample profiles to allow for more efficient encoding of the profile. - Add a writer for both text and bitcode format profiles. - Add a 'convert' command to llvm-profdata to be able to convert between the two (and serve as entry point for other sample profile formats). Reviewers: bogner, echristo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5250 llvm-svn: 217437
OpenPOWER on IntegriCloud