[all-commits] [llvm/llvm-project] db18f2: [llvm-profdata] Handle internal linkage functions ...

xur-llvm via All-commits all-commits at lists.llvm.org
Mon Aug 29 16:21:12 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db18f26567be47ec1da7fba48179a3001f0d34ab
      https://github.com/llvm/llvm-project/commit/db18f26567be47ec1da7fba48179a3001f0d34ab
  Author: Rong Xu <xur at google.com>
  Date:   2022-08-29 (Mon, 29 Aug 2022)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    M llvm/include/llvm/ProfileData/SampleProf.h
    A llvm/test/tools/llvm-profdata/Inputs/FUnique.afdotext
    A llvm/test/tools/llvm-profdata/Inputs/FUnique.proftext
    A llvm/test/tools/llvm-profdata/Inputs/NoFUnique.afdotext
    A llvm/test/tools/llvm-profdata/Inputs/NoFUnique.proftext
    A llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test
    M llvm/tools/llvm-profdata/llvm-profdata.cpp

  Log Message:
  -----------
  [llvm-profdata] Handle internal linkage functions in profile supplementation

This patch has the following changes:
(1) Handling of internal linkage functions (static functions)
Static functions in FDO have a prefix of source file name, while they do not
have one in SampleFDO. Current implementation does not handle this and we are
not updating the profile for static functions. This patch fixes this.

(2) Handling of -funique-internal-linakge-symbols
Again this is for the internal linkage functions. Option
-funique-internal-linakge-symbols can now be applied to both FDO and SampleFDO
compilation. When it is used, it demangles internal linkage function names and
adds a hash value as the postfix.

When both SampleFDO and FDO profiles use this option, or both
not use this option, changes in (1) should handle this.

Here we also handle when the SampleFDO profile using this option while FDO
profile not using this option, or vice versa.

There is one case where this patch won't work: If one of the profiles used
mangled name and the other does not. For example, if the SampleFDO profile
uses clang c-compiler and without -funique-internal-linakge-symbols, while
the FDO profile uses -funique-internal-linakge-symbols. The SampleFDO profile
contains unmangled names while the FDO profile contains mangled names. If
both profiles use c++ compiler, this won't happen. We think this use case
is rare and does not justify the effort to fix.

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




More information about the All-commits mailing list