summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-profdata
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-profdata] Add support for weighted merge of profile data (2nd try)Nathan Slingerland2015-12-157-1/+142
| | | | | | | | | | | | | | | | | | | | 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-145-0/+180
| | | | | | | | | 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-112-7/+0
| | | | llvm-svn: 255369
* [PGO] Stop using invalid char in instr variable names.Xinliang David Li2015-12-112-0/+7
| | | | | | | | | | | | | | 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-046-114/+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-046-0/+114
| | | | | | | | | | | | | | | | | | 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-032-0/+20
| | | | llvm-svn: 254572
* [llvm-profdata] Change instr prof counter overflow to saturate rather than ↵Nathan Slingerland2015-12-021-4/+12
| | | | | | | | | | | | | | discard Summary: This changes overflow handling during instrumentation profile merge. Rathar than throwing away records that would result in counter overflow, merged counts are instead clamped to the maximum representable value. A warning about counter overflow is still surfaced to the user as before. Reviewers: dnovillo, davidxl, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14893 llvm-svn: 254525
* [PGO] Add --text option for llvm-profdata show|merge commandsXinliang David Li2015-11-232-0/+61
| | | | | | | | | | | | | | 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
* SamplePGO - Sort samples by source location when emitting as text.Diego Novillo2015-11-192-2/+2
| | | | | | | | When dumping function samples or writing them out as text format, it helps if the samples are emitted sorted by source location. The sorting of the maps is a bit slow, so we only do it on demand. llvm-svn: 253568
* [PGO] Value profiling supportBetul Buyukkurt2015-11-187-25/+64
| | | | | | | | | 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-profdata] Improve error messaging when merging mismatched profile dataNathan Slingerland2015-11-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change tries to make the root cause of instrumented profile data merge failures clearer. Previous: $ llvm-profdata merge test_0.profraw test_1.profraw -o test_merged.profdata test_1.profraw: foo: Function count mismatch test_1.profraw: bar: Function count mismatch test_1.profraw: baz: Function count mismatch ... Changed: $ llvm-profdata merge test_0.profraw test_1.profraw -o test_merged.profdata test_1.profraw: foo: Function basic block count change detected (counter mismatch) Make sure that all profile data to be merged is generated from the same binary. test_1.profraw: bar: Function basic block count change detected (counter mismatch) test_1.profraw: baz: Function basic block count change detected (counter mismatch) ... Reviewers: dnovillo, davidxl, bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14739 llvm-svn: 253384
* SamplePGO - Add dump routines for LineLocation, SampleRecord and FunctionSamplesDiego Novillo2015-11-133-12/+12
| | | | llvm-svn: 253071
* llvm/test/tools/llvm-profdata/text-format-errors.test: Use prepared version ↵NAKAMURA Takumi2015-11-132-2/+2
| | | | | | | | of the input file, instead of using echo. ...and s/\C9/\xC9/ llvm-svn: 253014
* [llvm-profdata] Add check for text profile formats and improve error ↵Nathan Slingerland2015-11-133-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reporting (2nd try) Summary: This change addresses two possible instances of user error / confusion when merging sampled profile data. Previously any input that didn't match the raw or processed instrumented format would automatically be interpreted as instrumented profile text format data. No error would be reported during the merge. Example: If foo-sampled.profdata and bar-sampled.profdata are binary sampled profiles: Old behavior: $ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -output foobar-sampled.profdata $ llvm-profdata show -sample foobar-sampled.profdata error: foobar-sampled.profdata:1: Expected 'mangled_name:NUM:NUM', found lprofi This change adds basic checks for valid input data when assuming text input. It also makes error messages related to file format validity more specific about the assumbed profile data type. New behavior: $ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -o foobar-sampled.profdata error: foo.profdata: Unrecognized instrumentation profile encoding format Perhaps you forgot to use the -sample option? Reviewers: bogner, davidxl, dnovillo Subscribers: davidxl, llvm-commits Differential Revision: http://reviews.llvm.org/D14558 llvm-svn: 253009
* reverting r252916 to investigate test failureNathan Slingerland2015-11-123-19/+4
| | | | llvm-svn: 252921
* [llvm-profdata] Add check for text profile formats and improve error reportingNathan Slingerland2015-11-123-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change addresses two possible instances of user error / confusion when merging sampled profile data. Previously any input that didn't match the raw or processed instrumented format would automatically be interpreted as instrumented profile text format data. No error would be reported during the merge. Example: If foo-sampled.profdata and bar-sampled.profdata are binary sampled profiles: Old behavior: $ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -output foobar-sampled.profdata $ llvm-profdata show -sample foobar-sampled.profdata error: foobar-sampled.profdata:1: Expected 'mangled_name:NUM:NUM', found lprofi This change adds basic checks for valid input data when assuming text input. It also makes error messages related to file format validity more specific about the assumbed profile data type. New behavior: $ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -o foobar-sampled.profdata error: foo.profdata: Unrecognized instrumentation profile encoding format Perhaps you forgot to use the -sample option? Reviewers: bogner, davidxl, dnovillo Subscribers: davidxl, llvm-commits Differential Revision: http://reviews.llvm.org/D14558 llvm-svn: 252916
* Add inline stack streaming to binary sample profiles.Diego Novillo2015-10-092-0/+50
| | | | | | | | | | | | 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-082-0/+29
| | | | | | | | | | | | | 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-082-24/+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-082-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* InstrProf: Give coverage its own errors instead of piggy backing on instrprofJustin Bogner2015-05-061-1/+1
| | | | | | | | | | | | Since the coverage mapping reader and the instrprof reader were emitting a shared set of error codes, the error messages you'd get back from llvm-cov were ambiguous about what was actually wrong. Add another error category to fix this. I've also improved the wording on a couple of the instrprof errors, for consistency. llvm-svn: 236665
* InstrProf: Allow hexadecimal function hashes in proftext formatJustin Bogner2015-03-091-2/+10
| | | | llvm-svn: 231685
* Add show and merge tools for sample PGO profiles.Diego Novillo2014-11-012-0/+42
| | | | | | | | | | | | | | | | | | | | | 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
* llvm-profdata: Avoid undefined behaviour when reading raw profilesJustin Bogner2014-09-121-2/+0
| | | | | | | | | | 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
* InstrProf: Allow multiple functions with the same nameJustin Bogner2014-08-013-2/+69
| | | | | | | | | | | | | | | | | | | | | | | 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-015-55/+56
| | | | llvm-svn: 214548
* llvm-profdata: Add a test for mismatched numbers of countersJustin Bogner2014-07-301-0/+40
| | | | llvm-svn: 214360
* llvm-profdata: Use consistent file suffixes in testsJustin Bogner2014-07-3019-23/+23
| | | | | | | | | | | 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
* llvm-profdata: Clean up and reorganize some testsJustin Bogner2014-07-296-10/+32
| | | | | | | | This moves some tests around to make it clearer what's being tested, and adds very rudimentary comment syntax to the text input format to make specifying this kind of test a little bit simpler. llvm-svn: 214235
* ProfileData: Allow multiple profiles in RawInstrProfReaderJustin Bogner2014-05-161-0/+64
| | | | | | | | | | | | | | | | | | | Allow multiple raw profiles to coexist in a single .profraw file, given the following conditions: - Zero padding at the end of or between profiles will be skipped. - Each profile must start with a valid header. - Mixing endianness or pointer sizes in concatenated profiles files is not allowed. This is needed to handle cases where a program's shared libraries are profiled as well as the main executable itself, as we'll need to emit each executable's counters. Combining the tables in the runtime would be expensive for the instrumented program. rdar://16918688 llvm-svn: 208938
* ProfileData: Treat missing function counts as malformedJustin Bogner2014-04-252-0/+6
| | | | llvm-svn: 207172
* llvm-profdata: Avoid writing to /dev/null in testsJustin Bogner2014-04-181-10/+4
| | | | | | | We fseek on our output file in llvm-profdata, which errors on some systems. Avoid getting into the situation by writing to /dev/null llvm-svn: 206670
* test: Add extra run lines to investigate an error on the botsJustin Bogner2014-04-181-0/+6
| | | | llvm-svn: 206668
* ProfileData: Add support for the indexed instrprof formatJustin Bogner2014-04-182-11/+20
| | | | | | | | This adds support for an indexed instrumentation based profiling format, which is just a small header and an on disk hash table. This format will be used by clang's -fprofile-instr-use= for PGO. llvm-svn: 206656
* llvm-profdata: Check for bad data in the show commandJustin Bogner2014-03-231-0/+2
| | | | llvm-svn: 204573
* InstrProf: Check pointer size in raw profileDuncan P. N. Exon Smith2014-03-234-0/+168
| | | | | | | | | | | | | | | Since the profile can come from 32-bit machines, we need to check the pointer size. Change the magic number to facilitate this. Adds tests for reading 32-bit and 64-bit binaries (both big- and little-endian). The tests write a binary using printf in RUN lines (like raw-magic-but-no-header.test). Assuming the bots don't complain, this seems like a better way forward for testing RawInstrProfReader than committing binary files. <rdar://problem/16400648> llvm-svn: 204557
* llvm-profdata: Don't pipe stderr into show for the testsJustin Bogner2014-03-221-9/+9
| | | | | | | | Some text shows up on stderr when using guard malloc, and this test was trying to treat that as input to llvm-profdata show. There's no reason to pipe stderr into show at all here. llvm-svn: 204549
* InstrProf: Cleanup binary profdata testcaseDuncan P. N. Exon Smith2014-03-214-165/+24
| | | | | | | | | | Cleanup the current binary testcase for profile data. - Rename it to something more specific. - Remove the text comparison. - Check the output of llvm-profdata show. llvm-svn: 204518
* InstrProf: Change magic number to have non-text charactersDuncan P. N. Exon Smith2014-03-212-2/+2
| | | | | | | | | Include non-text characters in the magic number so that text files can't match. <rdar://problem/15950346> llvm-svn: 204513
* InstrProf: Actually detect bad headersDuncan P. N. Exon Smith2014-03-211-0/+6
| | | | | | <rdar://problem/15950346> llvm-svn: 204510
* InstrProf: Read raw binary profile in llvm-profdataDuncan P. N. Exon Smith2014-03-213-0/+165
| | | | | | | | | | | | | | Read a raw binary profile that corresponds to a memory dump from the runtime profile. The test is a binary file generated from cfe/trunk/test/Profile/c-general.c with the new compiler-rt runtime and the matching text version of the input. It includes instructions on how to regenerate. <rdar://problem/15950346> llvm-svn: 204496
* ProfileData: Introduce InstrProfWriter using the naive text formatJustin Bogner2014-03-212-45/+72
| | | | | | | | | | | This isn't a format we'll want to write out in practice, but moving it to the writer library simplifies llvm-profdata and isolates it from further changes to the format. This also allows us to update the tests to not rely on the text output format. llvm-svn: 204489
* ProfileData: Introduce the InstrProfReader interface and a text readerJustin Bogner2014-03-211-6/+6
| | | | | | | | | | This introduces the ProfileData library and updates llvm-profdata to use this library for reading profiles. InstrProfReader is an abstract base class that will be subclassed for both the raw instrprof data from compiler-rt and the efficient instrprof format that will be used for PGO. llvm-svn: 204482
* llvm-profdata: Make "merge" into a subcommand.Justin Bogner2014-03-192-14/+14
| | | | | | We'll be adding a few more subcommands in the near future. llvm-svn: 204211
* llvm-profdata: Update to use the naive text format with function hashJustin Bogner2014-03-1914-25/+53
| | | | | | This also uses line_iterator to simplify the parsing logic. llvm-svn: 204210
* Back out Profile library and dependent commitsJustin Bogner2014-03-1225-150/+77
| | | | | | | | | Chandler voiced some concern with checking this in without some discussion first. Reverting for now. This reverts r203703, r203704, r203708, and 203709. llvm-svn: 203723
* llvm-profdata: Use the Profile library, implement show and generateJustin Bogner2014-03-1225-77/+150
| | | | | | | | This replaces the llvm-profdata tool with a version that uses the recently introduced Profile library. The new tool has the ability to generate and summarize profdata files as well as merging them. llvm-svn: 203704
* PGO: llvm-profdata: tool for merging profilesDuncan P. N. Exon Smith2014-02-1715-0/+96
Introducing llvm-profdata, a tool for merging profile data generated by PGO instrumentation in clang. - The name indicates a file extension of <name>.profdata. Eventually profile data output by clang should be changed to that extension. - llvm-profdata merges two profiles. However, the name is more general, since it will likely pick up more tasks (such as summarizing a single profile). - llvm-profdata parses the current text-based format, but will be updated once we settle on a binary format. <rdar://problem/15949645> llvm-svn: 201535
OpenPOWER on IntegriCloud