[PATCH] D18164: [tsan] Do not instrument reads/writes to instruction profile counters.

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 01:11:24 PDT 2016

dvyukov added a comment.

> Back to your proposal to use Monotonic load. It does not fix the actual race

Your definition of race disagrees with C/C++ standards and llvm rules. The proposal does fix the races and eliminates undefined behavior. It is legal to do atomic_store(p, atomic_load(p) + 1) if that's what you want (compiler ought to emit single ADD instruction for that).

> I don't agree with you about the 'incorrect code' part.

Check out http://llvm.org/docs/Atomics.html#optimization-outside-atomic
"The basic 'load' and 'store' allow a variety of optimizations, but can lead to undefined results in a concurrent environment"


More information about the llvm-commits mailing list