Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / init-priority-attr.cpp
blobcac15eb5c06535932f53e0eb7cd88babbf3379d3
1 // RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -O2 -emit-llvm -o - | FileCheck %s
2 // PR11480
4 void foo(int);
6 class A {
7 public:
8 A() { foo(1); }
9 };
11 class A1 {
12 public:
13 A1() { foo(2); }
16 class B {
17 public:
18 B() { foo(3); }
21 class C {
22 public:
23 static A a;
24 C() { foo(4); }
28 A C::a = A();
30 // CHECK: @llvm.global_ctors = appending global [3 x { i32, ptr, ptr }]
31 // CHECK: [{ i32, ptr, ptr } { i32 200, ptr @_GLOBAL__I_000200, ptr null },
32 // CHECK: { i32, ptr, ptr } { i32 300, ptr @_GLOBAL__I_000300, ptr null },
33 // CHECK: { i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_init_priority_attr.cpp, ptr null }]
35 // CHECK: _GLOBAL__I_000200()
36 // CHECK: _Z3fooi(i32 noundef 3)
37 // CHECK-NEXT: ret void
39 // CHECK: _GLOBAL__I_000300()
40 // CHECK: _Z3fooi(i32 noundef 2)
41 // CHECK-NEXT: _Z3fooi(i32 noundef 1)
42 // CHECK-NEXT: ret void
44 // CHECK: _GLOBAL__sub_I_init_priority_attr.cpp()
45 // CHECK: _Z3fooi(i32 noundef 1)
46 // CHECK-NEXT: _Z3fooi(i32 noundef 4)
47 // CHECK-NEXT: ret void
49 C c;
50 A1 a1 __attribute__((init_priority (300)));
51 A a __attribute__((init_priority (300)));
52 B b __attribute__((init_priority (200)));