[RISCV] Simplify MIPS CCMov patterns. NFC (#125318)
[llvm-project.git] / compiler-rt / test / tsan / ignorelist2.cpp
blobf3f636a1263f3aaf8e75fb5295d5fe3d8d49ca96
1 // Test that ignorelisted functions are still contained in the stack trace.
3 // RUN: echo "fun:*Ignorelisted_Thread2*" > %t.ignorelist
4 // RUN: echo "fun:*CallTouchGlobal*" >> %t.ignorelist
6 // RUN: %clangxx_tsan -O1 %s -fsanitize-ignorelist=%t.ignorelist -o %t
7 // RUN: %deflake %run %t 2>&1 | FileCheck %s
8 #include "test.h"
10 int Global;
12 void *Thread1(void *x) {
13 barrier_wait(&barrier);
14 // CHECK: ThreadSanitizer: data race
15 // CHECK: Write of size 4
16 // CHECK: #0 Thread1{{.*}}ignorelist2.cpp:[[@LINE+1]]
17 Global++;
18 return NULL;
21 __attribute__((noinline)) void TouchGlobal() {
22 // CHECK: Previous write of size 4
23 // CHECK: #0 TouchGlobal{{.*}}ignorelist2.cpp:[[@LINE+1]]
24 Global--;
27 __attribute__((noinline)) void CallTouchGlobal() {
28 // CHECK: #1 CallTouchGlobal{{.*}}ignorelist2.cpp:[[@LINE+1]]
29 TouchGlobal();
32 void *Ignorelisted_Thread2(void *x) {
33 Global--;
34 // CHECK: #2 Ignorelisted_Thread2{{.*}}ignorelist2.cpp:[[@LINE+1]]
35 CallTouchGlobal();
36 barrier_wait(&barrier);
37 return NULL;
40 int main() {
41 barrier_init(&barrier, 2);
42 pthread_t t[2];
43 pthread_create(&t[0], NULL, Thread1, NULL);
44 pthread_create(&t[1], NULL, Ignorelisted_Thread2, NULL);
45 pthread_join(t[0], NULL);
46 pthread_join(t[1], NULL);
47 fprintf(stderr, "PASS\n");
48 return 0;