// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-target-device \ // RUN: -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-target-device \ // RUN: -fclangir -emit-llvm %s -o %t.ll // RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-target-device \ // RUN: -emit-llvm %s -o %t.ll // RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG // Test device-side filtering of globals, mirroring CGOpenMPRuntime logic: // - declare target functions and their transitive callees are emitted // - host-only functions are filtered out // - device_type(host) functions are filtered out on the device // - host functions containing target regions are kept // ---- declare target block: emitted on device ---- #pragma omp declare target void regular_func() {} struct S { int x; S() : x(42) {} ~S() {} }; void caller() { regular_func(); S s; } #pragma omp end declare target // CIR-DAG: cir.func {{.*}} @_Z12regular_funcv() {{.*}}omp.declare_target = #omp.declaretarget