Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / cxx0x-initializer-constructors.cpp
blob806c19f5dde8839b8914a7fe37a4b2f2e9de4a4e
1 // RUN: %clang_cc1 -std=c++11 -S -triple x86_64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s
3 struct S {
4 S(int x) { }
5 S(int x, double y, double z) { }
6 };
8 void fn1() {
9 // CHECK-LABEL: define{{.*}} void @_Z3fn1v
10 S s { 1 };
11 // CHECK: alloca %struct.S, align 1
12 // CHECK: call void @_ZN1SC1Ei(ptr {{[^,]*}} %s, i32 noundef 1)
15 void fn2() {
16 // CHECK-LABEL: define{{.*}} void @_Z3fn2v
17 S s { 1, 2.0, 3.0 };
18 // CHECK: alloca %struct.S, align 1
19 // CHECK: call void @_ZN1SC1Eidd(ptr {{[^,]*}} %s, i32 noundef 1, double noundef 2.000000e+00, double noundef 3.000000e+00)
22 void fn3() {
23 // CHECK-LABEL: define{{.*}} void @_Z3fn3v
24 S sa[] { { 1 }, { 2 }, { 3 } };
25 // CHECK: alloca [3 x %struct.S], align 1
26 // CHECK: call void @_ZN1SC1Ei(ptr {{[^,]*}} %{{.+}}, i32 noundef 1)
27 // CHECK: call void @_ZN1SC1Ei(ptr {{[^,]*}} %{{.+}}, i32 noundef 2)
28 // CHECK: call void @_ZN1SC1Ei(ptr {{[^,]*}} %{{.+}}, i32 noundef 3)
31 void fn4() {
32 // CHECK-LABEL: define{{.*}} void @_Z3fn4v
33 S sa[] { { 1, 2.0, 3.0 }, { 4, 5.0, 6.0 } };
34 // CHECK: alloca [2 x %struct.S], align 1
35 // CHECK: call void @_ZN1SC1Eidd(ptr {{[^,]*}} %{{.+}}, i32 noundef 1, double noundef 2.000000e+00, double noundef 3.000000e+00)
36 // CHECK: call void @_ZN1SC1Eidd(ptr {{[^,]*}} %{{.+}}, i32 noundef 4, double noundef 5.000000e+00, double noundef 6.000000e+00)
39 namespace TreeTransformBracedInit {
40 struct S {};
41 struct T { T(const S &); T(const T&); ~T(); };
42 void x(const T &);
43 template<typename> void foo(const S &s) {
44 // Instantiation of this expression used to lose the CXXBindTemporaryExpr
45 // node and thus not destroy the temporary.
46 x({s});
48 template void foo<void>(const S&);
49 // CHECK: define {{.*}} void @_ZN23TreeTransformBracedInit3fooIvEEvRKNS_1SE(
50 // CHECK: call void @_ZN23TreeTransformBracedInit1TC1ERKNS_1SE(
51 // CHECK-NEXT: call void @_ZN23TreeTransformBracedInit1xERKNS_1TE(
52 // CHECK-NEXT: call void @_ZN23TreeTransformBracedInit1TD1Ev(