1 // This testcase checks emission of debug info for threadprivate variables
2 // present in any clause of OpenMP construct.
4 // REQUIRES: x86-registered-target
6 // RUN: %clang_cc1 -debug-info-kind=constructor -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s
7 // expected-no-diagnostics
9 // CHECK: define internal void @main.omp_outlined_debug__(
10 // CHECK: #dbg_declare(ptr %.global_tid..addr,
11 // CHECK: #dbg_declare(ptr %.bound_tid..addr,
12 // CHECK: #dbg_declare(ptr %nt.addr
13 // CHECK: store ptr %gbl_dynamic_int, ptr %gbl_dynamic_int.addr, align 8
14 // CHECK-NOT: #dbg_declare(ptr %gbl_dynamic_int.addr
15 // CHECK-NOT: #dbg_declare(ptr %gbl_static_int.addr
17 extern int printf(const char *, ...);
18 extern void omp_set_num_threads(int);
19 extern int omp_get_num_threads(void);
20 extern int omp_get_thread_num(void);
23 __thread
int gbl_static_int
;
25 #pragma omp threadprivate(gbl_dynamic_int)
33 omp_set_num_threads(4);
34 #pragma omp parallel copyin(gbl_dynamic_int, gbl_static_int)
38 nt
= omp_get_num_threads();
39 tid
= omp_get_thread_num();
40 data
= gbl_dynamic_int
+ gbl_static_int
;
41 gbl_dynamic_int
+= 10;
45 printf("In parallel region total threads = %d, thread id = %d data=%d gbl_dyn_addr = %p, gbl_static_addr = %p\n",
46 nt
, tid
, data
, &gbl_dynamic_int
, &gbl_static_int
);
48 printf("In parallel region total threads = %d, thread id = %d data=%d gbl_dyn_addr = %p, gbl_static_addr = %p\n",
49 nt
, tid
, data
, &gbl_dynamic_int
, &gbl_static_int
);
51 printf("In parallel region total threads = %d, thread id = %d data=%d gbl_dyn_addr = %p, gbl_static_addr = %p\n",
52 nt
, tid
, data
, &gbl_dynamic_int
, &gbl_static_int
);
54 printf("In parallel region total threads = %d, thread id = %d data=%d gbl_dyn_addr = %p, gbl_static_addr = %p\n",
55 nt
, tid
, data
, &gbl_dynamic_int
, &gbl_static_int
);