[all-commits] [llvm/llvm-project] c58717: Reland "[PGO][GlobalValue][LTO]In GlobalValues::ge...

Mingming Liu via All-commits all-commits at lists.llvm.org
Mon Dec 18 17:43:53 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c5871712ae9d47c0015c3f9c805bed04a913d034
      https://github.com/llvm/llvm-project/commit/c5871712ae9d47c0015c3f9c805bed04a913d034
  Author: Mingming Liu <mingmingl at google.com>
  Date:   2023-12-18 (Mon, 18 Dec 2023)

  Changed paths:
    M compiler-rt/test/profile/CMakeLists.txt
    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:
  -----------
  Reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. " (#75860)

Fixed build-bot failures caught by post-submit tests
1) Add the list of command line tools needed by new compiler-rt test into dependency.
2) Use `starts_with` to replace deprecated `startswith`.

**Original commit message**
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