Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / typeid-cxx11-with-address-space.cpp
blobc4e7d36acff130093601d921f1e59a8f4238abc5
1 // RUN: %clang_cc1 -I%S %s -triple amdgcn-amd-amdhsa -emit-llvm -std=c++11 -o - | FileCheck %s
2 #include <typeinfo>
4 namespace Test1 {
6 struct Item {
7 const std::type_info &ti;
8 const char *name;
9 void *(*make)();
12 template<typename T> void *make_impl() { return new T; }
13 template<typename T> constexpr Item item(const char *name) {
14 return { typeid(T), name, make_impl<T> };
17 struct A { virtual ~A(); };
18 struct B : virtual A {};
19 struct C { int n; };
21 // CHECK: @_ZN5Test15itemsE ={{.*}} constant [4 x {{.*}}] [{{.*}} ptr addrspacecast (ptr addrspace(1) @_ZTIN5Test11AE to ptr), {{.*}} @_ZN5Test19make_implINS_1AEEEPvv {{.*}} ptr addrspacecast (ptr addrspace(1) @_ZTIN5Test11BE to ptr), {{.*}} @_ZN5Test19make_implINS_1BEEEPvv {{.*}} ptr addrspacecast (ptr addrspace(1) @_ZTIN5Test11CE to ptr), {{.*}} @_ZN5Test19make_implINS_1CEEEPvv {{.*}} ptr addrspacecast (ptr addrspace(1) @_ZTIi to ptr), {{.*}} @_ZN5Test19make_implIiEEPvv }]
22 extern constexpr Item items[] = {
23 item<A>("A"), item<B>("B"), item<C>("C"), item<int>("int")
26 // CHECK: @_ZN5Test11xE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIN5Test11AE to ptr), align 8
27 constexpr auto &x = items[0].ti;
29 // CHECK: @_ZN5Test11yE ={{.*}} constant ptr addrspacecast (ptr addrspace(1) @_ZTIN5Test11BE to ptr), align 8
30 constexpr auto &y = typeid(B{});