summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfilingValue.c
Commit message (Collapse)AuthorAgeFilesLines
* [InstrProf] Implement static profdata registrationReid Kleckner2019-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The motivating use case is eliminating duplicate profile data registered for the same inline function in two object files. Before this change, users would observe multiple symbol definition errors with VC link, but links with LLD would succeed. Users (Mozilla) have reported that PGO works well with clang-cl and LLD, but when using LLD without this static registration, we would get into a "relocation against a discarded section" situation. I'm not sure what happens in that situation, but I suspect that duplicate, unused profile information was retained. If so, this change will reduce the size of such binaries with LLD. Now, Windows uses static registration and is in line with all the other platforms. Reviewers: davidxl, wmi, inglorion, void, calixte Subscribers: mgorny, krytarowski, eraman, fedor.sergeev, hiraditya, #sanitizers, dmajor, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D57929 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353547 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Remove unused formal parameters from allocateOneNode. NFC.Matt Davis2018-10-091-3/+2
| | | | | | | | | | | | | | Summary: This is just a minor cleanup to the allocateOneNode interface. The formals are no-longer used, so I just removed them. Reviewers: davidxl, void Reviewed By: davidxl Subscribers: dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D52509 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344073 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Fix value profile runtime merging issuesRong Xu2018-04-021-9/+24
| | | | | | | | | | | | | | | | | This patch fixes the following issues: (1) The strong definition of the merge hook function was not working which breaks the online value profile merging. This patch removes the weak attribute of VPMergeHook and assigns the value dynamically. (2) Truncate the proifle file so that we don't have garbage data at the end of the file. (3) Add new __llvm_profile_instrument_target_value() interface to do the value profile update in batch. This is needed as the original incremental by 1 in __llvm_profile_instrument_target() is too slow for online merge. Differential Revision: https://reviews.llvm.org/D44847 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328987 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Port the runtime to Solaris (retry)Vedant Kumar2017-12-141-3/+5
| | | | | | | | | | | | | This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Hopefully the Windows support is fixed now. Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320731 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "(HEAD -> master, origin/master, origin/HEAD) [profile] Port the ↵Vedant Kumar2017-12-141-5/+3
| | | | | | | | | | | runtime to Solaris" This reverts commit r320726. It looks like flock isn't available on Windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21317/steps/build%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320728 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Port the runtime to SolarisVedant Kumar2017-12-141-3/+5
| | | | | | | | | | | This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320726 91177308-0d34-0410-b5e6-96231b3b80d8
* Change INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE from 8 to 16.Dehao Chen2017-07-281-1/+1
| | | | | | | | | | | | | | Summary: In the current implementation, the defaul number of values per site tracked by value profiler is 8, which is too small and could introduce inaccuracies to profile. Changing it to 16 will be able to gain more accurate value profiler. Reviewers: davidxl, tejohnson Reviewed By: tejohnson Subscribers: sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D35964 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309388 91177308-0d34-0410-b5e6-96231b3b80d8
* [PGO] Value profile support for value rangesRong Xu2017-03-151-0/+29
| | | | | | | | | | This patch adds profile run time support to profile a range of values. This interface will be used in profiling the size of memory intrinsic calls. Differential Revision: http://reviews.llvm.org/D28964 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297895 91177308-0d34-0410-b5e6-96231b3b80d8
* [Profile] Fix value profiler eviction bugXinliang David Li2016-11-291-1/+1
| | | | | | | | Differential Revision: https://reviews.llvm.org/D27224 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288204 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix most MSVC warnings in compiler-rt profiling libraryReid Kleckner2016-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here's the warnings and how they were fixed: - InstrProfilingUtil.c(110): warning C4013: '_open_osfhandle' undefined; assuming extern returning int Include io.h to get the prototype. - warning C4005: 'FILE_MAP_EXECUTE': macro redefinition Stop trying to support pre-XP versions of Windows, don't attempt to define this macro. - InstrProfilingWriter.c(271): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Header' - InstrProfilingWriter.c(275): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Zeroes' Turn this warning off. This is definitely legal in C++, all compilers accept it, and I only have room for half of one language standard in my brain. - InstrProfilingValue.c(320): warning C4113: 'uint32_t (__cdecl *)()' differs in parameter lists from 'uint32_t (__cdecl *)(void)' Fix this with an explicit (void) in the prototype. - InstrProfilingMerge.c.obj : warning LNK4006: _VPMergeHook already defined in InstrProfilingMergeFile.c.obj; second definition ignored Last remaining warning. This is from linking a selectany definition with a strong definition. We need to sort out weak symbols in compiler-rt in general, though. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273026 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Fix PR/27917Xinliang David Li2016-05-311-3/+4
| | | | | | | | Skip the last (possibly) incomplete node from padding bytes. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271349 91177308-0d34-0410-b5e6-96231b3b80d8
* Local var name change /NFCXinliang David Li2016-05-311-19/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271304 91177308-0d34-0410-b5e6-96231b3b80d8
* Add portable macro in common headerXinliang David Li2016-05-261-6/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270928 91177308-0d34-0410-b5e6-96231b3b80d8
* Add segment prefix for darwinXinliang David Li2016-05-261-1/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270875 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix windows bot failureXinliang David Li2016-05-261-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270864 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] pre-allocate a small counter set in profile runtimeXinliang David Li2016-05-261-18/+23
| | | | | | | | | | Tested with relavant benchmarks in SPEC2006 Differential Revision: http://reviews.llvm.org/D20651 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270862 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Add early checking to bypass node pointer updateXinliang David Li2016-05-251-3/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270766 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Don't return `Node` when it is null.Sean Silva2016-05-251-5/+7
| | | | | | | | | The max warning check was masking the "return 0" codepath. See the thread "Warnings and compile-time failure on 458.sjeng" for more info. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270762 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] clean up runtime warnings.Xinliang David Li2016-05-231-3/+7
| | | | | | | | | | | o make warning message more meaningful to users. o add suggestion to fix the problem o limit the max number of output. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270483 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] initialize static pool properly Xinliang David Li2016-05-221-10/+9
| | | | | | | | | | | Remove dependency on runtime initializer to avoid issues related to initialization order. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270371 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Static counter allocation for value profiling (part-2)Xinliang David Li2016-05-211-10/+37
| | | | | | | | Differential Revision: http://reviews.llvm.org/D20460 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270337 91177308-0d34-0410-b5e6-96231b3b80d8
* Use C-style comment.Sean Silva2016-05-201-1/+1
| | | | | | | I think we allow use of C99 for libprofile, but use a C-style comment for consistency. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270187 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #include for PS4 getenv shim.Sean Silva2016-05-201-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270179 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] entry eviction support in value profilerXinliang David Li2016-05-191-1/+45
| | | | | | | | Differential revision: http://reviews.llvm.org/D20408 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270141 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Allow max vals per site to be controllable at runtimeXinliang David Li2016-05-181-1/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269993 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] minor code restructuring /NFCXinliang David Li2016-05-161-5/+6
| | | | | | | | | This is one of the enabler patch to allow value profiler to allocate counter statically. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269689 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Eliminate dynamic memory allocation for vp writingXinliang David Li2016-05-141-105/+78
| | | | | | | | | | | | This is part-3 of the effort to eliminate dependency on libc allocator in instr profiler runtime. With this change, the profile dumper is completely free of malloc/calloc. Value profile instr API implementation is the only remaining piece with calloc dependency. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269576 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Code refactoringXinliang David Li2016-05-121-0/+112
| | | | | | | | | Move runtime specific code from the common header file to runtime source. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269357 91177308-0d34-0410-b5e6-96231b3b80d8
* cleanup: Enforce caller to set total size to avoid redundant size computeXinliang David Li2016-05-111-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269237 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r268840: [profile] Simplify value profile writingXinliang David Li2016-05-101-43/+13
| | | | | | | | | | Revert r268864 that reverted 268840 after underlying problem is fixed for arm bot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268992 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[profile] Simplify value profile writing"Renato Golin2016-05-071-13/+43
| | | | | | | | This reverts commit r268840, as it breaks Thumb2 self-hosting. There is something unstable in the profiling for Thumb2 that needs to be sorted out before we continue implementing these changes to the profiler. See PR27667. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268864 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Simplify value profile writingXinliang David Li2016-05-071-43/+13
| | | | | | | | | | | With this patch, value data are longer pre-collected before writing. The code is simplified and requires less heap space for dumping. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268840 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor cleanupXinliang David Li2016-03-061-12/+0
| | | | | | | | move a function def to InstrProfilingUtil.c git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262785 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Compute number of data entries correctlyVedant Kumar2016-02-261-2/+2
| | | | | | | | | | | | | | | | Compiler-rt miscalculates the number of entries in the __llvm_prf_data section on i386 Darwin. This results in a number of test failures (which we started catching after r261344). The fix we attempted earlier is insufficient (r261683). It caused some tests to start passing again, but that hid the fact that we drop some data entries. This patch should fix the real problem. It fixes the way we compute DataSize by taking into account the way the Darwin linker lays out __llvm_prf_data. Differential Revision: http://reviews.llvm.org/D17623 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261957 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Fix iteration over profile data entriesVedant Kumar2016-02-231-1/+1
| | | | | | | | | | | | | | Fix a crash when gathering value profile data on i386 Darwin. The Darwin linker shrinks sections containing aligned structures when padding is not explicitly added to the end of the structure. When iterating over these structures, be sure to not walk past the end of the section. No tests added, since running `ninja check-profile` on i386 Darwin is enough to reproduce the original crash. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261683 91177308-0d34-0410-b5e6-96231b3b80d8
* [PGO] Use new macro introduced/NFCXinliang David Li2016-01-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257147 91177308-0d34-0410-b5e6-96231b3b80d8
* [PGO]: Do not update Data->Value field during profile write.Xinliang David Li2015-12-291-91/+33
| | | | | | | | | | | The profile reader no longer depends on this field to be updated and point to owning func's vp data. The VP data also no longer needs to be allocated in a contiguous memory space. Differential Revision: http://reviews.llvm.org/D15258 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256543 91177308-0d34-0410-b5e6-96231b3b80d8
* [PGO] cleanup: unify prefix for portability macrosXinliang David Li2015-12-161-9/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255748 91177308-0d34-0410-b5e6-96231b3b80d8
* [PGO] Split value profiling runtime into its own fileXinliang David Li2015-12-101-0/+237
Value profile runtime depends on libc which breaks buffer API implemenation with current file organization. Test case is also updated to check more symbols. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255294 91177308-0d34-0410-b5e6-96231b3b80d8