[PATCH] D118024: [sanitizer_common] Use atomic builtin in sanitizer_atomic_clang.h
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 27 05:06:53 PST 2022
ro updated this revision to Diff 403611.
ro added a comment.
Use `__ATOMIC_SEQ_CST`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118024/new/
https://reviews.llvm.org/D118024
Files:
compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h
Index: compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h
@@ -74,13 +74,8 @@
inline bool atomic_compare_exchange_strong(volatile T *a, typename T::Type *cmp,
typename T::Type xchg,
memory_order mo) {
- typedef typename T::Type Type;
- Type cmpv = *cmp;
- Type prev;
- prev = __sync_val_compare_and_swap(&a->val_dont_use, cmpv, xchg);
- if (prev == cmpv) return true;
- *cmp = prev;
- return false;
+ return __atomic_compare_exchange(&a->val_dont_use, cmp, &xchg, false, mo,
+ __ATOMIC_SEQ_CST);
}
template<typename T>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118024.403611.patch
Type: text/x-patch
Size: 852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220127/79e793f2/attachment.bin>
More information about the llvm-commits
mailing list