[PATCH] D11579: [InstrProfiling] Fix data race on profile counters by using AtomicRMW.

Dmitry Vyukov dvyukov at google.com
Wed Jul 29 22:27:17 PDT 2015


dvyukov added a subscriber: dvyukov.
dvyukov added a comment.

If your intention is to fix data races rather than to improve precision, then the more straightforward fix would be:

  atomic_store_n(&cnt, atomic_load_n(&cnt, __ATOMIC_RELAXED) + 1, __ATOMIC_RELAXED);

It should not affect performance of the generated code (unless there is a bug in atomic codegen).


http://reviews.llvm.org/D11579







More information about the llvm-commits mailing list