Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / PowerPC / aix-ignore-xcoff-visibility.cpp
blob12728058e87ee4242a21874a9c1a6f66e60ef4a9
1 // RUN: %clang_cc1 -triple powerpc-unknown-aix -emit-llvm -o - -x c++ %s | \
2 // RUN: FileCheck -check-prefix=VISIBILITY-IR %s
4 // RUN: %clang_cc1 -triple powerpc-unknown-aix -emit-llvm -round-trip-args -o - -x c++ %s | \
5 // RUN: FileCheck -check-prefix=VISIBILITY-IR %s
7 // RUN: %clang_cc1 -triple powerpc-unknown-aix -mignore-xcoff-visibility -fvisibility=default -emit-llvm -o - -x c++ %s | \
8 // RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s
10 // RUN: %clang_cc1 -triple powerpc-unknown-aix -mignore-xcoff-visibility -fvisibility=default -emit-llvm -round-trip-args -o - -x c++ %s | \
11 // RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s
13 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fvisibility=default -emit-llvm -o - -x c++ %s | \
14 // RUN: FileCheck -check-prefix=VISIBILITY-IR %s
16 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fvisibility=default -round-trip-args -emit-llvm -o - -x c++ %s | \
17 // RUN: FileCheck -check-prefix=VISIBILITY-IR %s
19 __attribute__((visibility("hidden"))) void foo_h(int *p) {
20 (*p)++;
23 __attribute__((visibility("protected"))) int b;
25 extern __attribute__((visibility("hidden"))) void zoo_extern_h(void);
27 void (*foo_p)(void) = zoo_extern_h;
29 __attribute__((visibility("protected"))) void bar() {
30 foo_h(&b);
31 foo_p();
34 class TestClass {
35 public:
36 __attribute__((__visibility__("hidden"))) int value() const noexcept { return 0; }
39 int main() {
40 TestClass TC;
41 return TC.value();
44 template <class T>
45 class basic {
46 public:
47 __attribute__((__visibility__("protected"))) int getdata() { return 1; }
50 template class basic<int>;
52 #pragma GCC visibility push(hidden)
53 int pramb;
54 void prambar() {}
55 #pragma GCC visibility pop
57 // VISIBILITY-IR: @b = protected global i32 0
58 // VISIBILITY-IR: @pramb = hidden global i32 0
59 // VISIBILITY-IR: define hidden void @_Z5foo_hPi(ptr noundef %p)
60 // VISIBILITY-IR: declare hidden void @_Z12zoo_extern_hv()
61 // VISIBILITY-IR: define protected void @_Z3barv()
62 // VISIBILITY-IR: define linkonce_odr hidden noundef i32 @_ZNK9TestClass5valueEv(ptr {{[^,]*}} %this)
63 // VISIBILITY-IR: define weak_odr protected noundef i32 @_ZN5basicIiE7getdataEv(ptr {{[^,]*}} %this)
64 // VISIBILITY-IR: define hidden void @_Z7prambarv()
66 // NOVISIBILITY-IR: @b = global i32 0
67 // NOVISIBILITY-IR: @pramb = global i32 0
68 // NOVISIBILITY-IR: define void @_Z5foo_hPi(ptr noundef %p)
69 // NOVISIBILITY-IR: declare void @_Z12zoo_extern_hv()
70 // NOVISIBILITY-IR: define void @_Z3barv()
71 // NOVISIBILITY-IR: define linkonce_odr noundef i32 @_ZNK9TestClass5valueEv(ptr {{[^,]*}} %this)
72 // NOVISIBILITY-IR: define weak_odr noundef i32 @_ZN5basicIiE7getdataEv(ptr {{[^,]*}} %this)
73 // NOVISIBILITY-IR: define void @_Z7prambarv()