llvm-project/llvm/lib/Transforms/Instrumentation
Fangrui Song bf176c49e8 [InstrProfiling] Use llvm.compiler.used instead of llvm.used for ELF
Many optimizers (e.g.  GlobalOpt/ConstantMerge) do not respect linker semantics
for comdat and may not discard the sections as a unit.

The interconnected `__llvm_prf_{cnts,data}` sections (in comdat for ELF)
are similar to D97432: `__profd_` is not directly referenced, so
`__profd_` may be discarded while `__profc_` is retained, breaking the
interconnection.  We currently conservatively add all such sections to
`llvm.used` and let the linker do GC for ELF.

In D97448, we will change GlobalObject's in the llvm.used list to use SHF_GNU_RETAIN,
causing the metadata sections to be unnecessarily retained (some `check-profile` tests check for GC).
Use `llvm.compiler.used` to retain the current GC behavior.

Differential Revision: https://reviews.llvm.org/D97585
2021-02-26 16:14:03 -08:00
..
AddressSanitizer.cpp Support `#pragma clang section` directives on MachO targets 2021-02-25 09:30:10 -08:00
BoundsChecking.cpp [local-bounds] Ignore volatile operations 2020-05-05 23:08:08 -07:00
CFGMST.h [Transforms/Instrumentation] Use range-based for loops (NFC) 2021-02-05 21:02:08 -08:00
CGProfile.cpp [CGProfile] don't emit cgprofile entry if called function is dllimport 2020-09-23 16:56:54 -07:00
CMakeLists.txt llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
ControlHeightReduction.cpp [llvm] Use *Set::contains (NFC) 2021-01-07 20:29:34 -08:00
DataFlowSanitizer.cpp [dfsan] Record dfsan metadata in globals 2021-02-26 14:42:46 -08:00
GCOVProfiling.cpp Add Alignment argument to IRBuilder CreateAtomicRMW and CreateAtomicCmpXchg. 2021-02-25 18:29:42 -05:00
HWAddressSanitizer.cpp [SimplifyCFG] Port SplitBlockAndInsertIfThen() to DomTreeUpdater 2021-01-15 23:35:56 +03:00
IndirectCallPromotion.cpp [ICP] Don't promote when target not defined in module 2020-12-08 07:45:36 -08:00
InstrOrderFile.cpp Add Alignment argument to IRBuilder CreateAtomicRMW and CreateAtomicCmpXchg. 2021-02-25 18:29:42 -05:00
InstrProfiling.cpp [InstrProfiling] Use llvm.compiler.used instead of llvm.used for ELF 2021-02-26 16:14:03 -08:00
Instrumentation.cpp [SanitizerCoverage] Drop !associated on metadata sections 2021-02-25 11:59:23 -08:00
MaximumSpanningTree.h
MemProfiler.cpp MemProfiler::insertDynamicShadowAtFunctionEntry - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI. 2021-01-05 09:34:01 +00:00
MemorySanitizer.cpp [msan] Set cmpxchg shadow precisely 2021-02-19 20:23:23 +00:00
PGOInstrumentation.cpp [PGO] Drop unnecessary const from return types (NFC) 2021-02-11 23:31:29 -08:00
PGOMemOPSizeOpt.cpp [llvm-profdata] Emit Error when Invalid MemOpSize Section is Created by llvm-profdata 2021-02-23 12:51:54 -08:00
PoisonChecking.cpp [ValueTracking] Add UndefOrPoison/Poison-only version of relevant functions 2020-09-09 20:00:26 +09:00
SanitizerCoverage.cpp [SanitizerCoverage] Clarify llvm.used/llvm.compiler.used and partially fix unmatched metadata sections on Windows 2021-02-26 11:10:03 -08:00
ThreadSanitizer.cpp static const char *const foo => const char foo[] 2020-12-01 10:33:18 -08:00
ValueProfileCollector.cpp ValueProfileCollector.h - remove unnecessary includes. NFC. 2020-07-23 12:33:13 +01:00
ValueProfileCollector.h ValueProfileCollector.h - remove unnecessary includes. NFC. 2020-07-23 12:33:13 +01:00
ValueProfilePlugins.inc [llvm] Use isa instead of dyn_cast (NFC) 2021-01-29 23:23:37 -08:00