OSDN Git Service

[InstrProf] Implement static profdata registration
authorReid Kleckner <rnk@google.com>
Fri, 8 Feb 2019 19:03:50 +0000 (19:03 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 8 Feb 2019 19:03:50 +0000 (19:03 +0000)
commit1f260f709074d69a13e5cffea7d755133b53ea1e
tree07f99696be6d39d4be8b30115d0f63b1ae16804d
parentd5cf0c957e9b64b1bf65f5aa3e866378aec2639b
[InstrProf] Implement static profdata registration

Summary:
The motivating use case is eliminating duplicate profile data registered
for the same inline function in two object files. Before this change,
users would observe multiple symbol definition errors with VC link, but
links with LLD would succeed.

Users (Mozilla) have reported that PGO works well with clang-cl and LLD,
but when using LLD without this static registration, we would get into a
"relocation against a discarded section" situation. I'm not sure what
happens in that situation, but I suspect that duplicate, unused profile
information was retained. If so, this change will reduce the size of
such binaries with LLD.

Now, Windows uses static registration and is in line with all the other
platforms.

Reviewers: davidxl, wmi, inglorion, void, calixte

Subscribers: mgorny, krytarowski, eraman, fedor.sergeev, hiraditya, #sanitizers, dmajor, llvm-commits

Tags: #sanitizers, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353547 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ProfileData/InstrProfData.inc
lib/Transforms/Instrumentation/InstrProfiling.cpp
test/Instrumentation/InstrProfiling/PR23499.ll
test/Instrumentation/InstrProfiling/comdat.ll [new file with mode: 0644]
test/Instrumentation/InstrProfiling/linkage.ll
test/Instrumentation/InstrProfiling/platform.ll