[all-commits] [llvm/llvm-project] 245cdd: [PGO][GlobalValue][LTO]In GlobalValues::getGlobalI...
Mingming Liu via All-commits
all-commits at lists.llvm.org
Mon Dec 18 09:10:53 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 245cddae705aa8c8c8c88f80afb128d46b911695
https://github.com/llvm/llvm-project/commit/245cddae705aa8c8c8c88f80afb128d46b911695
Author: Mingming Liu <mingmingl at google.com>
Date: 2023-12-18 (Mon, 18 Dec 2023)
Changed paths:
A compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp
M llvm/include/llvm/IR/GlobalValue.h
M llvm/include/llvm/ProfileData/InstrProf.h
M llvm/lib/IR/Globals.cpp
M llvm/lib/ProfileData/InstrProf.cpp
M llvm/lib/ProfileData/InstrProfReader.cpp
M llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
M llvm/test/ThinLTO/X86/memprof-basic.ll
M llvm/test/ThinLTO/X86/memprof-duplicate-context-ids.ll
M llvm/test/ThinLTO/X86/memprof-funcassigncloning.ll
M llvm/test/ThinLTO/X86/memprof-indirectcall.ll
M llvm/test/ThinLTO/X86/memprof-inlined.ll
R llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.ll
A llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.profraw
A llvm/test/Transforms/PGOProfile/Inputs/update_thinlto_indirect_call_promotion_inputs.sh
M llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll
M llvm/unittests/ProfileData/InstrProfTest.cpp
Log Message:
-----------
[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)
More information about the All-commits
mailing list