Unify sorted asserts to use the existing atomic pattern
These are all benign races and only visible in !NDEBUG. tsan complains
about it, but a simple atomic bool is sufficient to make it happy.
llvm-svn: 335823
diff --git a/llvm/lib/Target/X86/X86EvexToVex.cpp b/llvm/lib/Target/X86/X86EvexToVex.cpp
index fb7217b..8352ebc 100644
--- a/llvm/lib/Target/X86/X86EvexToVex.cpp
+++ b/llvm/lib/Target/X86/X86EvexToVex.cpp
@@ -239,15 +239,15 @@
#ifndef NDEBUG
// Make sure the tables are sorted.
- static bool TableChecked = false;
- if (!TableChecked) {
+ static std::atomic<bool> TableChecked(false);
+ if (!TableChecked.load(std::memory_order_relaxed)) {
assert(std::is_sorted(std::begin(X86EvexToVex128CompressTable),
std::end(X86EvexToVex128CompressTable)) &&
"X86EvexToVex128CompressTable is not sorted!");
assert(std::is_sorted(std::begin(X86EvexToVex256CompressTable),
std::end(X86EvexToVex256CompressTable)) &&
"X86EvexToVex256CompressTable is not sorted!");
- TableChecked = true;
+ TablesChecked.store(true, std::memory_order_relaxed);
}
#endif