llvm-project/llvm/lib/Transforms/Instrumentation
Vedant Kumar ee6c233ae0 [InstrProf] Use atomic profile counter updates for TSan
Thread sanitizer instrumentation fails to skip all loads and stores to
profile counters. This can happen if profile counter updates are merged:

  %.sink = phi i64* ...
  %pgocount5 = load i64, i64* %.sink
  %27 = add i64 %pgocount5, 1
  %28 = bitcast i64* %.sink to i8*
  call void @__tsan_write8(i8* %28)
  store i64 %27, i64* %.sink

To suppress TSan diagnostics about racy counter updates, make the
counter updates atomic when TSan is enabled. If there's general interest
in this mode it can be surfaced as a clang/swift driver option.

Testing: check-{llvm,clang,profile}

rdar://40477803

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

llvm-svn: 339955
2018-08-16 22:24:47 +00:00
..
AddressSanitizer.cpp [ASAN] Use the correct shadow offset for ASAN on FreeBSD/mips64. 2018-08-01 22:51:13 +00:00
BoundsChecking.cpp Fix crash in bounds checking. 2018-08-03 17:12:23 +00:00
CFGMST.h Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
CGProfile.cpp Recommit r335794 "Add support for generating a call graph profile from Branch Frequency Info." with fix for removed functions. 2018-07-16 00:28:24 +00:00
CMakeLists.txt Recommit r335794 "Add support for generating a call graph profile from Branch Frequency Info." with fix for removed functions. 2018-07-16 00:28:24 +00:00
DataFlowSanitizer.cpp Add Triple::isMIPS()/isMIPS32()/isMIPS64(). NFC 2018-06-25 16:49:20 +00:00
EfficiencySanitizer.cpp Add Triple::isMIPS()/isMIPS32()/isMIPS64(). NFC 2018-06-25 16:49:20 +00:00
GCOVProfiling.cpp Remove trailing space 2018-07-30 19:41:25 +00:00
HWAddressSanitizer.cpp [hwasan] Add a basic API. 2018-08-15 00:39:35 +00:00
IndirectCallPromotion.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
InstrProfiling.cpp [InstrProf] Use atomic profile counter updates for TSan 2018-08-16 22:24:47 +00:00
Instrumentation.cpp Revert r335306 (and r335314) - the Call Graph Profile pass. 2018-06-22 05:33:57 +00:00
LLVMBuild.txt
MaximumSpanningTree.h Remove unneeded use of #undef DEBUG_TYPE. NFC 2017-07-12 20:49:21 +00:00
MemorySanitizer.cpp [MSan] Shrink the register save area for non-SSE builds 2018-08-10 08:06:43 +00:00
PGOInstrumentation.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
PGOMemOPSizeOpt.cpp [PGOMemOPSize] Preserve the DominatorTree 2018-07-09 08:07:21 +00:00
SanitizerCoverage.cpp [SanitizerCoverage] Add associated metadata to PC guards. 2018-08-14 22:04:34 +00:00
ThreadSanitizer.cpp Use SmallPtrSet explicitly for SmallSets with pointer types (NFC). 2018-06-12 11:16:56 +00:00