Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / dynamic-cast-address-space.cpp
blobc278988c9647ba15d8c5b91eabe8696aff23ca33
1 // RUN: %clang_cc1 -I%S %s -triple amdgcn-amd-amdhsa -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s
2 struct A { virtual void f(); };
3 struct B : A { };
5 // CHECK: {{define.*@_Z1fP1A}}
6 // CHECK-SAME: personality ptr @__gxx_personality_v0
7 B fail;
8 const B& f(A *a) {
9 try {
10 // CHECK: call ptr @__dynamic_cast
11 // CHECK: br i1
12 // CHECK: invoke void @__cxa_bad_cast() [[NR:#[0-9]+]]
13 dynamic_cast<const B&>(*a);
14 } catch (...) {
15 // CHECK: landingpad { ptr, i32 }
16 // CHECK-NEXT: catch ptr null
18 return fail;
21 // CHECK: declare ptr @__dynamic_cast(ptr, ptr addrspace(1), ptr addrspace(1), i64) [[NUW_RO:#[0-9]+]]
23 // CHECK: attributes [[NUW_RO]] = { nounwind memory(read) }
24 // CHECK: attributes [[NR]] = { noreturn }