[compiler-rt] 823625c - [nfc][tsan] Simplify morder conversion (#115075)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 13:50:49 PST 2024
Author: Vitaly Buka
Date: 2024-11-05T13:50:46-08:00
New Revision: 823625cf1d9aba4017a486cfdd3e4b9b94c5ef49
URL: https://github.com/llvm/llvm-project/commit/823625cf1d9aba4017a486cfdd3e4b9b94c5ef49
DIFF: https://github.com/llvm/llvm-project/commit/823625cf1d9aba4017a486cfdd3e4b9b94c5ef49.diff
LOG: [nfc][tsan] Simplify morder conversion (#115075)
All valid values should fit into a byte.
This slightly reduce generated code on x86_64.
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp b/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
index d12e0f596a7fb4..dd37e86ebd7583 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
@@ -515,7 +515,9 @@ static morder to_morder(int mo) {
// since we use __sync_ atomics for actual atomic operations,
// we can safely ignore it as well. It also subtly affects semantics,
// but we don't model the
diff erence.
- return static_cast<morder>(mo & 0x7fff);
+ morder res = static_cast<morder>(static_cast<u8>(mo));
+ DCHECK_LE(res, mo_seq_cst);
+ return res;
}
# define ATOMIC_IMPL(func, mo, ...) \
More information about the llvm-commits
mailing list