|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
9ff36df5 |
| 16-Jul-2022 |
Fangrui Song <[email protected]> |
[PGO][InstrProf][test] Convert to opaque pointers and fix some stale tests
|
| #
3d438cee |
| 11-Jul-2022 |
Justin Cady <[email protected]> |
[InstrProf] Mark __llvm_profile_runtime hidden to match libclang_rt.profile definition
Mark the symbol hidden to match INSTR_PROF_PROFILE_RUNTIME_VAR in compiler-rt.
Fixes second issue discussed at
[InstrProf] Mark __llvm_profile_runtime hidden to match libclang_rt.profile definition
Mark the symbol hidden to match INSTR_PROF_PROFILE_RUNTIME_VAR in compiler-rt.
Fixes second issue discussed at https://discourse.llvm.org/t/63090
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D128842
show more ...
|
|
Revision tags: llvmorg-14.0.6 |
|
| #
3f603025 |
| 16-Jun-2022 |
Paul Robinson <[email protected]> |
Reland "[PS4/PS5][profiling] Go back to the old way of doing a runtime hook"
Profiling stopped working for us after D98061, which was largely a Fuschia-specific patch but in one place used `isOSBinF
Reland "[PS4/PS5][profiling] Go back to the old way of doing a runtime hook"
Profiling stopped working for us after D98061, which was largely a Fuschia-specific patch but in one place used `isOSBinFormatELF` to make a decision. I'm adding a PS4/PS5 exception to that, so we can get profiling to work again.
Differential Revision: https://reviews.llvm.org/D127506
show more ...
|
| #
d0e60b6d |
| 16-Jun-2022 |
Paul Robinson <[email protected]> |
Revert "[PS4/PS5][profiling] Go back to the old way of doing a runtime hook"
This reverts commit 39fb84343ec5cf9081e236745490c65eb8a9fc31.
Pushed without verifying the test still works.
|
| #
39fb8434 |
| 10-Jun-2022 |
Paul Robinson <[email protected]> |
[PS4/PS5][profiling] Go back to the old way of doing a runtime hook
Profiling stopped working for us after D98061, which was largely a Fuschia-specific patch but in one place used `isOSBinFormatELF`
[PS4/PS5][profiling] Go back to the old way of doing a runtime hook
Profiling stopped working for us after D98061, which was largely a Fuschia-specific patch but in one place used `isOSBinFormatELF` to make a decision. I'm adding a PS4/PS5 exception to that, so we can get profiling to work again.
Differential Revision: https://reviews.llvm.org/D127506
show more ...
|
|
Revision tags: llvmorg-14.0.5, llvmorg-14.0.4 |
|
| #
2407c13a |
| 03-May-2022 |
Wael Yehia <[email protected]> |
[AIX][PGO] Enable linux style PGO on AIX
This patch switches the PGO implementation on AIX from using the runtime registration-based section tracking to the __start_SECNAME/__stop_SECNAME based. In
[AIX][PGO] Enable linux style PGO on AIX
This patch switches the PGO implementation on AIX from using the runtime registration-based section tracking to the __start_SECNAME/__stop_SECNAME based. In order to enable the recognition of __start_SECNAME/__stop_SECNAME symbols in the AIX linker, the -bdbg:namedsects:ss needs to be used.
Reviewed By: jsji, MaskRay, davidxl
Differential Revision: https://reviews.llvm.org/D124857
show more ...
|
|
Revision tags: llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1 |
|
| #
25c30324 |
| 28-Sep-2021 |
Jinsong Ji <[email protected]> |
[AIX] Change the linkage of profiling counter/data to be private
We generate symbols like `profc`/`profd` for each function, and put them into csects. When there are weak functions, we generate wea
[AIX] Change the linkage of profiling counter/data to be private
We generate symbols like `profc`/`profd` for each function, and put them into csects. When there are weak functions, we generate weak symbols for the functions as well, with ELF (and some others), linker (binder) will discard and only keep one copy of the weak symbols.
However, on AIX, the current binder can NOT discard the weak symbols if we put all of them into the same csect, as binder can NOT discard a subset of a csect.
This creates a unique challenge for using those symbols to calculate some relative offsets.
This patch changed the linkage of `profc`/`profd` symbols to be private, so that all the profc/profd for each weak symbol will be *local* to objects, and all kept in the csect, so we won't have problem. Although only one of the counters will be used, all the pointer in the profd is correct.
The downside is that we won't be able to discard the duplicated counters and profile data, but those can not be discarded even if we keep the weak linkage, due to the binder limitation of not discarding a subsect of the csect either .
Reviewed By: Whitney, MaskRay
Differential Revision: https://reviews.llvm.org/D110422
show more ...
|
|
Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3 |
|
| #
3fd27ec7 |
| 02-Sep-2021 |
Jinsong Ji <[email protected]> |
[InstrProfiling] Add one missing XCOFF line to profiling.ll
|
| #
f5505a2c |
| 02-Sep-2021 |
Jinsong Ji <[email protected]> |
[InstrProfiling] Add AIX triple to more tests
Following patch of https://reviews.llvm.org/D108490. Add AIX triples to tests in /Instrumentation/InstrProfiling/ to make sure we can catch regressions
[InstrProfiling] Add AIX triple to more tests
Following patch of https://reviews.llvm.org/D108490. Add AIX triples to tests in /Instrumentation/InstrProfiling/ to make sure we can catch regressions earlier.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D109089
show more ...
|
| #
68745a55 |
| 01-Sep-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling] Use llvm.compiler.used if applicable for Mach-O
Similar to D97585.
D25456 used `S_ATTR_LIVE_SUPPORT` to ensure the data variable will be retained or discarded as a unit with the co
[InstrProfiling] Use llvm.compiler.used if applicable for Mach-O
Similar to D97585.
D25456 used `S_ATTR_LIVE_SUPPORT` to ensure the data variable will be retained or discarded as a unit with the counter variable, so llvm.compiler.used is sufficient. It allows ld to dead strip unneeded profc and profd variables.
Reviewed By: vsk
Differential Revision: https://reviews.llvm.org/D105445
show more ...
|
| #
623bf6c3 |
| 01-Sep-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling][test] Combine profiling.ll and linkage.ll
The latter mostly covers the former.
|
|
Revision tags: llvmorg-13.0.0-rc2 |
|
| #
77b435aa |
| 19-Aug-2021 |
Fangrui Song <[email protected]> |
Revert "[InstrProfiling] Make COFF use the ELF comdat scheme (drop link.exe compatibility)"
This reverts commit fbb8e772ec501a1b71643db90e9c6445e17d7cac.
Accidentally pushed.
|
| #
fbb8e772 |
| 19-Aug-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling] Make COFF use the ELF comdat scheme (drop link.exe compatibility)
The COFF specific `DataReferencedByCode` complexity (D103372 D103717) is due to a link.exe limitation: an external
[InstrProfiling] Make COFF use the ELF comdat scheme (drop link.exe compatibility)
The COFF specific `DataReferencedByCode` complexity (D103372 D103717) is due to a link.exe limitation: an external symbol in IMAGE_COMDAT_SELECT_ASSOCIATIVE is not really dropped, so it can cause duplicate definition error.
show more ...
|
| #
389dc94d |
| 10-Aug-2021 |
Petr Hosek <[email protected]> |
[InstrProfiling] Generate runtime hook for Fuchsia
When none of the translation units in the binary have been instrumented we shouldn't need to link the profile runtime. However, because we pass -u_
[InstrProfiling] Generate runtime hook for Fuchsia
When none of the translation units in the binary have been instrumented we shouldn't need to link the profile runtime. However, because we pass -u__llvm_profile_runtime on Linux and Fuchsia, the runtime would still be pulled in and incur some overhead. On Fuchsia which uses runtime counter relocation, it also means that we cannot reference the bias variable unconditionally.
This change modifies the InstrProfiling pass to pull in the profile runtime only when needed by declaring the __llvm_profile_runtime symbol in the translation unit only when needed. For now we restrict this only for Fuchsia, but this can be later expanded to other platforms. This approach was already used prior to 9a041a75221ca, but we changed it to always generate the __llvm_profile_runtime due to a TAPI limitation, but that limitation may no longer apply, and it certainly doesn't apply on platforms like Fuchsia.
Differential Revision: https://reviews.llvm.org/D98061
show more ...
|
|
Revision tags: llvmorg-13.0.0-rc1 |
|
| #
a1532ed2 |
| 30-Jul-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling] Make CountersPtr in __profd_ relative
Change `CountersPtr` in `__profd_` to a label difference, which is a link-time constant. On ELF, when linking a shared object, this requires th
[InstrProfiling] Make CountersPtr in __profd_ relative
Change `CountersPtr` in `__profd_` to a label difference, which is a link-time constant. On ELF, when linking a shared object, this requires that `__profc_` is either private or linkonce/linkonce_odr hidden. On COFF, we need D104564 so that `.quad a-b` (64-bit label difference) can lower to a 32-bit PC-relative relocation.
``` # ELF: R_X86_64_PC64 (PC-relative) .quad .L__profc_foo-.L__profd_foo
# Mach-O: a pair of 8-byte X86_64_RELOC_UNSIGNED and X86_64_RELOC_SUBTRACTOR .quad l___profc_foo-l___profd_foo
# COFF: we actually use IMAGE_REL_AMD64_REL32/IMAGE_REL_ARM64_REL32 so # the high 32-bit value is zero even if .L__profc_foo < .L__profd_foo # As compensation, we truncate CountersDelta in the header so that # __llvm_profile_merge_from_buffer and llvm-profdata reader keep working. .quad .L__profc_foo-.L__profd_foo ```
(Note: link.exe sorts `.lprfc` before `.lprfd` even if the object writer has `.lprfd` before `.lprfc`, so we cannot work around by reordering `.lprfc` and `.lprfd`.)
With this change, a stage 2 (`-DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_INSTRUMENTED=IR`) `ld -pie` linked clang is 1.74% smaller due to fewer R_X86_64_RELATIVE relocations. ``` % readelf -r pie | awk '$3~/R.*/{s[$3]++} END {for (k in s) print k, s[k]}' R_X86_64_JUMP_SLO 331 R_X86_64_TPOFF64 2 R_X86_64_RELATIVE 476059 # was: 607712 R_X86_64_64 2616 R_X86_64_GLOB_DAT 31 ```
The absolute function address (used by llvm-profdata to collect indirect call targets) can be converted to relative as well, but is not done in this patch.
Differential Revision: https://reviews.llvm.org/D104556
show more ...
|
|
Revision tags: llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2 |
|
| #
9e51d1f3 |
| 04-Jun-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat
`__profd_*` variables are referenced by code only when value profiling is enabled. If disabled (e.
[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat
`__profd_*` variables are referenced by code only when value profiling is enabled. If disabled (e.g. default -fprofile-instr-generate), the symbols just waste space on ELF/Mach-O. We change the comdat symbol from `__profd_*` to `__profc_*` because an internal symbol does not provide deduplication features on COFF. The choice doesn't matter on ELF.
(In -DLLVM_BUILD_INSTRUMENTED_COVERAGE=on build, there is now no `__profd_*` symbols.)
On Windows this enables further optimization. We are no longer affected by the link.exe limitation: an external symbol in IMAGE_COMDAT_SELECT_ASSOCIATIVE can cause duplicate definition error. https://lists.llvm.org/pipermail/llvm-dev/2021-May/150758.html We can thus use llvm.compiler.used instead of llvm.used like ELF (D97585). This avoids many `/INCLUDE:` directives in `.drectve`.
Here is rnk's measurement for Chrome: ``` This reduced object file size of base_unittests.exe, compiled with coverage, optimizations, and gmlt debug info by 10%:
#BEFORE
$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}' 1047758867
$ du -cksh base_unittests.exe 82M base_unittests.exe 82M total
# AFTER
$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}' 937886499
$ du -cksh base_unittests.exe 78M base_unittests.exe 78M total ```
The change is NFC for Mach-O.
Reviewed By: davidxl, rnk
Differential Revision: https://reviews.llvm.org/D103372
show more ...
|
| #
e9a9c850 |
| 04-Jun-2021 |
Nico Weber <[email protected]> |
Revert "[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat"
This reverts commit a14fc749aab2c8e1a45d19d512255ebfc69357c3. Breaks check-profile on mac
Revert "[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat"
This reverts commit a14fc749aab2c8e1a45d19d512255ebfc69357c3. Breaks check-profile on macOS. See https://reviews.llvm.org/D103372 for details.
show more ...
|
| #
a14fc749 |
| 03-Jun-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat
`__profd_*` variables are referenced by code only when value profiling is enabled. If disabled (e.
[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat
`__profd_*` variables are referenced by code only when value profiling is enabled. If disabled (e.g. default -fprofile-instr-generate), the symbols just waste space on ELF/Mach-O. We change the comdat symbol from `__profd_*` to `__profc_*` because an internal symbol does not provide deduplication features on COFF. The choice doesn't matter on ELF.
(In -DLLVM_BUILD_INSTRUMENTED_COVERAGE=on build, there is now no `__profd_*` symbols.)
On Windows this enables further optimization. We are no longer affected by the link.exe limitation: an external symbol in IMAGE_COMDAT_SELECT_ASSOCIATIVE can cause duplicate definition error. https://lists.llvm.org/pipermail/llvm-dev/2021-May/150758.html We can thus use llvm.compiler.used instead of llvm.used like ELF (D97585). This avoids many `/INCLUDE:` directives in `.drectve`.
Here is rnk's measurement for Chrome: ``` This reduced object file size of base_unittests.exe, compiled with coverage, optimizations, and gmlt debug info by 10%:
#BEFORE
$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}' 1047758867
$ du -cksh base_unittests.exe 82M base_unittests.exe 82M total
# AFTER
$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}' 937886499
$ du -cksh base_unittests.exe 78M base_unittests.exe 78M total ```
Reviewed By: davidxl, rnk
Differential Revision: https://reviews.llvm.org/D103372
show more ...
|
| #
87c43f3a |
| 02-Jun-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling] Delete linkage/visibility toggling for Windows
The linkage/visibility of `__profn_*` variables are derived from the profiled functions.
extern_weak => linkonce available_ex
[InstrProfiling] Delete linkage/visibility toggling for Windows
The linkage/visibility of `__profn_*` variables are derived from the profiled functions.
extern_weak => linkonce available_externally => linkonce_odr internal => private extern => private _ => unchanged
The linkage/visibility of `__profc_*`/`__profd_*` variables are derived from `__profn_*` with linkage/visibility wrestling for Windows.
The changes can be folded to the following without changing semantics.
``` if (TT.isOSBinFormatCOFF() && !NeedComdat) { Linkage = GlobalValue::InternalLinkage; Visibility = GlobalValue::DefaultVisibility; } ```
That said, I think we can just delete the code block.
An extern/internal function will now use private `__profc_*`/`__profd_*` variables, instead of internal ones. This saves some symbol table entries.
A non-comdat {linkonce,weak}_odr function will now use hidden external `__profc_*`/`__profd_*` variables instead of internal ones. There is potential object file size increase because such symbols need `/INCLUDE:` directives. However such non-comdat functions are rare (note that non-comdat weak definitions don't prevent duplicate definition error).
The behavior changes match ELF.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D103355
show more ...
|
| #
7145c6ca |
| 29-May-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling][test] Improve tests
|
| #
9f506fc7 |
| 29-May-2021 |
Fangrui Song <[email protected]> |
[InstrProfiling][test] Fix stale tests
* Change linkage/visibility of __profn_ variables to match the reality * alwaysinline.ll: Add "EnableValueProfiling", otherwise it doesn't test available_exter
[InstrProfiling][test] Fix stale tests
* Change linkage/visibility of __profn_ variables to match the reality * alwaysinline.ll: Add "EnableValueProfiling", otherwise it doesn't test available_externally alwaysinline. * Delete PR23499.ll - covered by other comdat tests.
show more ...
|
|
Revision tags: llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4 |
|
| #
f50aef74 |
| 12-Mar-2021 |
Hans Wennborg <[email protected]> |
Revert "[InstrProfiling] Don't generate __llvm_profile_runtime_user"
This broke the check-profile tests on Mac, see comment on the code review.
> This is no longer needed, we can add __llvm_profile
Revert "[InstrProfiling] Don't generate __llvm_profile_runtime_user"
This broke the check-profile tests on Mac, see comment on the code review.
> This is no longer needed, we can add __llvm_profile_runtime directly > to llvm.compiler.used or llvm.used to achieve the same effect. > > Differential Revision: https://reviews.llvm.org/D98325
This reverts commit c7712087cbb505d324e1149fa224f607c91a8c6a.
Also reverting the dependent follow-up commit:
Revert "[InstrProfiling] Generate runtime hook for ELF platforms"
> When using -fprofile-list to selectively apply instrumentation only > to certain files or functions, we may end up with a binary that doesn't > have any counters in the case where no files were selected. However, > because on Linux and Fuchsia, we pass -u__llvm_profile_runtime, the > runtime would still be pulled in and incur some non-trivial overhead, > especially in the case when the continuous or runtime counter relocation > mode is being used. A better way would be to pull in the profile runtime > only when needed by declaring the __llvm_profile_runtime symbol in the > translation unit only when needed. > > This approach was already used prior to 9a041a75221ca, but we changed it > to always generate the __llvm_profile_runtime due to a TAPI limitation. > Since TAPI is only used on Mach-O platforms, we could use the early > emission of __llvm_profile_runtime there, and on other platforms we > could change back to the earlier approach where the symbol is generated > later only when needed. We can stop passing -u__llvm_profile_runtime to > the linker on Linux and Fuchsia since the generated undefined symbol in > each translation unit that needed it serves the same purpose. > > Differential Revision: https://reviews.llvm.org/D98061
This reverts commit 87fd09b25f8892e07b7ba11525baa9c3ec3e5d3f.
show more ...
|
|
Revision tags: llvmorg-12.0.0-rc3 |
|
| #
87fd09b2 |
| 05-Mar-2021 |
Petr Hosek <[email protected]> |
[InstrProfiling] Generate runtime hook for ELF platforms
When using -fprofile-list to selectively apply instrumentation only to certain files or functions, we may end up with a binary that doesn't h
[InstrProfiling] Generate runtime hook for ELF platforms
When using -fprofile-list to selectively apply instrumentation only to certain files or functions, we may end up with a binary that doesn't have any counters in the case where no files were selected. However, because on Linux and Fuchsia, we pass -u__llvm_profile_runtime, the runtime would still be pulled in and incur some non-trivial overhead, especially in the case when the continuous or runtime counter relocation mode is being used. A better way would be to pull in the profile runtime only when needed by declaring the __llvm_profile_runtime symbol in the translation unit only when needed.
This approach was already used prior to 9a041a75221ca, but we changed it to always generate the __llvm_profile_runtime due to a TAPI limitation. Since TAPI is only used on Mach-O platforms, we could use the early emission of __llvm_profile_runtime there, and on other platforms we could change back to the earlier approach where the symbol is generated later only when needed. We can stop passing -u__llvm_profile_runtime to the linker on Linux and Fuchsia since the generated undefined symbol in each translation unit that needed it serves the same purpose.
Differential Revision: https://reviews.llvm.org/D98061
show more ...
|
| #
c7712087 |
| 10-Mar-2021 |
Petr Hosek <[email protected]> |
[InstrProfiling] Don't generate __llvm_profile_runtime_user
This is no longer needed, we can add __llvm_profile_runtime directly to llvm.compiler.used or llvm.used to achieve the same effect.
Diffe
[InstrProfiling] Don't generate __llvm_profile_runtime_user
This is no longer needed, we can add __llvm_profile_runtime directly to llvm.compiler.used or llvm.used to achieve the same effect.
Differential Revision: https://reviews.llvm.org/D98325
show more ...
|
| #
30ad7b5d |
| 03-Mar-2021 |
Fangrui Song <[email protected]> |
[test] Fix profiling.ll
`__llvm_prf_nm` is compressed if zlib is available. In addition, its size may not be that stable.
|