Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / runtimecc.cpp
blob988b6620626ce6bb5d049808bacd9961fc3d5ebd
1 // RUN: %clang_cc1 %s -triple=armv7-apple-darwin10 -emit-llvm -o - -fexceptions -fcxx-exceptions | FileCheck %s
3 // Check that we annotate all compiler-synthesized runtime calls and
4 // functions with the actual ABI-determined CC. This usually doesn't
5 // matter as long as we're internally consistent (and the LLVM-default
6 // CC is consistent with the real one), but it's possible for user
7 // translation units to define these runtime functions (or, equivalently,
8 // for us to get LTO'ed with such a translation unit), and then the
9 // mismatch will kill us.
11 // CHECK: [[A:%.*]] = type { double }
13 namespace test0 {
14 struct A {
15 double d;
16 A();
17 ~A();
20 A global;
21 // CHECK-LABEL: define internal void @__cxx_global_var_init()
22 // CHECK: call noundef ptr @_ZN5test01AC1Ev(ptr {{[^,]*}} @_ZN5test06globalE)
23 // CHECK-NEXT: call i32 @__cxa_atexit(ptr @_ZN5test01AD1Ev, ptr @_ZN5test06globalE, ptr @__dso_handle) [[NOUNWIND:#[0-9]+]]
24 // CHECK-NEXT: ret void
27 // CHECK: declare i32 @__cxa_atexit(ptr, ptr, ptr) [[NOUNWIND]]
29 namespace test1 {
30 void test() {
31 throw 0;
34 // CHECK-LABEL: define{{.*}} void @_ZN5test14testEv()
35 // CHECK: [[T0:%.*]] = call ptr @__cxa_allocate_exception(i32 4) [[NOUNWIND]]
36 // CHECK-NEXT: store i32 0, ptr [[T0]]
37 // CHECK-NEXT: call void @__cxa_throw(ptr [[T0]], ptr @_ZTIi, ptr null) [[NORETURN:#[0-9]+]]
38 // CHECK-NEXT: unreachable
41 // CHECK: declare ptr @__cxa_allocate_exception(i32)
43 // CHECK: declare void @__cxa_throw(ptr, ptr, ptr)
45 // CHECK-LABEL: define internal void @_GLOBAL__sub_I_runtimecc.cpp()
46 // CHECK: call void @__cxx_global_var_init()
49 // CHECK: attributes [[NOUNWIND]] = { nounwind }
50 // CHECK: attributes [[NORETURN]] = { noreturn }