[all-commits] [llvm/llvm-project] 9a0c25: [InstrProf] Replace !PGOFuncName and !PGOName meta...

Owen Rodley via All-commits all-commits at lists.llvm.org
Mon Sep 28 17:55:45 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a0c255ce1efbd80ef501e8151d123876fa4b5d4
      https://github.com/llvm/llvm-project/commit/9a0c255ce1efbd80ef501e8151d123876fa4b5d4
  Author: Owen Rodley <orodley at google.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M clang/lib/CodeGen/CodeGenPGO.cpp
    M compiler-rt/test/profile/instrprof-thinlto-indirect-call-promotion.cpp
    M llvm/include/llvm/ProfileData/InstrProf.h
    M llvm/lib/ProfileData/InstrProf.cpp
    M llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    M llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
    M llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
    M llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp
    M llvm/test/Instrumentation/cgprofile.ll
    M llvm/test/Transforms/JumpTableToSwitch/profile-no-guid-metadata.ll
    M llvm/test/Transforms/JumpThreading/thread-prob-1.ll
    M llvm/test/Transforms/PGOProfile/Inputs/cspgo_bar_sample.ll
    M llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_gen.ll
    M llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_use.ll
    M llvm/test/Transforms/PGOProfile/icp_invoke.ll
    M llvm/test/Transforms/PGOProfile/icp_invoke_nouse.ll
    M llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll
    M llvm/test/tools/gold/X86/Inputs/thinlto_cspgo_bar.ll
    A llvm/test/tools/llvm-profdata/Inputs/guid-roundtrip.c
    A llvm/test/tools/llvm-profdata/Inputs/guid-roundtrip.proftext
    A llvm/test/tools/llvm-profdata/guid-roundtrip.test
    M llvm/unittests/ProfileData/InstrProfTest.cpp

  Log Message:
  -----------
  [InstrProf] Replace !PGOFuncName and !PGOName metadata with !guid (#214134)

!PGOFuncName and !PGOName metadata were attached to internal functions
and vtables during profile annotation to record their original
"<file>;<name>" PGO names before ThinLTO promoted and renamed them. In
post-link LTO passes, InstrProfSymtab read that metadata back so profile
records keyed by the original name's hash could still find the renamed
IR object.

Global objects now carry stable !guid metadata assigned before LTO
renaming, which records the MD5 hash of the original PGO name directly.
See: https://discourse.llvm.org/t/rfc-keep-globalvalue-guids-stable/84801

Use !guid instead of maintaining separate PGO name metadata:

- Stop emitting and reading !PGOFuncName and !PGOName in Clang and
  PGOInstrumentation, and remove the metadata helper functions
  (createPGOFuncNameMetadata, createPGONameMetadata,
  getPGOFuncNameMetadata, and the metadata name getters).
- Unify getIRPGOFuncName(const Function &) and
  getPGOName(const GlobalVariable &) into
  getIRPGOObjectName(const GlobalObject &).
- In InstrProfSymtab::addFuncWithName and addVTableWithName, key each
  name by its own hash as before, and also insert the object's assigned
  GUID into MD5FuncMap / MD5VTableMap when it differs from the PGO name
  hash. This lets lookups find functions and vtables that LTO has
  renamed while preserving lookups by current, deprecated, and canonical
  names.
- Remove obsolete !PGOFuncName metadata from test inputs, update the
  ThinLTO ICP tests to check for !guid, and add symtab unit tests and an
  llvm-profdata text/indexed round-trip test.

Assisted-by: Antigravity



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list