summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Target, Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-01-181-15/+38
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 292320
* Resubmit "[PGO] Turn off comdat renaming in IR PGO by default"Rong Xu2017-01-111-1/+15
| | | | | | This patch resubmits the changes in r291588. llvm-svn: 291696
* Revert "[PGO] Turn off comdat renaming in IR PGO by default"Rong Xu2017-01-101-15/+1
| | | | | | | This patch reverts r291588: [PGO] Turn off comdat renaming in IR PGO by default, as we are seeing some hash mismatches in our internal tests. llvm-svn: 291621
* [PGO] Turn off comdat renaming in IR PGO by defaultRong Xu2017-01-101-1/+15
| | | | | | | | | | | | | | | | | | | | | | | Summary: In IR PGO we append the function hash to comdat functions to avoid the potential hash mismatch. This turns out not legal in some cases: if the comdat function is address-taken and used in comparison. Renaming changes the semantic. This patch turns off comdat renaming by default. To alleviate the hash mismatch issue, we now rename the profile variable for comdat functions. Profile allows co-existing multiple versions of profiles with different hash value. The inlined copy will always has the correct profile counter. The out-of-line copy might not have the correct count. But we will not have the bogus mismatch warning. Reviewers: davidxl Subscribers: llvm-commits, xur Differential Revision: https://reviews.llvm.org/D28416 llvm-svn: 291588
* [InstrProfiling] Mark __llvm_profile_instrument_target last parameter as i32 ↵Marcin Koscielnicki2016-11-211-11/+30
| | | | | | | | | | | | | | | | | zeroext if appropriate. On some architectures (s390x, ppc64, sparc64, mips), C-level int is passed as i32 signext instead of plain i32. Likewise, unsigned int may be passed as i32, i32 signext, or i32 zeroext depending on the platform. Mark __llvm_profile_instrument_target properly (its last parameter is unsigned int). This (together with the clang change) makes compiler-rt profile testsuite pass on s390x. Differential Revision: http://reviews.llvm.org/D21736 llvm-svn: 287534
* Utility functions for appending to llvm.used/llvm.compiler.used.Evgeniy Stepanov2016-10-251-25/+2
| | | | llvm-svn: 285143
* Use StringRef in Pass/PassManager APIs (NFC)Mehdi Amini2016-10-011-1/+1
| | | | llvm-svn: 283004
* [Profile] code refactoring: make getStep a method in base classXinliang David Li2016-09-201-9/+1
| | | | llvm-svn: 282002
* [Profile] Implement select instruction instrumentation in IR PGOXinliang David Li2016-09-181-2/+18
| | | | | | Differential Revision: http://reviews.llvm.org/D23727 llvm-svn: 281858
* Consistently use ModuleAnalysisManagerSean Silva2016-08-091-1/+1
| | | | | | | | | | | Besides a general consistently benefit, the extra layer of indirection allows the mechanical part of https://reviews.llvm.org/D23256 that requires touching every transformation and analysis to be factored out cleanly. Thanks to David for the suggestion. llvm-svn: 278078
* [Profile] deprecate __llvm_profile_override_default_filenameXinliang David Li2016-07-211-16/+16
| | | | | | | | This eliminates unncessary calls and init functions. Differential Revision: http://reviews.llvm.org/D22613 llvm-svn: 276354
* [PGO] Make needsComdatForCounter() available (NFC)Rong Xu2016-07-211-27/+0
| | | | | | | | | | Move needsComdatForCounter() to lib/ProfileData/InstrProf.cpp from lib/Transforms/Instrumentation/InstrProfiling.cpp to make is available for other files. Differential Revision: https://reviews.llvm.org/D22643 llvm-svn: 276330
* Avoid a string copy, NFCVedant Kumar2016-07-211-1/+1
| | | | llvm-svn: 276310
* clang format change /NFCXinliang David Li2016-06-211-28/+34
| | | | llvm-svn: 273233
* IR: Introduce local_unnamed_addr attribute.Peter Collingbourne2016-06-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a local_unnamed_addr attribute is attached to a global, the address is known to be insignificant within the module. It is distinct from the existing unnamed_addr attribute in that it only describes a local property of the module rather than a global property of the symbol. This attribute is intended to be used by the code generator and LTO to allow the linker to decide whether the global needs to be in the symbol table. It is possible to exclude a global from the symbol table if three things are true: - This attribute is present on every instance of the global (which means that the normal rule that the global must have a unique address can be broken without being observable by the program by performing comparisons against the global's address) - The global has linkonce_odr linkage (which means that each linkage unit must have its own copy of the global if it requires one, and the copy in each linkage unit must be the same) - It is a constant or a function (which means that the program cannot observe that the unique-address rule has been broken by writing to the global) Although this attribute could in principle be computed from the module contents, LTO clients (i.e. linkers) will normally need to be able to compute this property as part of symbol resolution, and it would be inefficient to materialize every module just to compute it. See: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/356401.html http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356738.html for earlier discussion. Part of the fix for PR27553. Differential Revision: http://reviews.llvm.org/D20348 llvm-svn: 272709
* [pgo] extend r271532 to darwin platformXinliang David Li2016-06-031-4/+4
| | | | llvm-svn: 271746
* [profile] value profiling bug fix -- missing icall targets in profile-useXinliang David Li2016-06-021-1/+7
| | | | | | | | | | | | | | | | | Inline virtual functions has linkeonceodr linkage (emitted in comdat on supporting targets). If the vtable for the class is not emitted in the defining module, function won't be address taken thus its address is not recorded. At the mercy of the linker, if the per-func prf_data from this module (in comdat) is picked at link time, we will lose mapping from function address to its hash val. This leads to missing icall promotion. The second test case (currently disabled) in compiler_rt (r271528): instrprof-icall-prom.test demostrates the bug. The first profile-use subtest is fine due to linker order difference. With this change, no missing icall targets is found in instrumented clang's raw profile. llvm-svn: 271532
* Use new triple API to check if comdat is supportedXinliang David Li2016-05-251-1/+1
| | | | llvm-svn: 270727
* [profile] Fix runtime hook linkage bug for COFFXinliang David Li2016-05-241-0/+2
| | | | | | | | | Patch by: Johan Engelen the user hook has linkonceODR linkage and it needs to be in comdatAny group. llvm-svn: 270596
* tune lowering parameter for small apps (sjeng)Xinliang David Li2016-05-231-2/+3
| | | | llvm-svn: 270480
* [profile] Static counter allocation for value profiling (part-1)Xinliang David Li2016-05-211-12/+96
| | | | | | Differential Revision: http://reviews.llvm.org/D20459 llvm-svn: 270336
* Retry^3 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-191-2/+2
| | | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. - Remove the base ProfError class to work around an MSVC ICE. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 270020
* Simple refactoring /NFCXinliang David Li2016-05-171-8/+15
| | | | llvm-svn: 269829
* Revert "Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Vedant Kumar2016-05-161-2/+2
| | | | | | | | This reverts commit r269694. MSVC says: error C2086: 'char llvm::ProfErrorInfoBase<enum llvm::instrprof_error>::ID' : redefinition llvm-svn: 269700
* Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-161-2/+2
| | | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Address undefined-var-template warning. - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269694
* Revert "Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Chandler Carruth2016-05-141-2/+2
| | | | | | | This reverts commit r269491. It triggers warnings with Clang, breaking builds for -Werror users including several build bots. llvm-svn: 269547
* Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-131-2/+2
| | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269491
* Revert "(HEAD -> master, origin/master, origin/HEAD) [ProfileData] (llvm) ↵Vedant Kumar2016-05-131-2/+2
| | | | | | | | Use Error in InstrProf and Coverage, NFC" This reverts commit r269462. It fails two llvm-profdata tests. llvm-svn: 269466
* [ProfileData] (llvm) Use Error in InstrProf and Coverage, NFCVedant Kumar2016-05-131-2/+2
| | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269462
* [ProfileData] Add error codes for compression failuresVedant Kumar2016-05-031-2/+4
| | | | | | | | | | Be more specific in describing compression failures. Also, check for this kind of error in emitNameData(). This is part of a series of patches to transition ProfileData over to the stricter Error/Expected interface. llvm-svn: 268400
* [PGO] Prohibit address recording if the function is both internal and COMDATRong Xu2016-04-271-0/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D19515 llvm-svn: 267792
* Port InstrProfiling pass to the new pass managerXinliang David Li2016-04-181-86/+41
| | | | | | Differential Revision: http://reviews.llvm.org/D18126 llvm-svn: 266637
* [PGO] Remove redundant counter copies for avail_extern functions.Xinliang David Li2016-02-271-3/+32
| | | | | | Differential Revision: http://reviews.llvm.org/D17654 llvm-svn: 262157
* [instrprof] Use __{start,stop}_SECNAME on PS4 too.Sean Silva2016-02-271-1/+2
| | | | | | | | | | | | | | | | | | | | | Summary: The PS4 linker seems to handle this fine. Hi David, it seems that indeed most ELF linkers support __{start,stop}_SECNAME, as our proprietary linker does as well. This follows the pattern of r250679 w.r.t. the testing. Maggie, Phillip, Paul: I've tested this with the PS4 SDK 3.5 toolchain prerelease and it seems to work fine. Reviewers: davidxl Subscribers: probinson, phillip.power, MaggieYi Differential Revision: http://reviews.llvm.org/D17672 llvm-svn: 262112
* [PGO] Enable compression in pgo instrumentationXinliang David Li2016-02-081-9/+59
| | | | | | | | | | | | 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
* [InstrProfiling] Fix a comment (NFC)Vedant Kumar2016-02-031-1/+1
| | | | llvm-svn: 259727
* Function name change /NFCXinliang David Li2016-01-201-1/+1
| | | | llvm-svn: 258260
* [PGO] Create the profile data variable before the loweringRong Xu2016-01-191-3/+12
| | | | | | | | | | This patch creates the profile data variable before lowering the profile intrinsics. Reviewers: davidxl, silvas Differential Revision: http://reviews.llvm.org/D16015 llvm-svn: 258156
* [PGO] Simplify coverage mapping loweringXinliang David Li2016-01-071-23/+11
| | | | | | | | | | | | | | | | Coverage mapping data may reference names of functions that are skipped by FE (e.g, unused inline functions). Since those functions are skipped, normal instr-prof function lowering pass won't put those names in the right section, so special handling is needed to walk through coverage mapping structure and recollect the references. With this patch, only names that are skipped are processed. This simplifies the lowering code and it no longer needs to make assumptions coverage mapping data layout. It should also be more efficient. llvm-svn: 257091
* [PGO] Cleanup: remove reduncant calls in loweringXinliang David Li2016-01-031-2/+0
| | | | | | | | CoverageMapping data's section and alignment is already set during creation. No need to call it again during lowering. llvm-svn: 256716
* [PGO] Cleanup: Use covmap header definition in the template fileXinliang David Li2016-01-031-4/+4
| | | | | | | | | | | | | | This is one last remaining instrumentatation related structure that needs to be migrate to use the centralized template definition. With this change, instrumentation code related to coverage module header will be kept in sync with the coverage mapping reader. The remaining code which makes implicit assumption about covmap control structure layout in the the lowering pass will cleaned up in a different patch. This patch is not intended to have no functional change. llvm-svn: 256715
* [PGO] Fix another comdat related issue for COFFXinliang David Li2015-12-221-2/+4
| | | | | | | | | | | The linker requires that a comdat section must be associated with a another comdat section that precedes it. This means the comdat section's name needs to use the profile name var's name. Patch tested by Johan Engelen. llvm-svn: 256220
* Resubmit r256193 with test fix: assertion failure analyzedXinliang David Li2015-12-211-2/+11
| | | | llvm-svn: 256201
* Revert r256193: build bot failure triggeredXinliang David Li2015-12-211-11/+2
| | | | llvm-svn: 256198
* [PGO] Fix profile var comdat generation problem with COFFXinliang David Li2015-12-211-2/+11
| | | | | | | | | | | When targeting COFF, it is required that a comdat section to have a global obj with the same name as the comdat (except for comdats with select kind to be associative). This fix makes sure that the comdat is keyed on the data variable for COFF. Also improved test coverage for this. llvm-svn: 256193
* [PGO] Stop using invalid char in instr variable names.Xinliang David Li2015-12-121-2/+2
| | | | | | | | | | | | | 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] Introduce alignment macro for instr-prof control data(NFC)Xinliang David Li2015-11-231-1/+1
| | | | llvm-svn: 253893
* [PGO] move names of runtime sections definitions to InstrProfData.inc Xinliang David Li2015-11-221-1/+1
| | | | | | | | | | In profile runtime implementation for Darwin, Linux and FreeBSD, the names of sections holding profile control/counter/naming data need to be known by the runtime in order to locate the start/end of the data. Moving the name definitions to the common file to specify the connection. llvm-svn: 253814
* [PGO] Define value profiling updater API signature in InstrProfData.inc (NFC)Xinliang David Li2015-11-221-6/+7
| | | | llvm-svn: 253805
* [PGO] Value profiling supportBetul Buyukkurt2015-11-181-21/+122
| | | | | | | | | 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
OpenPOWER on IntegriCloud