summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Change sample profile format enum name SPF_Raw_Binary to SPF_Binary.Wei Mi2018-06-121-11/+10
| | | | | | | Some out-of-tree targets depend on the enum name SPF_Binary. Keep the name can avoid unnecessary churn to those targets. llvm-svn: 334476
* Fix a typo in rL334447.Wei Mi2018-06-121-1/+1
| | | | llvm-svn: 334475
* [SampleFDO] Add a new compact binary format for sample profile.Wei Mi2018-06-111-9/+19
| | | | | | | | | | | | | | Name table occupies a big chunk of size in current binary format sample profile. In order to reduce its size, the patch changes the sample writer/reader to save/restore MD5Hash of names in the name table. Sample annotation phase will also use MD5Hash of name to query samples accordingly. Experiment shows compact binary format can reduce the size of sample profile by 2/3 compared with binary format generally. Differential Revision: https://reviews.llvm.org/D47955 llvm-svn: 334447
* [llvm-profdata] Use WithColor for printing errorsJonas Devlieghere2018-04-181-6/+12
| | | | | | | | Use convenience helpers in WithColor to print errors and warnings. Differential revision: https://reviews.llvm.org/D45658 llvm-svn: 330262
* Define InitLLVM to do common initialization all at once.Rui Ueyama2018-04-131-7/+2
| | | | | | | | | | | We have a few functions that virtually all command wants to run on process startup/shutdown. This patch adds InitLLVM class to do that all at once, so that we don't need to copy-n-paste boilerplate code to each llvm command's main() function. Differential Revision: https://reviews.llvm.org/D45602 llvm-svn: 330046
* [llvm-profdata] Don't treat non-fatal merge errors as fatalVedant Kumar2017-11-171-7/+43
| | | | | | | | | This fixes an issue seen on the coverage bot: http://lab.llvm.org:8080/green/view/Experimental/job/clang-stage2-coverage-R/1930 Profile merging shouldn't fail if a single counter mismatch is detected. llvm-svn: 318555
* [llvm-profdata] Fix a dangling reference to an error stringVedant Kumar2017-11-171-3/+11
| | | | llvm-svn: 318502
* [llvm-profdata] Report if profile data file is IR- or FE-levelAdam Nemet2017-11-141-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D39997 llvm-svn: 318159
* Bring r314809 back.Rafael Espindola2017-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | But now include a check for CPU_COUNT so we still build on 10 year old versions of glibc. Original message: Use sched_getaffinity instead of std::thread::hardware_concurrency. The issue with std::thread::hardware_concurrency is that it forwards to libc and some implementations (like glibc) don't take thread affinity into consideration. With this change a llvm program that can execute in only 2 cores will use 2 threads, even if the machine has 32 cores. This makes benchmarking a lot easier, but should also help if someone doesn't want to use all cores for compilation for example. llvm-svn: 314931
* Revert D38481 due to missing cmake check for CPU_COUNTDaniel Neilson2017-10-041-2/+2
| | | | | | | | | | | | | Summary: This reverts D38481. The change breaks systems with older versions of glibc. It injects a use of CPU_COUNT() from sched.h without checking to ensure that the function exists first. Reviewers: Subscribers: llvm-svn: 314922
* Use sched_getaffinity instead of std::thread::hardware_concurrency.Rafael Espindola2017-10-031-2/+2
| | | | | | | | | | | | | | The issue with std::thread::hardware_concurrency is that it forwards to libc and some implementations (like glibc) don't take thread affinity into consideration. With this change a llvm program that can execute in only 2 cores will use 2 threads, even if the machine has 32 cores. This makes benchmarking a lot easier, but should also help if someone doesn't want to use all cores for compilation for example. llvm-svn: 314809
* [ProfileData] Add new option to dump topn hottest functionsXinliang David Li2017-07-111-6/+46
| | | | | | Differential Revision: http://reviews.llvm.org/D35155 llvm-svn: 307702
* llvm-profdata: Reduce memory usage by using Error callback rather than memberDavid Blaikie2017-07-101-3/+16
| | | | | | | | | | | | | | | | Reduces llvm-profdata memory usage on a large profile from 7.8GB to 5.1GB. The ProfData API now supports reporting all the errors/warnings rather than only the first, though llvm-profdata ignores everything after the first for now to preserve existing behavior. (if there's a desire for other behavior, happy to implement that - but might be as well left for a separate patch) Reviewers: davidxl Differential Revision: https://reviews.llvm.org/D35149 llvm-svn: 307516
* Prototype: Reduce llvm-profdata merge memory usage furtherDavid Blaikie2017-07-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The InstrProfWriter already stores the name and hash of the record in the nested maps it uses for lookup while merging - this data is duplicated in the value within the maps. Refactor the InstrProfRecord to use a nested struct for the counters themselves so that InstrProfWriter can use this nested struct alone without the name or hash duplicated there. This work is incomplete, but enough to demonstrate the value (around a 50% decrease in memory usage for a large test case (10GB -> 5GB)). Though most of that decrease is probably from removing the SoftInstrProfError as well, but I haven't implemented a replacement for it yet. (it needs to go with the counters, because the operations on the counters - merging, etc, are where the failures are - unlike the name/hash which are totally unused by those counter-related operations and thus easy to split out) Ongoing discussion about removing SoftInstrProfError as a field of the InstrProfRecord is happening on the thread that added it - including the possibility of moving back towards an earlier version of that proposed patch that passed SoftInstrProfError through the various APIs, rather than as a member of InstrProfRecord. Reviewers: davidxl Differential Revision: https://reviews.llvm.org/D34838 llvm-svn: 307298
* [ProfileData] PR33517: Check for failure of symtab creationVedant Kumar2017-06-201-3/+5
| | | | | | | | | | | | With PR33517, it became apparent that symbol table creation can fail when presented with malformed inputs. This patch makes that sort of error detectable, so llvm-cov etc. can fail more gracefully. Specifically, we now check that function names within the symbol table aren't empty. Testing: check-{llvm,clang,profile}, some unit test updates. llvm-svn: 305765
* Fix a couple of typos in memory intrinsic optimization output (NFC)Teresa Johnson2017-05-241-1/+1
| | | | | | s/instrinsic/intrinsic llvm-svn: 303782
* Resubmit r297897: [PGO] Value profile for size of memory intrinsic callsRong Xu2017-03-161-7/+32
| | | | | | | R297897 inadvertently enabled annotation for memop profiling. This new patch fixed it. llvm-svn: 297996
* Revert "[PGO] Value profile for size of memory intrinsic calls"Eric Liu2017-03-161-32/+7
| | | | | | This commit reverts r297897 and r297909. llvm-svn: 297951
* [PGO] Value profile for size of memory intrinsic callsRong Xu2017-03-151-7/+32
| | | | | | | | | This patch adds the value profile support to profile the size parameter of memory intrinsic calls: memcpy, memcmp, and memmov. Differential Revision: http://reviews.llvm.org/D28965 llvm-svn: 297897
* [PGO] Refactor profile dumping function for ease of adding other profile kindRong Xu2017-03-091-35/+56
| | | | | | | | Refactor the dumping function so that we can add other value profile kind easily. Differential Revision: https://reviews.llvm.org/D30752 llvm-svn: 297399
* [PGO] Fix a use-after-move. NFC.Rong Xu2016-10-191-1/+2
| | | | llvm-svn: 284664
* [PGO] Fix bogus warning for merging empty llvm profile fileRong Xu2016-10-191-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
* Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini2016-10-081-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
* [Profile] dump ic value profile value/site-count histogramXinliang David Li2016-09-201-1/+11
| | | | | | Differential Revision: http://reviews.google.com/D24783 llvm-svn: 282017
* llvm-profdata: Clarify the top level helpJustin Bogner2016-08-031-0/+1
| | | | | | | It wasn't very obvious that you're supposed to call help on the subcommands. This should help. llvm-svn: 277678
* [llvm-profdata] Bring back reading profile data from STDIN.Benjamin Kramer2016-07-221-0/+7
| | | | | | This feature was lost in r276197. llvm-svn: 276407
* [profdata] Remove constructor that MSVC 2013 pretends to not understand.Benjamin Kramer2016-07-211-6/+2
| | | | | | No functionality change intended. llvm-svn: 276284
* Reapply r276185Xinliang David Li2016-07-201-10/+33
| | | | | | Fix the test case that should not depend on dir iteration order. llvm-svn: 276197
* Revert r276185 -- build bot failure Xinliang David Li2016-07-201-33/+10
| | | | llvm-svn: 276194
* [Profile] support directory reading in profile mergingXinliang David Li2016-07-201-10/+33
| | | | | | Differential Revision: http://reviews.llvm.org/D22560 llvm-svn: 276185
* Retry: [llvm-profdata] Speed up merging by using a thread poolVedant Kumar2016-07-191-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
* Revert "[llvm-profdata] Speed up merging by using a thread pool"Vedant Kumar2016-07-191-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
* [llvm-profdata] Speed up merging by using a thread poolVedant Kumar2016-07-181-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
* Apply another batch of fixes from clang-tidy's ↵Benjamin Kramer2016-06-171-8/+10
| | | | | | | | performance-unnecessary-value-param. Contains some manual fixes. No functionality change intended. llvm-svn: 273047
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-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
* Retry^4 "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar2016-06-071-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
* Revert "Retry^2 "[llvm-profdata] Add option to ingest filepaths from a file""Vedant Kumar2016-06-061-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
* Retry^2 "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar2016-06-061-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
* Revert "Retry "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar2016-06-061-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
* Retry "[llvm-profdata] Add option to ingest filepaths from a file"Vedant Kumar2016-06-061-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
* [llvm-profdata] Revert r271709 and the 3 subsequent commits - the codeChandler Carruth2016-06-041-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
* [llvm-profdata] Clean up the way we create the input filenames buffer (NFC)Vedant Kumar2016-06-041-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
* [llvm-profdata] Fix use-after-free from discarded MemoryBuffer (NFC)Vedant Kumar2016-06-031-8/+13
| | | | | | | | Thanks to Justin Bogner for pointing this out! Caught by ASAN. llvm-svn: 271748
* [llvm-profdata] Fix option description (NFC)Vedant Kumar2016-06-031-1/+1
| | | | llvm-svn: 271710
* [llvm-profdata] Add option to ingest filepaths from a fileVedant Kumar2016-06-031-4/+45
| | | | | | Differential Revision: http://reviews.llvm.org/D20980 llvm-svn: 271709
* Trim some spaces (NFC)Vedant Kumar2016-06-031-2/+0
| | | | llvm-svn: 271681
* [profile] show more statisticsXinliang David Li2016-05-231-1/+14
| | | | | | Add value profile statistics with the 'show' command. llvm-svn: 270450
* Remove specializations of ProfileSummaryEaswaran Raman2016-05-191-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
* Move ProfileSummary to IR.Easwaran Raman2016-05-191-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
* Retry^3 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-191-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
OpenPOWER on IntegriCloud