[PATCH] D141320: "Reland "[pgo] Avoid introducing relocations by using private alias"

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 13:16:04 PST 2023


paulkirth created this revision.
Herald added subscribers: Enna1, jeroen.dobbelaere, wenlei, hiraditya.
Herald added a project: All.
paulkirth requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

In many cases, we can use an alias to avoid a symbolic relocations,
instead of using the public, interposable symbol. When the instrumented
function is in a COMDAT, we can use a hidden alias, and still avoid
references to discarded sections.

Previous versions of this patch allowed the compiler to name the
generated alias, but that would only be valid when the functions were
local. Since the alias may be used across TUs we use a more
deterministic naming convention, and add a .local suffix to the alias
name just as we do for relative vtables aliases.

This should be safe to land after an incorrect LLD assertion was removed
in https://reviews.llvm.org/rG20894a478da224bdd69c91a22a5175b28bc08ed9
which caused assertion failures in LLD on Mac.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141320

Files:
  compiler-rt/test/profile/instrprof-discarded-comdat.cpp
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/test/Transforms/PGOProfile/comdat.ll
  llvm/test/Transforms/PGOProfile/prof_avoid_relocs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141320.487541.patch
Type: text/x-patch
Size: 12589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230109/2952517a/attachment.bin>


More information about the llvm-commits mailing list