summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-profdata/Inputs
Commit message (Collapse)AuthorAgeFilesLines
* [profile] Fourth fix for toolchains without zlib after D68351Vedant Kumar2019-10-311-0/+0
| | | | | Fix llvm/test/tools/llvm-profdata/nocompress.test, which I missed when authoring D68351 because my toolchain is configured with zlib support.
* [profile] Add a mode to continuously sync counter updates to a fileVedant Kumar2019-10-311-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for continuously syncing profile counter updates to a file. The motivation for this is that programs do not always exit cleanly. On iOS, for example, programs are usually killed via a signal from the OS. Running atexit() handlers after catching a signal is unreliable, so some method for progressively writing out profile data is necessary. The approach taken here is to mmap() the `__llvm_prf_cnts` section onto a raw profile. To do this, the linker must page-align the counter and data sections, and the runtime must ensure that counters are mapped to a page-aligned offset within a raw profile. Continuous mode is (for the moment) incompatible with the online merging mode. This limitation is lifted in https://reviews.llvm.org/D69586. Continuous mode is also (for the moment) incompatible with value profiling, as I'm not sure whether there is interest in this and the implementation may be tricky. As I have not been able to test extensively on non-Darwin platforms, only Darwin support is included for the moment. However, continuous mode may "just work" without modification on Linux and some UNIX-likes. AIUI the default value for the GNU linker's `--section-alignment` flag is set to the page size on many systems. This appears to be true for LLD as well, as its `no_nmagic` option is on by default. Continuous mode will not "just work" on Fuchsia or Windows, as it's not possible to mmap() a section on these platforms. There is a proposal to add a layer of indirection to the profile instrumentation to support these platforms. rdar://54210980 Differential Revision: https://reviews.llvm.org/D68351
* [llvm-profdata] Make "malformed-ptr-to-counter-array.test" textualVedant Kumar2019-10-121-0/+0
| | | | | | | | | As pointed out in https://reviews.llvm.org/D66979 post-commit, making this test textual would make it more maintainable. Differential Revision: https://reviews.llvm.org/D68718 llvm-svn: 374617
* [InstrProf] Tighten a check for malformed data records in raw profilesVedant Kumar2019-09-031-0/+0
| | | | | | | | | | | | | The check needs to validate a counter offset before performing pointer arithmetic with the (potentially corrupt) offset. Found by UBSan's pointer overflow check. rdar://54843625 Differential Revision: https://reviews.llvm.org/D66979 llvm-svn: 370826
* [SampleFDO] Add profile symbol list section to discriminate function beingWei Mi2019-08-313-0/+51
| | | | | | | | | | | | | | | | | | | cold versus function being newly added. This is the second half of https://reviews.llvm.org/D66374. Profile symbol list is the collection of function symbols showing up in the binary which generates the current profile. It is used to discriminate function being cold versus function being newly added. Profile symbol list is only added for profile with ExtBinary format. During profile use compilation, when profile-sample-accurate is enabled, a function without profile will be regarded as cold only when it is contained in that list. Differential Revision: https://reviews.llvm.org/D66766 llvm-svn: 370563
* [AutoFDO] Make call targets order deterministic for sample profileWenlei He2019-08-201-4/+4
| | | | | | | | | | | | | | | | | Summary: StringMap is used for storing call target to frequency map for AutoFDO. However the iterating order of StringMap is non-deterministic, which leads to non-determinism in AutoFDO profile output. Now new API getSortedCallTargets and SortCallTargets are added for deterministic ordering and output. Roundtrip test for text profile and binary profile is added. Reviewers: wmi, davidxl, danielcdh Subscribers: hiraditya, mgrang, llvm-commits, twoh Tags: #llvm Differential Revision: https://reviews.llvm.org/D66191 llvm-svn: 369440
* [llvm-profdata] Profile dump for compact binary formatWenlei He2019-08-131-0/+0
| | | | | | | | | | | | | | Summary: Fix "llvm-profdata show" so it can work with compact binary format profile. The change is to mark all functions "used" so SampleProfileReaderCompactBinary::read will read in all profiles available for dumping. The function names will be MD5 hash for compact binary format. Reviewers: wmi, davidxl, danielcdh Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65162 llvm-svn: 368731
* llvm-profdata] Handle the cases of overlapping input file and output fileRong Xu2019-07-084-0/+52
| | | | | | | | | | | | | | | | | | | | Currently llvm-profdata does not expect the same file name for the input profile and the output profile. >llvm-profdata merge A.profraw B.profraw -o B.profraw The above command runs successfully but the resulted B.profraw is not correct. This patch fixes the issue by moving the initialization of writer after loading the profile. For the show command, the following will report a confusing error of "Empty raw profile file": >llvm-profdata show B.profraw -o B.profraw It's harder to fix as we need to output something before loading the input profile. I don't think that a fix for this is worth the effort. I just make the error explicit for the show command. Differential Revision: https://reviews.llvm.org/D64360 llvm-svn: 365386
* [llvm-profdata] Add overlap command to compute similarity b/w two profile filesRong Xu2019-04-306-0/+144
| | | | | | | | | Add overlap functionality to llvm-profdata tool to compute the similarity between two profile files. Differential Revision: https://reviews.llvm.org/D60977 llvm-svn: 359612
* [PGO] Context sensitive PGO (part 4)Rong Xu2019-03-063-0/+32
| | | | | | | | | | | Part 4 of CSPGO changes: (1) add support in cmake for cspgo build. (2) fix an issue in big endian. (3) test cases. Differential Revision: https://reviews.llvm.org/D54175 llvm-svn: 355541
* [llvm-profdata] add value-cutoff functionality in show commandRong Xu2019-01-081-0/+21
| | | | | | | | | | | | | This patch improves llvm-profdata show command: (1) add -value-cutoff=<N> option: Show only those functions whose max count values are greater or equal to N. (2) add -list-below-cutoff option: Only output names of functions whose max count value are below the cutoff. (3) formats value-profile counts and prints out percentage. Differential Revision: https://reviews.llvm.org/D56342 llvm-svn: 350673
* [PGO] Revert r350579 to fix commit message.Rong Xu2019-01-081-21/+0
| | | | | | Will re-commit it using the correct commit message. llvm-svn: 350670
* [PGO] Use SourceFileName rather module name in PGOFuncNameRong Xu2019-01-071-0/+21
| | | | | | | | | | In LTO or Thin-lto mode (though linker plugin), the module names are of temp file names which are different for different compilations. Using SourceFileName avoids the issue. This should not change any functionality for current PGO as all the current callers of getPGOFuncName() is before LTO. llvm-svn: 350579
* Add flag to llvm-profdata to allow symbols in profile data to be remapped, andRichard Smith2018-09-136-0/+91
| | | | | | | | | | | | | | | | | add a tool to generate symbol remapping files. Summary: The new tool llvm-cxxmap builds a symbol mapping table from a file containing a description of partial equivalences to apply to mangled names and files containing old and new symbol tables. Reviewers: davidxl Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D51470 llvm-svn: 342168
* [llvm-profdata] Don't treat non-fatal merge errors as fatalVedant Kumar2017-11-171-0/+9
| | | | | | | | | 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-174-0/+22
| | | | llvm-svn: 318502
* [ProfileData] Fix data racing in merging indexed profilesRong Xu2017-10-051-0/+106
| | | | | | | | | | There is data racing to the static variable RecordIndex in index profile reader when merging in multiple threads. Make it a member variable in IndexedInstrProfReader to fix this. Differential Revision: https://reviews.llvm.org/D38431 llvm-svn: 314990
* Fix the bug when SampleProfileWriter writes out number of callsites.Dehao Chen2017-08-031-0/+4
| | | | | | | | | | | | | | Summary: As we support multiple callsites for the same location, we need to traverse all locations to get the number of callsites. Reviewers: davidxl Reviewed By: davidxl Subscribers: sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D36246 llvm-svn: 309907
* Commit missing/empty test file from r308789David Blaikie2017-07-221-0/+0
| | | | llvm-svn: 308814
* [ProfData] Detect if zlib is availableDavid Blaikie2017-07-211-0/+0
| | | | | | | | | | | | As discussed on [1], if the profile is compressed and llvm-profdata is not built with zlib support, the error message is not informative. Give a better error message if zlib is not available. [1] http://lists.llvm.org/pipermail/llvm-dev/2017-July/115571.html Reviewers: davidxl, dblaikie Differential Revision: https://reviews.llvm.org/D35586 llvm-svn: 308789
* [PGO] Fix bogus warning for merging empty llvm profile fileRong Xu2016-10-192-0/+17
| | | | | | | | | | | | | | | | | 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
* [profile] Remove another unneeded field in raw profile readerXinliang David Li2016-05-061-0/+0
| | | | | | | DataValueSize is now removed. The change is consolidated with previous raw version bump. llvm-svn: 268703
* [Profile] Raw profile header clean upXinliang David Li2016-05-051-0/+0
| | | | | | Remove dead ValueDataBegin field in raw header. llvm-svn: 268602
* Reapply (2x) "[PGO] Fix name encoding for ObjC-like functions"Vedant Kumar2016-03-281-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | Function names in ObjC can have spaces in them. This interacts poorly with name compression, which uses spaces to separate PGO names. Fix the issue by using a different separator and update a test. I chose "\01" as the separator because 1) it's non-printable, 2) we strip it from PGO names, and 3) it's the next natural choice once "\00" is discarded (that one's overloaded). What's changed since the original commit? - I fixed up the covmap-V2 binary format tests using a linux VM. - I weakened the CHECK lines in instrprof-comdat.h to account for the fact that there have been bugfixes to clang coverage. These will be fixed up in a follow-up. - I added an assert to make sure we don't get bitten by this again. - I constructed the c-general.profraw file without name compression enabled to appease some bots. Differential Revision: http://reviews.llvm.org/D18516 llvm-svn: 264658
* Revert "Reapply "[PGO] Fix name encoding for ObjC-like functions""Vedant Kumar2016-03-281-0/+0
| | | | | | | This reverts commit r264641 to investigate why c-general.test is failing on the bots. llvm-svn: 264643
* Reapply "[PGO] Fix name encoding for ObjC-like functions"Vedant Kumar2016-03-281-0/+0
| | | | | | | | | | | | | | | | | | | | | Function names in ObjC can have spaces in them. This interacts poorly with name compression, which uses spaces to separate PGO names. Fix the issue by using a different separator and update a test. I chose "\01" as the separator because 1) it's non-printable, 2) we strip it from PGO names, and 3) it's the next natural choice once "\00" is discarded (that one's overloaded). This reverts the revert commit beaf3d18. What's changed? - I fixed up the covmap-V2 binary format tests using a linux VM. - I updated the expected counts in instrprof-comdat.h to account for the fact that there have been bugfixes to clang coverage. - I added an assert to make sure we don't get bitten by this again. Differential Revision: http://reviews.llvm.org/D18516 llvm-svn: 264641
* Fix build bot failure Xinliang David Li2016-02-081-0/+0
| | | | llvm-svn: 260138
* [PGO] Enable compression in pgo instrumentationXinliang David Li2016-02-081-0/+0
| | | | | | | | | | | | This reduces sizes of instrumented object files, final binaries, process images, and raw profile data. The format of the indexed profile data remain the same. Differential Revision: http://reviews.llvm.org/D16388 llvm-svn: 260117
* Add a compatibility testXinliang David Li2016-02-031-0/+0
| | | | llvm-svn: 259632
* Fix a bug in test case -- duplicate entriesXinliang David Li2015-12-201-21/+0
| | | | llvm-svn: 256117
* [PGO] Handle and report overflow during profile merge for all types of dataNathan Slingerland2015-12-162-0/+13
| | | | | | | | | | | | 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
* [llvm-profdata] Add support for weighted merge of profile data (2nd try)Nathan Slingerland2015-12-154-0/+16
| | | | | | | | | | | | | | | | | | | | Summary: This change adds support for specifying a weight when merging profile data with the llvm-profdata tool. Weights are specified by using the --weighted-input=<weight>,<filename> option. Input files not specified with this option (normal positional list after options) are given a default weight of 1. Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the input data from multiple training runs. Both sampled and instrumented profiles are supported. Reviewers: davidxl, dnovillo, bogner, silvas Subscribers: silvas, davidxl, llvm-commits Differential Revision: http://reviews.llvm.org/D15306 llvm-svn: 255659
* [PGO] Value profiling text format reader/writer supportXinliang David Li2015-12-143-0/+110
| | | | | | | | | This patch adds the missing functionality in parsable text format support for value profiling. Differential Revision: http://reviews.llvm.org/D15212 llvm-svn: 255523
* [PGO] Revert r255365: solution incomplete, not handling lambda yetXinliang David Li2015-12-111-0/+0
| | | | llvm-svn: 255369
* [PGO] Stop using invalid char in instr variable names.Xinliang David Li2015-12-111-0/+0
| | | | | | | | | | | | | | Before the patch, -fprofile-instr-generate compile will fail if no integrated-as is specified when the file contains any static functions (the -S output is also invalid). This patch fixed the issue. With the change, the index format version will be bumped up by 1. Backward compatibility is preserved with this change. Differential Revision: http://reviews.llvm.org/D15243 llvm-svn: 255365
* Revert "[llvm-profdata] Add support for weighted merge of profile data"Nathan Slingerland2015-12-044-16/+0
| | | | | | | | This reverts commit b7250858d96b8ce567681214273ac0e62713c661. Reverting in order to investigate Windows test failure. llvm-svn: 254687
* [llvm-profdata] Add support for weighted merge of profile dataNathan Slingerland2015-12-044-0/+16
| | | | | | | | | | | | | | | | | | This change adds support for an optional weight when merging profile data with the llvm-profdata tool. Weights are specified by adding an option ':<weight>' suffix to the input file names. Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the input data from multiple training runs. Both sampled and instrumented profiles are supported. Reviewers: dnovillo, bogner, davidxl Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14547 llvm-svn: 254669
* [PGO] Add v2 format compatibility testXinliang David Li2015-12-031-0/+0
| | | | llvm-svn: 254572
* [PGO] Add --text option for llvm-profdata show|merge commandsXinliang David Li2015-11-231-0/+40
| | | | | | | | | | | | | | The new option is similar to the SampleProfile dump option. - dump raw/indexed format into text profile format - merge the profile and output into text profile format. Note that Value Profiling data text format is not yet designed. That functionality will be added later. Differential Revision: http://reviews.llvm.org/D14894 llvm-svn: 253913
* [PGO] Value profiling supportBetul Buyukkurt2015-11-181-0/+0
| | | | | | | | | This change introduces an instrumentation intrinsic instruction for value profiling purposes, the lowering of the instrumentation intrinsic and raw reader updates. The raw profile data files for llvm-profdata testing are updated. llvm-svn: 253484
* llvm/test/tools/llvm-profdata/text-format-errors.test: Use prepared version ↵NAKAMURA Takumi2015-11-131-0/+1
| | | | | | | | of the input file, instead of using echo. ...and s/\C9/\xC9/ llvm-svn: 253014
* Add inline stack streaming to binary sample profiles.Diego Novillo2015-10-091-0/+20
| | | | | | | | | | | | With this patch we can now read and write inline stacks in sample profiles to the binary encoded profiles. In a subsequent patch, I will add a string table to the binary encoding. Right now function names are emitted as strings every time we find them. This is too bloated and will produce large files in applications with lots of inlining. llvm-svn: 249861
* Re-apply r249644: Handle inline stacks in gcov-encoded sample profiles.Diego Novillo2015-10-081-0/+0
| | | | | | | | | | | | | This fixes memory allocation problems by making the merge operation keep the profile readers around until the merged profile has been emitted. This is needed to prevent the inlined function names to disappear from the function profiles. Since all the names are kept as references, once the reader disappears, the names are also deallocated. Additionally, XFAIL on big-endian architectures. The test case uses a gcov file generated on a little-endian system. llvm-svn: 249724
* Revert "Handle inline stacks in gcov-encoded sample profiles."Diego Novillo2015-10-081-0/+0
| | | | | | | | This reverts commit r249644. The buildbots are failing the new test I added. Investigating. llvm-svn: 249648
* Handle inline stacks in gcov-encoded sample profiles.Diego Novillo2015-10-081-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for reading sample profiles with inline stacks. Inline stacks in a profile are generated when the sampled binary has samples in inlined functions. For instance, if main() calls foo() and foo() calls bar(), and bar() is inlined into foo() and foo() inlined into main(), the profile may look something like: main total:364084 head:0 [ ... ] 2.3: _Z3fool total:243786 1: 60149 1.2: 38568 1.4: 46511 1.7: _Z3bari total:98558 1.1: 52672 1.2: 45886 At line 2, discriminator 3, main() calls foo(). In turn, foo() calls bar() at line 1, discriminator 7. In the textual format, this stacking of inline calls is represented with indentation. With this change, LLVM can now read sample profile files generated by the create_gcov tool from https://github.com/google/autofdo. llvm-svn: 249644
* http://reviews.llvm.org/D13145Dehao Chen2015-09-301-9/+9
| | | | | | Support hierarachical sample profile format. llvm-svn: 248865
* Add show and merge tools for sample PGO profiles.Diego Novillo2014-11-011-0/+12
| | | | | | | | | | | | | | | | | | | | | 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
* InstrProf: Allow multiple functions with the same nameJustin Bogner2014-08-011-0/+0
| | | | | | | | | | | | | | | | | | | | | | | This updates the instrumentation based profiling format so that when we have multiple functions with the same name (but different function hashes) we keep all of them instead of rejecting the later ones. There are a number of scenarios where this can come up where it's more useful to keep multiple function profiles: * Name collisions in unrelated libraries that are profiled together. * Multiple "main" functions from multiple tools built against a common library. * Combining profiles from different build configurations (ie, asserts and no-asserts) The profile format now stores the number of counters between the hash and the counts themselves, so that multiple sets of counts can be stored. Since this is backwards incompatible, I've bumped the format version and added some trivial logic to skip this when reading the old format. llvm-svn: 214585
* llvm-profdata: Replace redundant tests with more targeted onesJustin Bogner2014-08-013-27/+0
| | | | llvm-svn: 214548
* llvm-profdata: Use consistent file suffixes in testsJustin Bogner2014-07-3013-0/+0
| | | | | | | | | | | In some places we've been using different suffixes for the different file formats involved in instrprof, but in others we've just ambiguously used .profdata. Update the test files to indicate the types of file more obviously. No functional change. llvm-svn: 214357
OpenPOWER on IntegriCloud