[tsan] Replace mem intrinsics with calls to interceptors
authorVitaly Buka <vitalybuka@google.com>
Sun, 4 Sep 2022 05:24:33 +0000 (22:24 -0700)
committerVitaly Buka <vitalybuka@google.com>
Tue, 6 Sep 2022 15:25:32 +0000 (08:25 -0700)
commit77654a65a373da9c4829de821e7b393ea811ee40
treeb56bf7bf441d03fea371b4a27f729f80b5afa4f6
parent6cc52d594f5cce574eda9822a20823942e48037e
[tsan] Replace mem intrinsics with calls to interceptors

After https://reviews.llvm.org/rG463aa814182a23 tsan replaces llvm
intrinsics with calls to glibc functions. However this approach is
fragile, as slight changes in pipeline can return llvm intrinsics back.
In particular InstCombine can do that.

Msan/Asan already declare own version of these memory
functions for the similar purpose.

KCSAN, or anything that uses something else than compiler-rt, needs to
implement this callbacks.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D133268
compiler-rt/lib/tsan/rtl/tsan.syms.extra
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
compiler-rt/lib/tsan/rtl/tsan_interface.h
llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
llvm/test/Instrumentation/ThreadSanitizer/tsan_basic.ll