Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / bench_single_writer.cpp
blob3d2ea150b5fbc814b35ccba7ea02876573c8fe8b
1 // RUN: %clangxx_tsan %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s
4 // bench.h needs pthread barriers which are not available on OS X
5 // UNSUPPORTED: darwin
7 #include "bench.h"
9 int x;
11 void thread(int tid) {
12 if (tid == 0) {
13 for (int i = 0; i < bench_niter; i++)
14 __atomic_store_n(&x, 0, __ATOMIC_RELEASE);
15 } else {
16 for (int i = 0; i < bench_niter; i++)
17 __atomic_load_n(&x, __ATOMIC_ACQUIRE);
21 void bench() {
22 start_thread_group(bench_nthread, thread);
25 // CHECK: DONE