[all-commits] [llvm/llvm-project] df3e39: [InstrProfiling] Use !associated metadata for coun...

Petr Hosek via All-commits all-commits at lists.llvm.org
Mon Feb 1 15:02:14 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df3e39f60b356ca9dbfc11e96e5fdda30afa7acb
      https://github.com/llvm/llvm-project/commit/df3e39f60b356ca9dbfc11e96e5fdda30afa7acb
  Author: Petr Hosek <phosek at google.com>
  Date:   2021-02-01 (Mon, 01 Feb 2021)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    A compiler-rt/test/profile/instrprof-gc-sections.c
    M llvm/include/llvm/Transforms/Instrumentation.h
    M llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    M llvm/test/Instrumentation/InstrProfiling/icall.ll
    M llvm/test/Instrumentation/InstrProfiling/linkage.ll
    A llvm/test/Transforms/PGOProfile/associated.ll
    M llvm/test/Transforms/PGOProfile/counter_promo.ll
    M llvm/test/Transforms/PGOProfile/counter_promo_mexits.ll

  Log Message:
  -----------
  [InstrProfiling] Use !associated metadata for counters, data and values

C identifier name input sections such as __llvm_prf_* are GC roots so
they cannot be discarded. In LLD, the SHF_LINK_ORDER flag overrides the
C identifier name semantics.

The !associated metadata may be attached to a global object declaration
with a single argument that references another global object, and it
gets lowered to SHF_LINK_ORDER flag. When a function symbol is discarded
by the linker, setting up !associated metadata allows linker to discard
counters, data and values associated with that function symbol.

Note that !associated metadata is only supported by ELF, it does not have
any effect on non-ELF targets.

Differential Revision: https://reviews.llvm.org/D76802




More information about the All-commits mailing list