llvm.org GIT mirror llvm / 4b0e4cb
[X86] Make folding table checking threadsafe This is a benign race, but tsan likes to complain about it. Just make it happy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335788 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 1 year, 4 months ago
1 changed file(s) with 3 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
54125412
54135413 #ifndef NDEBUG
54145414 // Make sure the tables are sorted.
5415 static bool FoldTablesChecked = false;
5416 if (!FoldTablesChecked) {
5415 static bool LLVM_ATTRIBUTE_UNUSED FoldTablesChecked = [] {
54175416 assert(std::is_sorted(std::begin(MemoryFoldTable2Addr),
54185417 std::end(MemoryFoldTable2Addr)) &&
54195418 std::adjacent_find(std::begin(MemoryFoldTable2Addr),
54505449 std::end(MemoryFoldTable4)) ==
54515450 std::end(MemoryFoldTable4) &&
54525451 "MemoryFoldTable4 is not sorted and unique!");
5453 FoldTablesChecked = true;
5454 }
5452 return true;
5453 }();
54555454 #endif
54565455 }
54575456