History log of /llvm-project/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp (Results 1 – 25 of 165)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# 6292a808 24-Jan-2025 Jeremy Morse <jeremy.morse@sony.com>

[NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (#123737)

As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNo

[NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (#123737)

As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNonPHI and similar feed into
instruction insertion positions. Call-sites where that's necessary were
updated a year ago; but to ensure some type safety however, we'd like to
have all calls to getFirstNonPHI use the iterator-returning version.

This patch changes a bunch of call-sites calling getFirstNonPHI to use
getFirstNonPHIIt, which returns an iterator. All these call sites are
where it's obviously safe to fetch the iterator then dereference it. A
follow-up patch will contain less-obviously-safe changes.

We'll eventually deprecate and remove the instruction-pointer
getFirstNonPHI, but not before adding concise documentation of what
considerations are needed (very few).

---------

Co-authored-by: Stephen Tozer <Melamoto@gmail.com>

show more ...


Revision tags: llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# 4d12a143 06-Nov-2024 Kazu Hirata <kazu@google.com>

[Instrumentation] Remove unused includes (NFC) (#115117)

Identified with misc-include-cleaner.


Revision tags: llvmorg-19.1.3
# d9c95efb 16-Oct-2024 Jay Foad <jay.foad@amd.com>

[LLVM] Make more use of IRBuilder::CreateIntrinsic. NFC. (#112546)

Convert almost every instance of:
CreateCall(Intrinsic::getOrInsertDeclaration(...), ...)
to the equivalent CreateIntrinsic cal

[LLVM] Make more use of IRBuilder::CreateIntrinsic. NFC. (#112546)

Convert almost every instance of:
CreateCall(Intrinsic::getOrInsertDeclaration(...), ...)
to the equivalent CreateIntrinsic call.

show more ...


Revision tags: llvmorg-19.1.2
# fa789dff 11-Oct-2024 Rahul Joshi <rjoshi@nvidia.com>

[NFC] Rename `Intrinsic::getDeclaration` to `getOrInsertDeclaration` (#111752)

Rename the function to reflect its correct behavior and to be consistent
with `Module::getOrInsertFunction`. This is a

[NFC] Rename `Intrinsic::getDeclaration` to `getOrInsertDeclaration` (#111752)

Rename the function to reflect its correct behavior and to be consistent
with `Module::getOrInsertFunction`. This is also in preparation of
adding a new `Intrinsic::getDeclaration` that will have behavior similar
to `Module::getFunction` (i.e, just lookup, no creation).

show more ...


Revision tags: llvmorg-19.1.1, llvmorg-19.1.0
# 2ae968a0 16-Sep-2024 Antonio Frighetto <10052132+antoniofrighetto@users.noreply.github.com>

[Instrumentation] Move out to Utils (NFC) (#108532)

Utility functions have been moved out to Utils. Minor opportunity to
drop the header where not needed.


Revision tags: llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3
# 62ced811 12-Aug-2024 Chaitanya <Krishna.Sankisa@amd.com>

[Sanitizer] Make sanitizer passes idempotent (#99439)

This PR changes the sanitizer passes to be idempotent.
When any sanitizer pass is run after it has already been run before,
double instrument

[Sanitizer] Make sanitizer passes idempotent (#99439)

This PR changes the sanitizer passes to be idempotent.
When any sanitizer pass is run after it has already been run before,
double instrumentation is seen in the resulting IR. This happens because
there is no check in the pass, to verify if IR has been instrumented
before.

This PR checks if "nosanitize_*" module flag is already present and if
true, return early without running the pass again.

show more ...


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# 9df71d76 28-Jun-2024 Nikita Popov <npopov@redhat.com>

[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)

Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, re

[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)

Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, replacing the
current `getParent()->getDataLayout()` pattern.

show more ...


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6
# a441645f 03-May-2024 Vitaly Buka <vitalybuka@google.com>

[tsan] Don't crash on vscale (#91018)

Co-authored-by: Heejin Ahn <aheejin@gmail.com>


Revision tags: llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2
# 8a237ab7 15-Mar-2024 Nikita Popov <npopov@redhat.com>

[TSan] Avoid use of ReplaceInstWithInst()

This is mainly for consistency across code paths, but also makes
sure that all calls use IRInstrumentationBuilder and its special
debuginfo handling.

The t

[TSan] Avoid use of ReplaceInstWithInst()

This is mainly for consistency across code paths, but also makes
sure that all calls use IRInstrumentationBuilder and its special
debuginfo handling.

The two remaining uses don't actually need RAUW, they just have
to erase the original instruction.

show more ...


# ff2fb2a1 15-Mar-2024 Nikita Popov <npopov@redhat.com>

[TSan] Fix atomicrmw xchg with pointer and floats (#85228)

atomicrmw xchg also accepts pointer and floating-point values. To handle
those, insert necessary casts to and from integer. This is what w

[TSan] Fix atomicrmw xchg with pointer and floats (#85228)

atomicrmw xchg also accepts pointer and floating-point values. To handle
those, insert necessary casts to and from integer. This is what we do
for cmpxchg as well.

Fixes https://github.com/llvm/llvm-project/issues/85226.

show more ...


Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5
# 3ca4fe80 06-Nov-2023 Simon Pilgrim <llvm-dev@redking.me.uk>

[Transforms] Use StringRef::starts_with/ends_with instead of startswith/endswith. NFC.

startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)


Revision tags: llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4
# 5624e86a 25-Aug-2023 Fangrui Song <i@maskray.me>

[tsan] Respect !nosanitize metadata and remove gcov special case

Certain instrumentations set the !nosanitize metadata for inserted
instructions, which are generally not interested for sanitizers. S

[tsan] Respect !nosanitize metadata and remove gcov special case

Certain instrumentations set the !nosanitize metadata for inserted
instructions, which are generally not interested for sanitizers. Skip
tsan instrumentation like we do for asan (D126294)/msan/hwasan.

-fprofile-arcs instrumentation has data race unless
-fprofile-update=atomic is specified. Let's remove the the `__llvm_gcov`
special case from commit 0222adbcd25779a156399bcc16fde9f6d083a809 (2016)
as the racy instructions have the !nosanitize metadata.
(-fprofile-arcs instrumentation does not use `__llvm_gcda` as global variables.)

```
std::atomic<int> c;
void foo() { c++; }
int main() {
std::thread th(foo);
c++;
th.join();
}
```
Tested that `clang++ --coverage -fsanitize=thread a.cc && ./a.out` does
not report spurious tsan errors.

Also remove the default CC1 option -fprofile-update=atomic for
-fsanitize=thread to make options more orthogonal.

Reviewed By: Enna1

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

show more ...


Revision tags: llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2
# e6e9a875 31-Jul-2023 Bjorn Pettersson <bjorn.a.pettersson@ericsson.com>

Drop some typed pointer handling

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


Revision tags: llvmorg-17.0.0-rc1, llvmorg-18-init
# 9cf52548 18-Jul-2023 Nikita Popov <npopov@redhat.com>

[llvm] Remove some uses of isOpaqueOrPointeeTypeEquals() (NFC)


# 4eef2e30 17-Jul-2023 Marco Elver <elver@google.com>

[ThreadSanitizer] Add fallback DebugLocation for memintrinsic calls

When building with debug info enabled, some load/store instructions do
not have a DebugLocation attached. When using the default I

[ThreadSanitizer] Add fallback DebugLocation for memintrinsic 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.

Add a fallback DebugLocation with the help of InstrumentationIRBuilder for
memintrinsics. In particular, the compiler may optimize load/store without
debug info into memintrinsics, which then are missing debug info as well.

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2
# 55e2cd16 28-Jan-2023 Kazu Hirata <kazu@google.com>

Use llvm::count{lr}_{zero,one} (NFC)


Revision tags: llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1
# dc3875e4 15-Sep-2022 Jonas Paulsson <paulsson@linux.vnet.ibm.com>

Add parameter extension attributes in various instrumentation passes.

For the targets that have in their ABI the requirement that arguments and
return values are extended to the full register bitwid

Add parameter extension attributes in various instrumentation passes.

For the targets that have in their ABI the requirement that arguments and
return values are extended to the full register bitwidth, it is important
that calls when built also take care of this detail.

The OMPIRBuilder, AddressSanitizer, GCOVProfiling, MemorySanitizer and
ThreadSanitizer passes are with this patch hopefully now doing this properly.

Reviewed By: Eli Friedman, Ulrich Weigand, Johannes Doerfert

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

show more ...


# 21c4dc79 17-Dec-2022 Fangrui Song <i@maskray.me>

std::optional::value => operator*/operator->

value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_E

std::optional::value => operator*/operator->

value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).

This fixes clang.

show more ...


# 45a892d0 11-Dec-2022 Manuel Brito <manuel.brito@tecnico.ulisboa.pt>

Use poison instead of undef where its used as a placeholder [NFC]

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


# a996cc21 05-Dec-2022 Fangrui Song <i@maskray.me>

Remove unused #include "llvm/ADT/Optional.h"


Revision tags: llvmorg-15.0.0
# b4257d3b 04-Sep-2022 Vitaly Buka <vitalybuka@google.com>

[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

[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

show more ...


# c51a12d5 06-Sep-2022 Vitaly Buka <vitalybuka@google.com>

Revert "[tsan] Replace mem intrinsics with calls to interceptors"

Breaks
http://45.33.8.238/macm1/43944/step_4.txt
https://lab.llvm.org/buildbot/#/builders/70/builds/26926

This reverts commit 77654

Revert "[tsan] Replace mem intrinsics with calls to interceptors"

Breaks
http://45.33.8.238/macm1/43944/step_4.txt
https://lab.llvm.org/buildbot/#/builders/70/builds/26926

This reverts commit 77654a65a373da9c4829de821e7b393ea811ee40.

show more ...


# 77654a65 04-Sep-2022 Vitaly Buka <vitalybuka@google.com>

[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

[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

show more ...


Revision tags: llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2
# de9d80c1 08-Aug-2022 Fangrui Song <i@maskray.me>

[llvm] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

With C++17 there is no Clang pedantic warning or MSVC C5051.


# e20d210e 08-Aug-2022 Kazu Hirata <kazu@google.com>

[llvm] Qualify auto (NFC)

Identified with readability-qualified-auto.


1234567