diff options
author | Mingming Liu <mingmingl@google.com> | 2023-12-18 09:10:39 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-18 09:10:39 -0800 |
commit | 245cddae705aa8c8c8c88f80afb128d46b911695 (patch) | |
tree | 0bd8a2477b3d0081ddb915b09c8c87db71e29bd8 /libcxx/include/__algorithm/replace.h | |
parent | e400c59beb5f853e109ada06eb5c855c3eab6a31 (diff) | |
download | llvm-245cddae705aa8c8c8c88f80afb128d46b911695.zip llvm-245cddae705aa8c8c8c88f80afb128d46b911695.tar.gz llvm-245cddae705aa8c8c8c88f80afb128d46b911695.tar.bz2 |
[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (#74008)
Commit fe05193 (phab D156569), IRPGO names uses format
`[<filepath>;]<linkage-name>` while prior format is
`[<filepath>:<mangled-name>`. The format change would break the use case
demonstrated in (updated)
`llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll` and
`compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp`
This patch changes `GlobalValues::getGlobalIdentifer` to use the
semicolon.
To elaborate on the scenario how things break without this PR
1. IRPGO raw profiles stores (compressed) IRPGO names of functions in
one section, and per-function profile data in another section. The
[NameRef](https://github.com/llvm/llvm-project/blob/fc715e4cd942612a091097339841733757b53824/compiler-rt/include/profile/InstrProfData.inc#L72)
field in per-function profile data is the MD5 hash of IRPGO names.
2. When raw profiles are converted to indexed format profiles, the
profiled address is
[mapped](https://github.com/llvm/llvm-project/blob/fc715e4cd942612a091097339841733757b53824/llvm/lib/ProfileData/InstrProf.cpp#L876-L885)
to the MD5 hash of the callee.
3. In `pgo-instr-use` thin-lto prelink pipeline, MD5 hash of IRPGO names
will be
[annotated](https://github.com/llvm/llvm-project/blob/fc715e4cd942612a091097339841733757b53824/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp#L1707)
as value profiles, and used to import indirect-call-prom candidates. If
the annotated MD5 hash is computed from the new format while import uses
the prior format, the callee cannot be imported.
*`compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp`
is added to have an end-to-end test.
* `llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll`
is updated to have better test coverage from another aspect (as runtime
tests are more sensitive to the environment and may be skipped by some
contributors)
Diffstat (limited to 'libcxx/include/__algorithm/replace.h')
0 files changed, 0 insertions, 0 deletions