Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_visibility.cpp
blob2554f653170b94f990703112d25493e9f9cffa82
1 // RUN: %clang_cc1 -debug-info-kind=limited -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -o - | FileCheck %s
2 // RUN: %clang_cc1 -debug-info-kind=limited -verify -fopenmp -x c++ -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -o - | FileCheck %s
3 // expected-no-diagnostics
6 #pragma omp declare target
8 struct A {
9 void foo() {}
10 static void sfoo() {}
13 #pragma omp end declare target
15 struct B {
16 void bar();
17 static void sbar();
20 void B::bar() { A a; a.foo(); }
21 void B::sbar() { A::sfoo(); }
22 #pragma omp declare target to(B::bar, B::sbar)
24 [[gnu::visibility("hidden")]] extern const int x = 0;
25 #pragma omp declare target to(x) device_type(nohost)
27 [[gnu::visibility("hidden")]] int y = 0;
28 #pragma omp declare target to(y)
30 // CHECK-DAG: @x = hidden{{.*}} constant i32 0
31 // CHECK-DAG: @y = protected{{.*}} i32 0
32 // CHECK-DAG: define hidden void @_ZN1B4sbarEv()
33 // CHECK-DAG: define linkonce_odr hidden void @_ZN1A4sfooEv()
34 // CHECK-DAG: define hidden void @_ZN1B3barEv(
35 // CHECK-DAG: define linkonce_odr hidden void @_ZN1A3fooEv(