llvm-project/llvm/test/Instrumentation
Marco Elver 47bdea3f7e [ThreadSanitizer] Add fallback DebugLocation for instrumentation calls
When building with debug info enabled, some load/store instructions do
not have a DebugLocation attached. When using the default IRBuilder, it
attempts to copy the DebugLocation from the insertion-point instruction.
When there's no DebugLocation, no attempt is made to add one.

This is problematic for inserted calls, where the enclosing function has
debug info but the call ends up without a DebugLocation in e.g. LTO
builds that verify that both the enclosing function and calls to
inlinable functions have debug info attached.

This issue was noticed in Linux kernel KCSAN builds with LTO and debug
info enabled:

  | ...
  | inlinable function call in a function with debug info must have a !dbg location
  |   call void @__tsan_read8(i8* %432)
  | ...

To fix, ensure that all calls to the runtime have a DebugLocation
attached, where the possibility exists that the insertion-point might
not have any DebugLocation attached to it.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D124937
2022-05-05 15:21:35 +02:00
..
AddressSanitizer Revert "[asan] Emit .size directive for global object size before redzone" 2022-04-21 16:21:17 -07:00
BoundsChecking [SanitizerBounds] Add support for NoSanitizeBounds function 2022-03-01 18:47:02 +01:00
DataFlowSanitizer [NFC] Rename Instrinsic to Intrinsic 2022-04-25 18:13:23 +01:00
HWAddressSanitizer [hwasan][test] Change -hwasan to -passes=hwasan 2022-04-23 14:07:32 -07:00
HeapProfiler [memprof] Only insert dynamic shadow load when needed 2022-05-02 13:36:00 -07:00
InstrOrderFile
InstrProfiling [AIX][PGO] Enable linux style PGO on AIX 2022-05-05 04:10:39 +00:00
JustMyCode [JMCInstrument] infer proper path style based on debug info 2022-03-10 10:50:44 -08:00
MemorySanitizer [NFC] Rename Instrinsic to Intrinsic 2022-04-25 18:13:23 +01:00
PoisonChecking
SanitizerCoverage [sancov] Don't instrument calls to bitcast funcs: they're not indirect. 2022-03-07 12:43:37 -08:00
ThreadSanitizer [ThreadSanitizer] Add fallback DebugLocation for instrumentation calls 2022-05-05 15:21:35 +02:00
cgprofile.ll [CGProfile] Don't emit call graph profile edges with zero weight 2021-10-28 11:32:49 -04:00