summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-profdata] Add support for weighted merge of profile dataNathan Slingerland2015-12-041-2/+12
| | | | | | | | | | | | | | | | | | 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
* [llvm-profdata] Change instr prof counter overflow to saturate rather than ↵Nathan Slingerland2015-12-021-5/+6
| | | | | | | | | | | | | | 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 support for reading multiple versions of indexed profile format ↵Xinliang David Li2015-12-011-22/+27
| | | | | | | | | | | profile data Profile readers using incompatible on-disk hash table format can now share the same implementation and interfaces. Differential Revision: http://reviews.llvm.org/D15100 llvm-svn: 254458
* Use nullptr (NFC)Xinliang David Li2015-12-011-1/+1
| | | | llvm-svn: 254447
* [PGO] Move value profile format related structures and APIs to common fileXinliang David Li2015-11-281-177/+4
| | | | | | | | | | This is the last step to enable profile runtime to share the same value prof data format and reader/writer code with llvm host tools. The VP related data structures are moved to a section in InstrProfData.inc enabled with macro INSTR_PROF_VALUE_PROF_DATA, and common API implementations are enabled with INSTR_PROF_COMMON_API_IMPL. There should be no functional change. llvm-svn: 254235
* [PGO] Add return code for vp rt record init routine to indicate error conditionXinliang David Li2015-11-281-3/+6
| | | | llvm-svn: 254220
* [PGO] Allow value profile writer interface to allocated target buffer Xinliang David Li2015-11-281-9/+13
| | | | | | | | | Raw profile writer needs to write all data of one kind in one continuous block, so the buffer needs to be pre-allocated and passed to the writer method in pieces for function profile data. The change adds the support for raw value data writing. llvm-svn: 254219
* Function name cleanup (NFC)Xinliang David Li2015-11-281-4/+4
| | | | llvm-svn: 254218
* [PGO] Extract VP data integrity check code into a helper function (NFC)Xinliang David Li2015-11-281-17/+21
| | | | llvm-svn: 254217
* [PGO] Implement ValueProfiling Closure interfaces for runtime value profile dataXinliang David Li2015-11-251-3/+119
| | | | | | | | | | | | | | | | This is one of the many steps to commonize value profiling support between profile runtime and compiler/llvm tools. After this change, profiler runtime now can share the same C APIs to do VP serialization/deseriazation with LLVM host tools (and produces value data in identical format between indexed and raw profile). It is not yet enabled in profiler runtime yet. Also added a unit test case to test runtime profile data serialization/deserialization interfaces implemented using common closure code. llvm-svn: 254110
* [PGO] Regroup functions in better order (NFC)Xinliang David Li2015-11-251-93/+96
| | | | llvm-svn: 254080
* [PGO] Convert InstrProfRecord based serialization methods to use common C ↵Xinliang David Li2015-11-251-35/+97
| | | | | | | | | | | | | | | | methods 1. Convert serialization methods using InstrProfRecord as source into C (impl) interfaces using Closure. 2. Reimplement InstrProfRecord serialization method to use new C interface as dummy wrapper. Now it is ready to implement wrapper for runtime value profile data. (The new code need better source location -- but not changed in this patch to minimize diffs. ) llvm-svn: 254057
* [PGO] convert a subset of C++ interfaces into C (for sharing) (NFC)Xinliang David Li2015-11-251-28/+10
| | | | llvm-svn: 254056
* Move member functions closer to others of the same class (NFC)Xinliang David Li2015-11-251-14/+16
| | | | llvm-svn: 254055
* Fix function naming (NFC)Xinliang David Li2015-11-251-2/+2
| | | | llvm-svn: 254045
* [PGO] Add mapper callback to interfaces retrieving value data for site (NFC)Xinliang David Li2015-11-241-11/+13
| | | | | | | This allows cleaner implementation and merging retrieving/mapping in one pass. llvm-svn: 254038
* [PGO] Small interface change to be profile rt ready Xinliang David Li2015-11-241-17/+3
| | | | | | | | Convert two C++ static member functions to be C APIs. This is one of the many steps to get ready to share VP writer code with profiler runtime. llvm-svn: 253999
* Minor refactor to make VP writing more efficientXinliang David Li2015-11-241-3/+1
| | | | llvm-svn: 253994
* [PGO] In llvm-profdata text dump, add comment lines as annotationsXinliang David Li2015-11-231-1/+4
| | | | llvm-svn: 253930
* [PGO] Add --text option for llvm-profdata show|merge commandsXinliang David Li2015-11-231-0/+15
| | | | | | | | | | | | | | 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
* Fix the Windows build, include <tuple> for std::tieReid Kleckner2015-11-201-0/+1
| | | | llvm-svn: 253698
* [llvm-profdata] Add merge() to InstrProfRecordNathan Slingerland2015-11-201-36/+18
| | | | | | | | | | | | | | | | | Summary: This change refactors two aspects of InstrProfRecord: 1) Add a merge() method to InstrProfRecord (previously InstrProfWriter combineInstrProfRecords()) in order to better encapsulate this functionality and to make the InstrProfRecord and SampleRecord APIs more consistent. 2) Make InstrProfRecord mergeValueProfData() a private method since it is only ever called internally by merge(). Reviewers: dnovillo, bogner, davidxl Subscribers: silvas, vsk, llvm-commits Differential Revision: http://reviews.llvm.org/D14786 llvm-svn: 253695
* SamplePGO - Tweak debugging output for function samples. NFC.Diego Novillo2015-11-191-9/+24
| | | | llvm-svn: 253612
* SamplePGO - Sort samples by source location when emitting as text.Diego Novillo2015-11-192-12/+18
| | | | | | | | 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
* Minor cleanups (from review feedback)Xinliang David Li2015-11-181-2/+4
| | | | | | | | 1. remove uneeded header inclusion 2. use reinterpret_cast instead of c ctyle 3. other format change llvm-svn: 253515
* [PGO] Value profiling supportBetul Buyukkurt2015-11-181-7/+76
| | | | | | | | | 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
* [PGO] Move value profile data definitions out of IndexedInstrProfXinliang David Li2015-11-173-11/+7
| | | | | | | Move the data structure defintions out of the namespace. The defs will be shared by raw format. [NFC] llvm-svn: 253394
* [llvm-profdata] Improve error messaging when merging mismatched profile dataNathan Slingerland2015-11-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 - Move debug/dump function bodies out of header files. NFC.Diego Novillo2015-11-171-0/+43
| | | | | | No point polluting the header declarations with debugging code. llvm-svn: 253361
* Fix unaligned memory read issue exposed by ubsanXinliang David Li2015-11-171-10/+10
| | | | | | | | | | Indexed profile data as designed today does not guarantee counter data to be well aligned, so reading needs to use the slower form (with memcpy). This is less than ideal and should be improved in the future (i.e., with fixed length function key instead of variable length name key). llvm-svn: 253309
* SamplePGO - Add dump routines for LineLocation, SampleRecord and FunctionSamplesDiego Novillo2015-11-133-21/+24
| | | | llvm-svn: 253071
* [llvm-profdata] Add check for text profile formats and improve error ↵Nathan Slingerland2015-11-134-11/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-124-42/+11
| | | | llvm-svn: 252921
* [llvm-profdata] Add check for text profile formats and improve error reportingNathan Slingerland2015-11-124-11/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* SamplePGO - Move FunctionSamples::print() to a better location. NFC.Diego Novillo2015-11-122-31/+32
| | | | | | | The class is declared in SampleProf.h, so a better home for this is SampleProf.cpp. llvm-svn: 252915
* Fix problems in coding styleXinliang David Li2015-11-121-13/+23
| | | | llvm-svn: 252829
* unique_ptrify the AllocValueProfData helper function introduced in r252783David Blaikie2015-11-111-6/+5
| | | | llvm-svn: 252799
* Refactoring and fix another instance of asan errorXinliang David Li2015-11-111-5/+10
| | | | llvm-svn: 252783
* Silencing a signed vs unsigned type mismatch warning.Aaron Ballman2015-11-111-1/+1
| | | | llvm-svn: 252732
* Fix asan warning (NFC)Xinliang David Li2015-11-101-2/+3
| | | | llvm-svn: 252617
* [PGO] Make indexed value profile data more compactXinliang David Li2015-11-103-84/+248
| | | | | | | | | | | | | | | | - Make indexed value profile data more compact by peeling out the per-site value count field into its own smaller sized array. - Introduced formal data structure definitions to specify value profile data layout in indexed format. Previously the layout of the data is only assumed in the client code (scattered in three different places : size computation, EmitData, and ReadData - The new data structure serves as a central place for layout documentation. - Add interfaces to force BE output for value profile data (testing purpose) - Add byte swap unit tests Differential Revision: http://reviews.llvm.org/D14401 llvm-svn: 252563
* [PGO] Instr func name var creation code refactoringXinliang David Li2015-11-091-0/+66
| | | | | | | Move the code from cfe to LLMV and become shared interfaces. There is no functional change. llvm-svn: 252433
* Code style fix (caused by wrongly default clang-format style) (NFC)Xinliang David Li2015-11-062-10/+17
| | | | llvm-svn: 252276
* [PGO] Use template file to define runtime structuresXinliang David Li2015-11-051-6/+9
| | | | | | | | | | | With this change, instrumentation code and reader/write code related to profile data structs are kept strictly in-sync. THis will be extended to cfe and compile-rt references as well. Differential Revision: http://reviews.llvm.org/D13843 llvm-svn: 252113
* [PGO] Value profiling (index format) code cleanup and testingXinliang David Li2015-11-022-75/+58
| | | | | | | | | | | | | | | | | 1. Added a set of public interfaces in InstrProfRecord class to access (read/write) value profile data. 2. Changed IndexedProfile reader and writer code to use the newly defined interfaces and hide implementation details. 3. Added a couple of unittests for value profiling: - Test new interfaces to get and set value profile data - Test value profile data merging with various scenarios. No functional change is expected. The new interfaces will also make it possible to change on-disk format of value prof data to be more compact (to be submitted). llvm-svn: 251771
* [PGO] RawProf Reader code cleanupXinliang David Li2015-10-281-16/+42
| | | | | | | | | Add a couple of helper methods to make the primary raw profile reader interface's implementation more readable. It also hides more format details. This patch has no functional change. llvm-svn: 251546
* [PGO] Indexed Prof Reader refactoring (NFC)Xinliang David Li2015-10-281-36/+58
| | | | | | | | | | Change InstrProfReaderIndex from typedef into a wrapper class with helper methods. This makes the index profile reader code more readable. It also hides the implementation detail of the index format and make it more flexible to allow support different (or more than one) format in the future. llvm-svn: 251491
* Add helper functions and remove hard coded references to instProf related ↵Xinliang David Li2015-10-221-2/+3
| | | | | | | | | | | | name/name-prefixes This is a clean up patch that defines instr prof section and variable name prefixes in a common header with access helper functions. clang FE change will be done as a follow up once this patch is in. Differential Revision: http://reviews.llvm.org/D13919 llvm-svn: 251058
* Tolerate negative offset when matching sample profile.Dehao Chen2015-10-211-1/+11
| | | | | | | | In some cases (as illustrated in the unittest), lineno can be less than the heade_lineno because the function body are included from some other files. In this case, offset will be negative. This patch makes clang still able to match the profile to IR in this situation. http://reviews.llvm.org/D13914 llvm-svn: 250873
* Minor Instr PGO code restructuringXinliang David Li2015-10-183-115/+42
| | | | | | | | | | | | | | | | 1. Key constant values (version, magic) and data structures related to raw and indexed profile format are moved into one centralized file: InstrProf.h. 2. Utility function such as MD5Hash computation is also moved to the common header to allow sharing with other components in the future. 3. A header data structure is introduced for Indexed format so that the reader and writer can always be in sync. 4. Added some comments to document different places where multiple definition of the data structure must be kept in sync (reader/writer, runtime, lowering etc). No functional change is intended. Differential Revision: http://reviews.llvm.org/D13758 llvm-svn: 250638
OpenPOWER on IntegriCloud