Reland "[pgo] Avoid introducing relocations by using private alias"
authorPaul Kirth <paulkirth@google.com>
Thu, 8 Dec 2022 18:30:14 +0000 (18:30 +0000)
committerPaul Kirth <paulkirth@google.com>
Thu, 8 Dec 2022 21:03:37 +0000 (21:03 +0000)
commit3cfaea2d499970c2fd14389ade59f792156be0f8
tree7826e234881ab6407693f384f86cd3627d0bd564
parent8c0e401da78d16eeabcf022763b48832fe62b1ed
Reland "[pgo] Avoid introducing relocations by using private alias"

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.

This disables the failing runtime test on Windows, since the compiler
options (-fPIC) are unsupported on that platform.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D137982
compiler-rt/test/profile/instrprof-discarded-comdat.cpp [new file with mode: 0644]
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
llvm/test/Transforms/PGOProfile/comdat.ll
llvm/test/Transforms/PGOProfile/prof_avoid_relocs.ll [new file with mode: 0644]