teak-llvm/llvm/lib/Transforms/Instrumentation
Reid Kleckner 32837a0c93 [PGO] Use linkonce_odr linkage for __profd_ variables in comdat groups
This fixes relocations against __profd_ symbols in discarded sections,
which is PR41380.

In general, instrumentation happens very early, and optimization and
inlining happens afterwards. The counters for a function are calculated
early, and after inlining, counters for an inlined function may be
widely referenced by other functions.

For C++ inline functions of all kinds (linkonce_odr &
available_externally mainly), instr profiling wants to deduplicate these
__profc_ and __profd_ globals. Otherwise the binary would be quite
large.

I made __profd_ and __profc_ comdat in r355044, but I chose to make
__profd_ internal. At the time, I was only dealing with coverage, and in
that case, none of the instrumentation needs to reference __profd_.
However, if you use PGO, then instrumentation passes add calls to
__llvm_profile_instrument_range which reference __profd_ globals. The
solution is to make these globals externally visible by using
linkonce_odr linkage for data as was done for counters.

This is safe because PGO adds a CFG hash to the names of the data and
counter globals, so if different TUs have different globals, they will
get different data and counter arrays.

Reviewers: xur, hans

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

llvm-svn: 372020
2019-09-16 18:49:09 +00:00
..
AddressSanitizer.cpp Change TargetLibraryInfo analysis passes to always require Function 2019-09-07 03:09:36 +00:00
BoundsChecking.cpp Change TargetLibraryInfo analysis passes to always require Function 2019-09-07 03:09:36 +00:00
CFGMST.h [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
CGProfile.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt Add a transform pass to make the executable semantics of poison explicit in the IR 2019-07-09 18:49:29 +00:00
ControlHeightReduction.cpp [PGO][CHR] Speed up following long, interlinked use-def chains. 2019-09-05 16:56:55 +00:00
DataFlowSanitizer.cpp [DFSan] Add UnaryOperator visitor to DataFlowSanitizer 2019-06-19 15:11:41 +00:00
GCOVProfiling.cpp Change TargetLibraryInfo analysis passes to always require Function 2019-09-07 03:09:36 +00:00
HWAddressSanitizer.cpp [Instruction] Add hasMetadata(Kind) helper [NFC] 2019-09-04 17:28:48 +00:00
IndirectCallPromotion.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
InstrOrderFile.cpp Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
InstrProfiling.cpp [PGO] Use linkonce_odr linkage for __profd_ variables in comdat groups 2019-09-16 18:49:09 +00:00
Instrumentation.cpp [NewPM][Sancov] Make Sancov a Module Pass instead of 2 Passes 2019-09-04 20:30:29 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MaximumSpanningTree.h Use llvm::stable_sort 2019-04-23 14:51:27 +00:00
MemorySanitizer.cpp Change TargetLibraryInfo analysis passes to always require Function 2019-09-07 03:09:36 +00:00
PGOInstrumentation.cpp Reland "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM" 2019-09-11 16:19:50 +00:00
PGOMemOPSizeOpt.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
PoisonChecking.cpp [PoisonChecking] Flesh out complete todo list for full coverage 2019-07-09 19:59:39 +00:00
SanitizerCoverage.cpp [NewPM][Sancov] Make Sancov a Module Pass instead of 2 Passes 2019-09-04 20:30:29 +00:00
ThreadSanitizer.cpp Change TargetLibraryInfo analysis passes to always require Function 2019-09-07 03:09:36 +00:00