Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / static-init-inline-variable.cpp
blob873e32544c7e61269ade4ff43b11b7223a67514b
1 // RUN: %clang_cc1 -std=c++17 -S -emit-llvm -disable-llvm-passes -o - %s -triple x86_64-linux-gnu | FileCheck %s
3 struct A {
4 int x;
5 A(int x) : x(x) {}
6 ~A() {}
7 };
9 namespace DeferredSequence {
10 inline int a = 1;
11 inline int b = a + 1;
12 inline int c = b + 1;
13 inline int d = c + 1;
14 int e = d;
17 namespace MixedSequence {
18 inline A a(1);
19 inline int x = a.x + 1;
20 inline int y = x + 1;
21 inline A b(y);
22 inline int z = b.x + 1;
23 inline int w = z + 1;
24 inline A c(b.x);
25 inline A d(c.x);
26 int t = w;
29 namespace NonDeferredSequence {
30 inline A a(1);
31 inline A b(a.x);
32 inline A c(b.x);
33 inline A d(c.x);
36 // CHECK: @llvm.global_ctors = appending global [16 x { i32, ptr, ptr }] [
37 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.12, ptr @_ZN16DeferredSequence1bE },
38 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.11, ptr @_ZN16DeferredSequence1cE },
39 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.10, ptr @_ZN16DeferredSequence1dE },
40 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.1, ptr @_ZN13MixedSequence1aE },
41 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.14, ptr @_ZN13MixedSequence1xE },
42 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.13, ptr @_ZN13MixedSequence1yE },
43 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.2, ptr @_ZN13MixedSequence1bE },
44 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.16, ptr @_ZN13MixedSequence1zE },
45 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.15, ptr @_ZN13MixedSequence1wE },
46 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.3, ptr @_ZN13MixedSequence1cE },
47 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.4, ptr @_ZN13MixedSequence1dE },
48 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.6, ptr @_ZN19NonDeferredSequence1aE },
49 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.7, ptr @_ZN19NonDeferredSequence1bE },
50 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.8, ptr @_ZN19NonDeferredSequence1cE },
51 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init.9, ptr @_ZN19NonDeferredSequence1dE },
52 // CHECK-SAME: { i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_static_init_inline_variable.cpp, ptr null }