1 // no PCH 2 // RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -include %s -include %s %s -o - | FileCheck %s 3 // with PCH 4 // RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s 5 // no PCH 6 // RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1 7 // RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2 8 // with PCH 9 // RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1 10 // RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2 11 12 // REQUIRES: tls 13 14 #if !defined(PASS1) 15 #define PASS1 16 17 extern "C" int* malloc (int size); 18 int *a = malloc(20); 19 20 #elif !defined(PASS2) 21 #define PASS2 22 23 #pragma omp threadprivate(a) 24 25 #else 26 27 // CHECK: call {{.*}} @__kmpc_threadprivate_register( 28 // CHECK-TLS-1: @{{a|\"\\01\?a@@3PE?AHE?A\"}} = {{.*}}thread_local {{.*}}global {{.*}}i32* 29 30 // CHECK-LABEL: foo 31 // CHECK-TLS-LABEL: foo 32 int foo() { 33 return *a; 34 // CHECK: call {{.*}} @__kmpc_global_thread_num( 35 // CHECK: call {{.*}} @__kmpc_threadprivate_cached( 36 // CHECK-TLS-1: call {{.*}} @{{_ZTW1a|\"\\01\?\?__Ea@@YAXXZ\"}}() 37 } 38 39 // CHECK-TLS-2: define {{.*}} @{{_ZTW1a|\"\\01\?\?__Ea@@YAXXZ\"}}() 40 41 #endif 42