[SanitizerBinaryMetadata] Treat constant globals and non-escaping addresses specially
authorMarco Elver <elver@google.com>
Fri, 3 Feb 2023 14:34:42 +0000 (15:34 +0100)
committerMarco Elver <elver@google.com>
Fri, 3 Feb 2023 14:35:24 +0000 (15:35 +0100)
commit960b4c3b5d2bd4bffacfd9382d7c10563faefb89
tree2453dba848f3175b021b7efe2bfa733534bde001
parent0f4d5925b9315d41c14f43e44a36a9c15c3692a9
[SanitizerBinaryMetadata] Treat constant globals and non-escaping addresses specially

For atomics metadata, we can make data race analysis more efficient by
entirely ignoring functions that include memory accesses but which only
access non-escaping (non-shared) and/or non-mutable memory. Such
functions will not be considered to be covered by "atomics" metadata,
resulting in the following benefits:

  1. reduces "covered" metadata; and
  2. allows data race analysis to skip such functions.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D143159
compiler-rt/test/metadata/covered.cpp
llvm/include/llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h
llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
llvm/test/Instrumentation/SanitizerBinaryMetadata/pretend-atomic-access.ll
llvm/test/Instrumentation/SanitizerBinaryMetadata/shared-mutable.ll [new file with mode: 0644]