aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData
AgeCommit message (Collapse)AuthorFilesLines
2016-08-31[Coverage] Make sorting criteria for CounterMappingRegions local.Igor Kudrin1-2/+10
Move the comparison function into the only place there it is used, i.e. the call to std::stable_sort in CoverageMappingWriter::write(). Add sorting by region kinds as it is required to ensure stable order in our tests and to simplify D23987. Differential Revision: https://reviews.llvm.org/D24034 llvm-svn: 280198
2016-08-29[ThinLTO] Indirect call promotion fixes for promoted local functionsTeresa Johnson1-0/+3
Summary: Fix a couple issues limiting the application of indirect call promotion in ThinLTO mode: - Invoke indirect call promotion before globalopt, since it may eliminate imported functions which appear unreferenced. - Invoke indirect call promotion with InLTO=true so that the PGOFuncName metadata is used to get the name for locals which would have been renamed during promotion. Reviewers: davidxl, mehdi_amini Subscribers: Prazek, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D24004 llvm-svn: 280024
2016-08-11Use range algorithms instead of unpacking begin/endDavid Majnemer1-2/+1
No functionality change is intended. llvm-svn: 278417
2016-08-11Fix some Clang-tidy modernize and Include What You Use warnings.Eugene Zelenko1-3/+16
Differential revision: https://reviews.llvm.org/D23291 llvm-svn: 278364
2016-07-21[PGO] Make needsComdatForCounter() available (NFC)Rong Xu1-0/+26
Move needsComdatForCounter() to lib/ProfileData/InstrProf.cpp from lib/Transforms/Instrumentation/InstrProfiling.cpp to make is available for other files. Differential Revision: https://reviews.llvm.org/D22643 llvm-svn: 276330
2016-07-19Retry: [llvm-profdata] Speed up merging by using a thread poolVedant Kumar1-0/+8
Add a "-j" option to llvm-profdata to control the number of threads used. Auto-detect NumThreads when it isn't specified, and avoid spawning threads when they wouldn't be beneficial. I tested this patch using a raw profile produced by clang (147MB). Here is the time taken to merge 4 copies together on my laptop: No thread pool: 112.87s user 5.92s system 97% cpu 2:01.08 total With 2 threads: 134.99s user 26.54s system 164% cpu 1:33.31 total Changes since the initial commit: - When handling odd-length inputs, call ThreadPool::wait() before merging the last profile. Should fix a race/off-by-one (see r275937). Differential Revision: https://reviews.llvm.org/D22438 llvm-svn: 275938
2016-07-19Revert "[llvm-profdata] Speed up merging by using a thread pool"Vedant Kumar1-8/+0
This reverts commit r275921. It broke the ppc64be bot: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/3537 I'm not sure why it broke, but based on the output, it looks like an off-by-one (one profile left un-merged). llvm-svn: 275937
2016-07-18[llvm-profdata] Speed up merging by using a thread poolVedant Kumar1-0/+8
Add a "-j" option to llvm-profdata to control the number of threads used. Auto-detect NumThreads when it isn't specified, and avoid spawning threads when they wouldn't be beneficial. I tested this patch using a raw profile produced by clang (147MB). Here is the time taken to merge 4 copies together on my laptop: No thread pool: 112.87s user 5.92s system 97% cpu 2:01.08 total With 2 threads: 134.99s user 26.54s system 164% cpu 1:33.31 total Differential Revision: https://reviews.llvm.org/D22438 llvm-svn: 275921
2016-07-15[Coverage] Mark a few more methods const (NFC)Vedant Kumar1-4/+4
llvm-svn: 275514
2016-07-13[Coverage] Mark a few methods const (NFC)Vedant Kumar1-1/+1
llvm-svn: 275337
2016-07-12[PGO] Don't include full file path in static function profile counter namesXinliang David Li1-3/+12
Patch by Jake VanAdrighem Differential Revision: http://reviews.llvm.org/D22028 llvm-svn: 275193
2016-06-29Revert "[Coverage] Move logic to encode filenames and mappings into llvm (NFC)"Vedant Kumar1-49/+8
This reverts commit 520a8298d8ef676b5da617ba3d2c7fa37381e939 (r273055). This is breaking stage2 instrumented builds with "malformed coverage data" errors. llvm-svn: 274106
2016-06-29Revert "[Coverage] Clarify ownership of a MemoryBuffer in the reader (NFC)"Vedant Kumar2-9/+8
This reverts commit 1037ef2574adde2103ad221d63834c3e1df4a776. llvm-svn: 274105
2016-06-21[Coverage] Clarify ownership of a MemoryBuffer in the reader (NFC)Vedant Kumar2-8/+9
Pass a `MemoryBuffer &` to BinaryCoverageReader::create() instead of a `std::unique_ptr<MemoryBuffer> &`. This makes it easier to reason about the ownership of the buffer at a glance. llvm-svn: 273326
2016-06-17[Coverage] Move logic to encode filenames and mappings into llvm (NFC)Vedant Kumar1-8/+49
Currently, frontends which emit source-based code coverage have to duplicate logic to encode filenames and raw coverage mappings properly. This violates an abstraction layer and forces frontends to copy tricky code. Introduce llvm::coverage::encodeFilenamesAndRawMappings() to take care of this. This will help us experiment with zlib-compressing coverage mapping data. llvm-svn: 273055
2016-06-17[Coverage] Get rid of an input/output parameter (NFC)Vedant Kumar1-10/+17
readFunctionRecords is used to iterate through the entries of the coverage mapping section. Instead of expecting the function to update the iterator through a `const char *&` parameter, just return the updated iterator. This will help us experiment with zlib-compressing coverage mapping data. llvm-svn: 273052
2016-06-10Bug fix remove another illegal char from prof symbol nameXinliang David Li1-1/+1
End-end test with no integrated assembly should be added at some point (not done now because some bots are not properly configured to support -no-integrated-as) llvm-svn: 272376
2016-05-31Change llvm-objdump, llvm-nm and llvm-size when reporting an object file errorKevin Enderby1-2/+2
when the object is from a slice of a Mach-O Universal Binary use something like "foo.o (for architecture i386)" as part of the error message when expected. Also fixed places in these tools that were ignoring object file errors from MachOUniversalBinary::getAsObjectFile() when the code moved on to see if the slice was an archive. To do this MachOUniversalBinary::getAsObjectFile() and MachOUniversalBinary::getObjectForArch() were changed from returning ErrorOr<...> to Expected<...> then that was threaded up to its users. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now the use of errorToErrorCode() is still used in two places yet to be fully converted. llvm-svn: 271332
2016-05-29[ProfileData] Clean up string handling a bit.Benjamin Kramer3-13/+11
llvm-svn: 271180
2016-05-27[ProfData] Remove global constructor from ProfileSummaryBuilder.Benjamin Kramer1-5/+7
No functionality change intended. llvm-svn: 271021
2016-05-24Add FIXMEs to all derived classes of std::error_category.Peter Collingbourne3-0/+9
This helps make clear that we're moving away from std::error_code. Differential Revision: http://reviews.llvm.org/D20592 llvm-svn: 270604
2016-05-20[ProfileData] Thread unique_ptr through the summary builder to avoid leaks.Benjamin Kramer5-12/+12
llvm-svn: 270195
2016-05-20[Coverage] Fix an issue where improper coverage mapping data could be loaded ↵Igor Kudrin1-18/+88
for an inline function. If an inline function is observed but unused in a translation unit, dummy coverage mapping data with zero hash is stored for this function. If such a coverage mapping section came earlier than real one, the latter was ignored. As a result, llvm-cov was unable to show coverage information for those functions. Differential Revision: http://reviews.llvm.org/D20286 llvm-svn: 270194
2016-05-19Remove specializations of ProfileSummaryEaswaran Raman5-22/+23
This removes the subclasses of ProfileSummary, moves the members of the derived classes to the base class. Differential Revision: http://reviews.llvm.org/D20390 llvm-svn: 270143
2016-05-19Move ProfileSummary to IR.Easwaran Raman7-386/+146
This splits ProfileSummary into two classes: a ProfileSummary class that has methods to convert from/to metadata and a ProfileSummaryBuilder class that computes the profiles summary which is in ProfileData. Differential Revision: http://reviews.llvm.org/D20314 llvm-svn: 270136
2016-05-19Retry^3 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar5-307/+326
Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. - Remove the base ProfError class to work around an MSVC ICE. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 270020
2016-05-18[Coverage] Ensure that coverage mapping data has an expected alignment in ↵Igor Kudrin1-0/+7
'covmapping' files. Coverage mapping data is organized in a sequence of blocks, each of which is expected to be aligned by 8 bytes. This feature is used when reading those blocks, see VersionedCovMapFuncRecordReader::readFunctionRecords(). If a misaligned covearge mapping data has more than one block, it causes llvm-cov to fail. Differential Revision: http://reviews.llvm.org/D20285 llvm-svn: 269887
2016-05-16Revert "Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Vedant Kumar5-324/+305
This reverts commit r269694. MSVC says: error C2086: 'char llvm::ProfErrorInfoBase<enum llvm::instrprof_error>::ID' : redefinition llvm-svn: 269700
2016-05-16Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar5-305/+324
Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Address undefined-var-template warning. - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269694
2016-05-14Revert "Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Chandler Carruth5-324/+305
This reverts commit r269491. It triggers warnings with Clang, breaking builds for -Werror users including several build bots. llvm-svn: 269547
2016-05-13Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar5-305/+324
Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269491
2016-05-13Revert "(HEAD -> master, origin/master, origin/HEAD) [ProfileData] (llvm) ↵Vedant Kumar5-323/+304
Use Error in InstrProf and Coverage, NFC" This reverts commit r269462. It fails two llvm-profdata tests. llvm-svn: 269466
2016-05-13[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFCVedant Kumar5-304/+323
Transition InstrProf and Coverage over to the stricter Error/Expected interface. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269462
2016-05-11[ProfileData] Use SoftInstrProfErrors to count soft errors, NFCVedant Kumar2-44/+56
Differential Revision: http://reviews.llvm.org/D20082 llvm-svn: 269222
2016-05-11Use an emplace_back for consistency, NFCVedant Kumar1-1/+1
llvm-svn: 269199
2016-05-10Revert r269131Easwaran Raman1-44/+0
llvm-svn: 269138
2016-05-10Reapply r266477 and r266488Easwaran Raman1-0/+44
llvm-svn: 269131
2016-05-06[PGO] Use rsplit to parse value-data line in text profile file.Rong Xu1-1/+1
The value-data line is <PGOFuncName>:<Count_Value>. PGOFuncName might contain ':' for the internal linkage functions. We therefore need to use rsplit, rather split, to extract the data from the line. This fixes the error when merging a text profile file to an indexed profile file. llvm-svn: 268818
2016-05-05Add a note about the "entry count" used the profile summarySean Silva1-0/+4
Thanks to David Li for the clarification. llvm-svn: 268669
2016-05-05[profile] Remove unneeded field in raw profile readerXinliang David Li1-8/+6
Differential Revision: http://reviews.llvm.org/D19956 llvm-svn: 268667
2016-05-05[Coverage] Combine counts of expansion regions if there are no code regions ↵Igor Kudrin1-16/+31
for the same area. Differential Revision: http://reviews.llvm.org/D18831 llvm-svn: 268620
2016-05-03[ProfileData] Propagate an error from InstrProfSymtabVedant Kumar1-4/+8
CovMapFuncReader::get should propagate up errors from InstrProfSymtab. This is part of a series of patches to transition ProfileData over to the stricter Error/Expected interface. llvm-svn: 268428
2016-05-03[ProfileData] Add error codes for compression failuresVedant Kumar1-9/+16
Be more specific in describing compression failures. Also, check for this kind of error in emitNameData(). This is part of a series of patches to transition ProfileData over to the stricter Error/Expected interface. llvm-svn: 268400
2016-05-02Remove redundant return, NFCVedant Kumar1-1/+0
llvm-svn: 268312
2016-04-29Move coverage related code into a separate library.Easwaran Raman7-8/+44
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-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
2016-04-22[PGO] change the interface for createPGOFuncNameMetadata()Rong Xu1-5/+7
This patch changes the interface for createPGOFuncNameMetadata() where we add another PGOFuncName argument. Differential Revision: http://reviews.llvm.org/D19433 llvm-svn: 267216
2016-04-21[ProfileData] Report errors from InstrProfSymtab::createVedant Kumar1-3/+9
InstrProfSymtab::create can fail with instrprof_error::malformed, but this error is silently dropped. Propagate the error up to the caller so we fail early. Eventually, I'd like to transition ProfileData over to the new Error class so we can't ignore hard failures like this. llvm-svn: 267055
2016-04-18Reapply "[Coverage] Prevent detection of false instantiations in case of ↵Igor Kudrin1-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
2016-04-18Revert "Replace the use of MaxFunctionCount module flag"Eric Liu1-44/+0
This reverts commit r266477. This commit introduces cyclic dependency. This commit has "Analysis" depend on "ProfileData", while "ProfileData" depends on "Object", which depends on "BitCode", which depends on "Analysis". llvm-svn: 266619