Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / ignore_race.cpp
blobecbc4c0beab11d8f827fcff124a5a002c09d03bb
1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
2 #include "test.h"
4 int Global;
6 void *Thread(void *x) {
7 AnnotateIgnoreWritesBegin(__FILE__, __LINE__);
8 AnnotateIgnoreReadsBegin(__FILE__, __LINE__);
9 Global = 42;
10 AnnotateIgnoreReadsEnd(__FILE__, __LINE__);
11 AnnotateIgnoreWritesEnd(__FILE__, __LINE__);
12 barrier_wait(&barrier);
13 return 0;
16 int main() {
17 barrier_init(&barrier, 2);
18 pthread_t t;
19 pthread_create(&t, 0, Thread, 0);
20 barrier_wait(&barrier);
21 Global = 43;
22 pthread_join(t, 0);
23 fprintf(stderr, "OK\n");
26 // CHECK-NOT: WARNING: ThreadSanitizer: data race