aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-10-19[PGO] Fix a use-after-move. NFC.Rong Xu1-1/+2
llvm-svn: 284664
2016-10-19[PGO] Fix bogus warning for merging empty llvm profile fileRong Xu1-1/+6
Profile runtime can generate an empty raw profile (when there is no function in the shared library). This empty profile is treated as a text format profile. A test format profile without the flag of "#IR" is thought to be a clang generated profile. So in llvm profile merging, we will get a bogus warning of "Merge IR generated profile with Clang generated profile." The fix here is to skip the empty profile (when the buffer size is 0) for profile merge. Reviewers: vsk, davidxl Differential Revision: http://reviews.llvm.org/D25687 llvm-svn: 284659
2016-10-08Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini1-4/+3
template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 llvm-svn: 283671
2016-09-20[Profile] dump ic value profile value/site-count histogramXinliang David Li1-1/+11
Differential Revision: http://reviews.google.com/D24783 llvm-svn: 282017
2016-08-03llvm-profdata: Clarify the top level helpJustin Bogner1-0/+1
It wasn't very obvious that you're supposed to call help on the subcommands. This should help. llvm-svn: 277678
2016-07-22[llvm-profdata] Bring back reading profile data from STDIN.Benjamin Kramer1-0/+7
This feature was lost in r276197. llvm-svn: 276407
2016-07-21[profdata] Remove constructor that MSVC 2013 pretends to not understand.Benjamin Kramer1-6/+2
No functionality change intended. llvm-svn: 276284
2016-07-20Reapply r276185Xinliang David Li1-10/+33
Fix the test case that should not depend on dir iteration order. llvm-svn: 276197
2016-07-20Revert r276185 -- build bot failure Xinliang David Li1-33/+10
llvm-svn: 276194
2016-07-20[Profile] support directory reading in profile mergingXinliang David Li1-10/+33
Differential Revision: http://reviews.llvm.org/D22560 llvm-svn: 276185
2016-07-19Retry: [llvm-profdata] Speed up merging by using a thread poolVedant Kumar1-23/+117
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-115/+23
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-23/+115
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-06-17Apply another batch of fixes from clang-tidy's ↵Benjamin Kramer1-8/+10
performance-unnecessary-value-param. Contains some manual fixes. No functionality change intended. llvm-svn: 273047
2016-06-09Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith1-1/+1
looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
2016-06-07Retry^4 "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar1-6/+59
Changes since the initial commit: - Use echo instead of printf. This should side-step the character escaping issues on Windows. Differential Revision: http://reviews.llvm.org/D20980 llvm-svn: 272068
2016-06-06Revert "Retry^2 "[llvm-profdata] Add option to ingest filepaths from a file""Vedant Kumar1-63/+13
This reverts commit r271953. It's still breaking on Windows, though the list initialization issue is fixed: http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/3751 llvm-svn: 271963
2016-06-06Retry^2 "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar1-13/+63
Changes since the initial commit: - Normalize file paths read from the file to prevent Windows path separators from escaping parts of the path. - Since we need to store the normalized file paths in WeightedFile, don't do tricky things to keep the source MemoryBuffer alive. - Don't use list-initialization for a std::string in WeightedFile. Differential Revision: http://reviews.llvm.org/D20980 llvm-svn: 271953
2016-06-06Revert "Retry "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar1-58/+13
This reverts commit r271949. It breaks the Windows build: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/12796 llvm-svn: 271952
2016-06-06Retry "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar1-13/+58
Changes since the initial commit: - Normalize file paths read from the file to prevent Windows path separators from escaping parts of the path. - Since we need to store the normalized file paths in WeightedFile, don't do tricky things to keep the source MemoryBuffer alive. Differential Revision: http://reviews.llvm.org/D20980 llvm-svn: 271949
2016-06-04[llvm-profdata] Revert r271709 and the 3 subsequent commits - the codeChandler Carruth1-57/+4
and/or tests aren't working on Windows currently. There seems to be some problem with quoting the file paths. I don't understand the test structure here or the code well enough to try to come up with a way to correctly handle paths with back slashes in them, and this has caused the Windows builds to be failing for 7 hours now, so I'm reverting the whole thing to bring them back to life. Sorry for the disruption, but a couple of these were bug fixes anyways that can be folded into a fresh commit. Reverts the following patches: r271756: Clean up the way we create the input filenames buffer (NFC) r271748: Fix use-after-free from discarded MemoryBuffer (NFC) r271710: Fix option description (NFC) r271709: Add option to ingest filepaths from a file llvm-svn: 271760
2016-06-04[llvm-profdata] Clean up the way we create the input filenames buffer (NFC)Vedant Kumar1-7/+14
Create the buffer before calling parseInputFilenamesFile(), and add a comment explaining why this is done. Thanks to David Li for the suggestion! llvm-svn: 271756
2016-06-03[llvm-profdata] Fix use-after-free from discarded MemoryBuffer (NFC)Vedant Kumar1-8/+13
Thanks to Justin Bogner for pointing this out! Caught by ASAN. llvm-svn: 271748
2016-06-03[llvm-profdata] Fix option description (NFC)Vedant Kumar1-1/+1
llvm-svn: 271710
2016-06-03[llvm-profdata] Add option to ingest filepaths from a fileVedant Kumar1-4/+45
Differential Revision: http://reviews.llvm.org/D20980 llvm-svn: 271709
2016-06-03Trim some spaces (NFC)Vedant Kumar1-2/+0
llvm-svn: 271681
2016-05-23[profile] show more statisticsXinliang David Li1-1/+14
Add value profile statistics with the 'show' command. llvm-svn: 270450
2016-05-19Remove specializations of ProfileSummaryEaswaran Raman1-4/+3
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 Raman1-9/+10
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 Kumar1-27/+41
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-16Revert "Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Vedant Kumar1-41/+27
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 Kumar1-27/+41
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 Carruth1-41/+27
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 Kumar1-27/+41
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 Kumar1-40/+27
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 Kumar1-27/+40
Transition InstrProf and Coverage over to the stricter Error/Expected interface. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269462
2016-05-03Remove unused header, NFCVedant Kumar1-1/+0
llvm-svn: 268361
2016-04-14Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini1-3/+4
At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
2016-02-17Add a profile summary class specific to instrumentation profiles.Easwaran Raman1-2/+2
Modify ProfileSummary class to make it not instrumented profile specific. Add a new InstrumentedProfileSummary class that inherits from ProfileSummary. Differential Revision: http://reviews.llvm.org/D17310 llvm-svn: 261119
2016-02-10[PGO] Differentiate Clang instrumentation and IR level instrumentation profilesRong Xu1-4/+11
This patch uses one bit in profile version to differentiate Clang instrumentation and IR level instrumentation profiles. PGOInstrumenation generates a COMDAT variable __llvm_profile_raw_version so that the compiler runtime can set the right profile kind. For Maco-O platform, we generate the variable as linkonce_odr linkage as COMDAT is not supported. PGOInstrumenation now checks this bit to make sure it's an IR level instrumentation profile. The patch was submitted as r260164 but reverted due to a Darwin test breakage. Original Differential Revision: http://reviews.llvm.org/D15540 Differential Revision: http://reviews.llvm.org/D17020 llvm-svn: 260385
2016-02-08[PGO] Revert r260146 as it breaks Darwin platforms.Rong Xu1-11/+4
r260146 | xur | 2016-02-08 13:07:46 -0800 (Mon, 08 Feb 2016) | 13 lines [PGO] Differentiate Clang instrumentation and IR level instrumentation profiles llvm-svn: 260170
2016-02-08[PGO] Differentiate Clang instrumentation and IR level instrumentation profilesRong Xu1-4/+11
This patch uses one bit in profile version to differentiate Clang instrumentation and IR level instrumentation profiles. PGOInstrumenation generates a COMDAT variable __llvm_profile_raw_version so that the compiler runtime can set the right profile kind. PGOInstrumenation now checks this bit to make sure it's an IR level instrumentation profile. Differential Revision: http://reviews.llvm.org/D15540 llvm-svn: 260146
2016-02-04Refactor profile summary support code. NFC.Easwaran Raman1-0/+1
Summary computation is not just for instrumented profiling and so I have moved the ProfileSummary class to ProfileCommon.h (named so to allow code unrelated to summary but common to instrumented and sampled profiling to be placed there) Differential Revision: http://reviews.llvm.org/D16661 llvm-svn: 259846
2016-01-29[Profiling] Add a -sparse mode to llvm-profdata mergeVedant Kumar1-3/+7
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
2016-01-16[PGO] fix a bug in profile summary computationXinliang David Li1-1/+1
Entry block count was not counted and is corrected. Also introduce a new metric that is MaxInternalBlockCount which show command shows (as before). llvm-svn: 257987
2016-01-14[PGO] Move profile summary interface/impl into InstrProf.[*] /NFCXinliang David Li1-99/+0
llvm-svn: 257819
2016-01-14llvm-profdata.cpp: Fix comment lines. [-Wdocumentation]NAKAMURA Takumi1-3/+3
llvm-svn: 257726
2016-01-13Display detailed profile summary in llvm-profdata tool.Easwaran Raman1-16/+136
This adds a detailed profile summary in llvm-profdata. The summary is in the form of one or more triples of the form (P, N, M) which is interpreted as if we look at the Top-N counts in the profile, their sum accounts for P percentage of the sum of all counts in the program and the minimum count in the Top-N is M. Differential Revision: http://reviews.llvm.org/D16005 llvm-svn: 257680
2015-12-20[PGO] Improve Indexed Profile Reader efficiency Xinliang David Li1-2/+5
With the support of value profiling added, the Indexed prof reader gets less efficient. The prof reader initialization used to be just reading the file header, but with VP support added, initialization needs to walk through all profile keys of ondisk hash table resulting in very poor locality and large memory increase (keys are stored together with the profile data in the mapped profile buffer). Even worse, when the reader is used by the compiler (not llvm-profdata too), the penalty becomes very high as compilation of each single module requires touching profile data buffer for the whole program. In this patch, the icall target values (MD5hash) are no longer eargerly converted back to name strings when the data is read into memory. New interface is added to to profile reader so that InstrProfSymtab can be lazily created for Indexed profile reader on-demand. Creating of the symtab is intended to be used by llvm-profdata tool for symbolic dumping of VP data. It can be used with compiler (for legacy out of tree uses) too but not recommended due to compile time and memory reasons mentioned above. Some other cleanups are also included: Function Addr to md5 map is now consolated into InstrProfSymtab. InstrProfStringtab is no longer used and eliminated. llvm-svn: 256114
2015-12-16[PGO] Handle and report overflow during profile merge for all types of dataNathan Slingerland1-1/+5
Summary: Surface counter overflow when merging profile data. Merging still occurs on overflow but counts saturate to the maximum representable value. Overflow is reported to the user. Reviewers: davidxl, dnovillo, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15547 llvm-svn: 255825