[all-commits] [llvm/llvm-project] 75df61: [test] Improve PGO tests

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Mar 3 11:32:46 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75df61e93d22c5225469142bf79592bce4ffb3de
      https://github.com/llvm/llvm-project/commit/75df61e93d22c5225469142bf79592bce4ffb3de
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-03-03 (Wed, 03 Mar 2021)

  Changed paths:
    A compiler-rt/test/profile/Linux/Inputs/instrprof-value-merge.c
    A compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c
    M compiler-rt/test/profile/Linux/instrprof-value-merge.c
    M llvm/test/Instrumentation/InstrProfiling/profiling.ll

  Log Message:
  -----------
  [test] Improve PGO tests


  Commit: a84f4fc0dfcd0c0d249c3071f9bc5de0c56b6cca
      https://github.com/llvm/llvm-project/commit/a84f4fc0dfcd0c0d249c3071f9bc5de0c56b6cca
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-03-03 (Wed, 03 Mar 2021)

  Changed paths:
    M compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c
    M llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    M llvm/test/Instrumentation/InstrProfiling/icall.ll

  Log Message:
  -----------
  [InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used on ELF

`__llvm_prf_vnodes` and `__llvm_prf_names` are used by runtime but not
referenced via relocation in the translation unit.

With `-z start-stop-gc` (LLD 13 (D96914); GNU ld 2.37 https://sourceware.org/bugzilla/show_bug.cgi?id=27451),
the linker does not let `__start_/__stop_` references retain their sections.

Place `__llvm_prf_vnodes` and `__llvm_prf_names` in `llvm.used` to make
them retained by the linker.

This patch changes most existing `UsedVars` cases to `CompilerUsedVars`
to reflect the ideal state - if the binary format properly supports
section based GC (dead stripping), `llvm.compiler.used` should be sufficient.

`__llvm_prf_vnodes` and `__llvm_prf_names` are switched to `UsedVars`
since we want them to be unconditionally retained by both compiler and linker.

Behaviors on COFF/Mach-O are not affected.

Reviewed By: davidxl

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


Compare: https://github.com/llvm/llvm-project/compare/2d7374a0c680...a84f4fc0dfcd


More information about the All-commits mailing list