[PATCH] D103372: [InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 29 14:32:51 PDT 2021
MaskRay created this revision.
MaskRay added reviewers: davidxl, rnk, vsk.
Herald added subscribers: wenlei, hiraditya.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
`__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.
(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 <https://reviews.llvm.org/D97585>).
This avoids `/INCLUDE:` directives in `.drectve`.
Hope someone can test this on Windows. I am speculating with theories and don't
have a testing setup:/
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D103372
Files:
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
llvm/test/Instrumentation/InstrProfiling/comdat.ll
llvm/test/Instrumentation/InstrProfiling/icall.ll
llvm/test/Instrumentation/InstrProfiling/linkage.ll
llvm/test/Instrumentation/InstrProfiling/platform.ll
llvm/test/Instrumentation/InstrProfiling/profiling.ll
llvm/test/Transforms/PGOProfile/comdat_internal.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103372.348661.patch
Type: text/x-patch
Size: 21544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210529/6586d7ae/attachment.bin>
More information about the llvm-commits
mailing list