[all-commits] [llvm/llvm-project] e56626: [PGO] Move __profc_ and __profvp_ from their own c...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Mon Aug 3 20:40:31 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: e56626e43826c9d7c35113635d62b57c905ef3c0
https://github.com/llvm/llvm-project/commit/e56626e43826c9d7c35113635d62b57c905ef3c0
Author: Fangrui Song <maskray at google.com>
Date: 2020-08-03 (Mon, 03 Aug 2020)
Changed paths:
M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
M llvm/test/Instrumentation/InstrProfiling/PR23499.ll
M llvm/test/Instrumentation/InstrProfiling/comdat.ll
M llvm/test/Instrumentation/InstrProfiling/icall.ll
M llvm/test/Instrumentation/InstrProfiling/linkage.ll
M llvm/test/Transforms/PGOProfile/comdat_internal.ll
Log Message:
-----------
[PGO] Move __profc_ and __profvp_ from their own comdat groups to __profd_'s comdat group
D68041 placed `__profc_`, `__profd_` and (if exists) `__profvp_` in different comdat groups.
There are some issues:
* Cost: one or two additional section headers (`.group` section(s)): 64 or 128 bytes on ELF64.
* `__profc_`, `__profd_` and (if exists) `__profvp_` should be retained or
discarded. Placing them into separate comdat groups is conceptually inferior.
* If the prevailing group does not include `__profvp_` (value profiling not
used) but a non-prevailing group from another translation unit has `__profvp_`
(the function is inlined into another and triggers value profiling), there
will be a stray `__profvp_` if --gc-sections is not enabled.
This has been fixed by 3d6f53018f845e893ad34f64ff2851a2e5c3ba1d.
Actually, we can reuse an existing symbol (we choose `__profd_`) as the group
signature to avoid a string in the string table (the sole reason that D68041
could improve code size is that `__profv_` was an otherwise unused symbol which
wasted string table space). This saves one or two section headers.
For a -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_INSTRUMENTED=IR build, `ninja
clang lld`, the patch has saved 10.5MiB (2.2%) for the total .o size.
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D84723
More information about the All-commits
mailing list