summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/InstrProf.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [PGO] Add interfaces to annotate instr with VP dataXinliang David Li2016-02-041-0/+87
| | | | | | | Add interfaces to do value profile data IR annnotation and read. Needed by both FE and IR based PGO. llvm-svn: 259813
* [PGO] Profile interface cleanupXinliang David Li2016-02-041-4/+3
| | | | | | | - Remove unused valuemapper parameter - add totalcount optional parameter llvm-svn: 259756
* Fix uninitiazed variable use problemXinliang David Li2016-02-031-1/+1
| | | | llvm-svn: 259630
* [PGO] Profile summary reader/writer supportXinliang David Li2016-02-031-0/+15
| | | | | | | | | | With this patch, the profile summary data will be available in indexed profile data file so that profiler reader/compiler optimizer can start to make use of. Differential Revision: http://reviews.llvm.org/D16258 llvm-svn: 259626
* [PGO] allow pgo name collector to disable compression (for testing)/NFCXinliang David Li2016-01-261-2/+3
| | | | llvm-svn: 258876
* Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; ↵Eugene Zelenko2016-01-261-5/+4
| | | | | | | | other minor fixes. Differential revision: reviews.llvm.org/D16568 llvm-svn: 258831
* [PGO] Add a new interface to be used by Indirect Call PromotionXinliang David Li2016-01-201-0/+7
| | | | llvm-svn: 258271
* [PGO] Move profile summary interface/impl into InstrProf.[*] /NFCXinliang David Li2016-01-141-0/+35
| | | | llvm-svn: 257819
* [Support] Add saturating multiply-add support functionNathan Slingerland2016-01-121-14/+3
| | | | | | | | | | | | Summary: Add SaturatingMultiplyAdd convenience function template since A + (X * Y) comes up frequently when doing weighted arithmetic. Reviewers: davidxl, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15385 llvm-svn: 257532
* [PGO] Fix a bug in InstProfWriter addRecordXinliang David Li2016-01-081-5/+40
| | | | | | | | | | For a new record with weight != 1, only edge profiling counters are scaled, VP data is not properly scaled. This patch refactors the code and fixes the problem. Also added sort by count interface (for follow up patch). llvm-svn: 257143
* [PGO] Simplify string parsingXinliang David Li2016-01-041-13/+3
| | | | | | Patch Suggested by Vedant. llvm-svn: 256785
* [PGO] Refactor string writer codeXinliang David Li2016-01-041-12/+18
| | | | | | | For readability and code sharing. (Adapted from Suggestions by Vedant). llvm-svn: 256784
* [PGO]: Use efficient 'join' API for uncompressed stringXinliang David Li2016-01-041-13/+5
| | | | llvm-svn: 256781
* [PGO]: reserve space for string to avoid excessive memory realloc/copy (non ↵Xinliang David Li2016-01-041-0/+6
| | | | | | linear) llvm-svn: 256776
* [PGO] simple refactoring (NFC)Xinliang David Li2016-01-031-4/+8
| | | | llvm-svn: 256695
* [PGO]: Implement Func PGO name string compressionXinliang David Li2015-12-311-2/+99
| | | | | | | | | | This is part of the effort/prepration to reduce the size instr-pgo (object, binary, memory footprint, and raw data). The functionality is currently off by default and not yet used by any clients. llvm-svn: 256667
* [PGO] Improve Indexed Profile Reader efficiency Xinliang David Li2015-12-201-31/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Minor clean up -- move large single use method out of header(NFC)Xinliang David Li2015-12-201-0/+31
| | | | llvm-svn: 256113
* [PGO] Cleanup: Move large member functions out of line (NFC)Xinliang David Li2015-12-181-2/+91
| | | | llvm-svn: 256058
* [PGO] Simplify computehash interface (NFC)Xinliang David Li2015-12-181-2/+1
| | | | llvm-svn: 256047
* Initialize all bytes in vp data (msan error)Xinliang David Li2015-12-151-4/+5
| | | | llvm-svn: 255680
* Coverage code refactoring /NFCXinliang David Li2015-12-151-0/+9
| | | | llvm-svn: 255670
* [PGO] Stop using invalid char in instr variable names.Xinliang David Li2015-12-121-1/+21
| | | | | | | | | | | | | 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 is the second try. The fix in this patch is very localized. Only profile symbol names of profile symbols with internal linkage are fixed up while initializer of name syms are not changes. This means there is no format change nor version bump. llvm-svn: 255434
* [PGO] Revert r255365: solution incomplete, not handling lambda yetXinliang David Li2015-12-111-5/+4
| | | | llvm-svn: 255369
* [PGO] Stop using invalid char in instr variable names.Xinliang David Li2015-12-111-4/+5
| | | | | | | | | | | | | | 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
* [PGO] Add version to getPGOFuncName methodXinliang David Li2015-12-051-3/+5
| | | | | | | | | Different version of indexed format may use different name uniquing schemes for static functions. Pass the version info to the name interface so that different schmes can be picked (for profile lookup). llvm-svn: 254838
* 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
* [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] Move value profile data definitions out of IndexedInstrProfXinliang David Li2015-11-171-5/+2
| | | | | | | 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
* 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
* [llvm-profdata] Add check for text profile formats and improve error ↵Nathan Slingerland2015-11-131-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-121-7/+5
| | | | llvm-svn: 252921
* [llvm-profdata] Add check for text profile formats and improve error reportingNathan Slingerland2015-11-121-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
OpenPOWER on IntegriCloud