[Flang] remove whole-archive option for AIX linker (#76039)
[llvm-project.git] / clang / test / CodeGenCXX / template-param-objects-address-space.cpp
blobb54dcfe77934ee23a0738e7900b9fea270a049e6
1 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -std=c++20 %s -emit-llvm -o - | FileCheck %s
3 struct S { char buf[32]; };
4 template<S s> constexpr const char *begin() { return s.buf; }
5 template<S s> constexpr const char *end() { return s.buf + __builtin_strlen(s.buf); }
6 template<S s> constexpr const void *retval() { return &s; }
7 extern const void *callee(const S*);
8 template<S s> constexpr const void* observable_addr() { return callee(&s); }
10 // CHECK: [[HELLO:@_ZTAXtl1StlA32_cLc104ELc101ELc108ELc108ELc111ELc32ELc119ELc111ELc114ELc108ELc100EEEE]]
11 // CHECK-SAME: = linkonce_odr addrspace(1) constant { <{ [11 x i8], [21 x i8] }> } { <{ [11 x i8], [21 x i8] }> <{ [11 x i8] c"hello world", [21 x i8] zeroinitializer }> }, comdat
13 // CHECK: @p
14 // CHECK-SAME: addrspace(1) global ptr addrspacecast (ptr addrspace(1) [[HELLO]] to ptr)
15 const char *p = begin<S{"hello world"}>();
17 // CHECK: @q
18 // CHECK-SAME: addrspace(1) global ptr addrspacecast (ptr addrspace(1) getelementptr (i8, ptr addrspace(1) [[HELLO]], i64 11) to ptr)
19 const char *q = end<S{"hello world"}>();
21 const void *(*r)() = &retval<S{"hello world"}>;
23 // CHECK: @s
24 // CHECK-SAME: addrspace(1) global ptr null
25 const void *s = observable_addr<S{"hello world"}>();
27 // CHECK: define linkonce_odr noundef ptr @_Z6retvalIXtl1StlA32_cLc104ELc101ELc108ELc108ELc111ELc32ELc119ELc111ELc114ELc108ELc100EEEEEPKvv()
28 // CHECK: ret ptr addrspacecast (ptr addrspace(1) [[HELLO]] to ptr)
30 // CHECK: define linkonce_odr noundef ptr @_Z15observable_addrIXtl1StlA32_cLc104ELc101ELc108ELc108ELc111ELc32ELc119ELc111ELc114ELc108ELc100EEEEEPKvv()
31 // CHECK: %call = call noundef ptr @_Z6calleePK1S(ptr noundef addrspacecast (ptr addrspace(1) [[HELLO]] to ptr))
32 // CHECK: declare noundef ptr @_Z6calleePK1S(ptr noundef)