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 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