diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2018-06-28 10:03:45 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2018-06-28 10:03:45 +0000 |
commit | f9613b2995e1e80e44128e0b62cdce1d3cd3eb21 (patch) | |
tree | 3d8786f20441ad9ad6f9c3b33088e8aabe11af91 /llvm/lib/Target/X86/X86InstrInfo.cpp | |
parent | 9ea80d259f8a8077c9cfbbc125c824d98aad927c (diff) | |
download | bcm5719-llvm-f9613b2995e1e80e44128e0b62cdce1d3cd3eb21.tar.gz bcm5719-llvm-f9613b2995e1e80e44128e0b62cdce1d3cd3eb21.zip |
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
Diffstat (limited to 'llvm/lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86InstrInfo.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 7096e8284ed..7492de27e7b 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -5413,7 +5413,8 @@ X86InstrInfo::X86InstrInfo(X86Subtarget &STI) #ifndef NDEBUG // Make sure the tables are sorted. - static bool LLVM_ATTRIBUTE_UNUSED FoldTablesChecked = [] { + static std::atomic<bool> FoldTablesChecked(false); + if (!FoldTablesChecked.load(std::memory_order_relaxed)) { assert(std::is_sorted(std::begin(MemoryFoldTable2Addr), std::end(MemoryFoldTable2Addr)) && std::adjacent_find(std::begin(MemoryFoldTable2Addr), @@ -5450,8 +5451,8 @@ X86InstrInfo::X86InstrInfo(X86Subtarget &STI) std::end(MemoryFoldTable4)) == std::end(MemoryFoldTable4) && "MemoryFoldTable4 is not sorted and unique!"); - return true; - }(); + FoldTablesChecked.store(true, std::memory_order_relaxed); + } #endif } |