Files
TheRock/compiler/amd-llvm/clang/test/OpenMP/debug_threadprivate_copyin.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

60 lines
2.1 KiB
C

// This testcase checks emission of debug info for threadprivate variables
// present in any clause of OpenMP construct.
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -debug-info-kind=constructor -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s
// expected-no-diagnostics
// CHECK: define internal void @main.omp_outlined_debug__(
// CHECK: #dbg_declare(ptr %.global_tid..addr,
// CHECK: #dbg_declare(ptr %.bound_tid..addr,
// CHECK: #dbg_declare(ptr %nt.addr
// CHECK: store ptr %gbl_dynamic_int, ptr %gbl_dynamic_int.addr, align 8
// CHECK-NOT: #dbg_declare(ptr %gbl_dynamic_int.addr
// CHECK-NOT: #dbg_declare(ptr %gbl_static_int.addr
extern int printf(const char *, ...);
extern void omp_set_num_threads(int);
extern int omp_get_num_threads(void);
extern int omp_get_thread_num(void);
int gbl_dynamic_int;
__thread int gbl_static_int;
#pragma omp threadprivate(gbl_dynamic_int)
int main() {
int nt = 0;
int offset = 10;
gbl_dynamic_int = 55;
gbl_static_int = 77;
omp_set_num_threads(4);
#pragma omp parallel copyin(gbl_dynamic_int, gbl_static_int)
{
int data;
int tid;
nt = omp_get_num_threads();
tid = omp_get_thread_num();
data = gbl_dynamic_int + gbl_static_int;
gbl_dynamic_int += 10;
gbl_static_int += 20;
#pragma omp barrier
if (tid == 0)
printf("In parallel region total threads = %d, thread id = %d data=%d gbl_dyn_addr = %p, gbl_static_addr = %p\n",
nt, tid, data, &gbl_dynamic_int, &gbl_static_int);
if (tid == 1)
printf("In parallel region total threads = %d, thread id = %d data=%d gbl_dyn_addr = %p, gbl_static_addr = %p\n",
nt, tid, data, &gbl_dynamic_int, &gbl_static_int);
if (tid == 2)
printf("In parallel region total threads = %d, thread id = %d data=%d gbl_dyn_addr = %p, gbl_static_addr = %p\n",
nt, tid, data, &gbl_dynamic_int, &gbl_static_int);
if (tid == 3)
printf("In parallel region total threads = %d, thread id = %d data=%d gbl_dyn_addr = %p, gbl_static_addr = %p\n",
nt, tid, data, &gbl_dynamic_int, &gbl_static_int);
}
return 0;
}