This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Treat non-barrier OSAtomic* functions as barriers to avoid false positives
ClosedPublic

Authored by kubamracek on Jun 26 2016, 6:08 AM.

Details

Summary

The non-barrier versions of OSAtomic* functions are semantically mo_relaxed, but the two variants (e.g. OSAtomicAdd32 and OSAtomicAdd32Barrier) are actually aliases of each other, and we cannot have different interceptors for them, because they're actually the same function. Thus, we have to stay conservative and treat the non-barrier versions as mo_acq_rel.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 61910.Jun 26 2016, 6:08 AM
kubamracek retitled this revision from to [tsan] Treat non-barrier OSAtomic* functions as barriers to avoid false positives.
kubamracek updated this object.
kubamracek added reviewers: dvyukov, kcc, glider.
kubamracek added a project: Restricted Project.
dvyukov accepted this revision.Jun 27 2016, 4:26 AM
dvyukov edited edge metadata.

LGTM with a nit.

lib/tsan/rtl/tsan_interceptors_mac.cc
35 ↗(On Diff #61910)

Please use const int for there.
Constants generally lead to fewer issues during maintenance than text replacements.

This revision is now accepted and ready to land.Jun 27 2016, 4:26 AM
This revision was automatically updated to reflect the committed changes.