[PATCH] D45742: Fix data race in X86FloatingPoint.cpp ASSERT_SORTED
Bob Haarman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 18 16:07:21 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL330301: Fix data race in X86FloatingPoint.cpp ASSERT_SORTED (authored by inglorion, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D45742?vs=142852&id=143023#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45742
Files:
llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
Index: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
+++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
@@ -599,13 +599,14 @@
#ifdef NDEBUG
#define ASSERT_SORTED(TABLE)
#else
-#define ASSERT_SORTED(TABLE) \
- { static bool TABLE##Checked = false; \
- if (!TABLE##Checked) { \
- assert(std::is_sorted(std::begin(TABLE), std::end(TABLE)) && \
- "All lookup tables must be sorted for efficient access!"); \
- TABLE##Checked = true; \
- } \
+#define ASSERT_SORTED(TABLE) \
+ { \
+ static std::atomic<bool> TABLE##Checked(false); \
+ if (!TABLE##Checked.load(std::memory_order_relaxed)) { \
+ assert(std::is_sorted(std::begin(TABLE), std::end(TABLE)) && \
+ "All lookup tables must be sorted for efficient access!"); \
+ TABLE##Checked.store(true, std::memory_order_relaxed); \
+ } \
}
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45742.143023.patch
Type: text/x-patch
Size: 1508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180418/b4aa5e09/attachment.bin>
More information about the llvm-commits
mailing list