Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / constructor-direct-call.cpp
blobca69d0f76ee694b65ffd6d8bd600c492f5edb0c6
1 // RUN: %clang_cc1 -triple i686-pc-mingw32 -fms-extensions -Wmicrosoft %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK32 --check-prefix=CHECK
2 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc19.11.0 -fms-extensions -Wmicrosoft %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK64 --check-prefix=CHECK
4 class Test1 {
5 public:
6 int a;
7 };
9 void f1() {
10 Test1 var;
11 var.Test1::Test1();
13 // CHECK32: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %{{.*}}, ptr align 4 %{{.*}}, i32 4, i1 false)
14 // CHECK64: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %{{.*}}, ptr align 4 %{{.*}}, i64 4, i1 false)
15 var.Test1::Test1(var);
18 class Test2 {
19 public:
20 Test2() { a = 10; b = 10; }
21 int a;
22 int b;
25 void f2() {
26 // CHECK: %var = alloca %class.Test2, align 4
27 // CHECK32-NEXT: call x86_thiscallcc void @_ZN5Test2C1Ev(ptr {{[^,]*}} %var)
28 // CHECK64-NEXT: %call = call noundef ptr @"??0Test2@@QEAA@XZ"(ptr {{[^,]*}} %var)
29 Test2 var;
31 // CHECK32-NEXT: call x86_thiscallcc void @_ZN5Test2C1Ev(ptr {{[^,]*}} %var)
32 // CHECK64-NEXT: %call1 = call noundef ptr @"??0Test2@@QEAA@XZ"(ptr {{[^,]*}} %var)
33 var.Test2::Test2();
35 // CHECK32: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %{{.*}}, ptr align 4 %{{.*}}, i32 8, i1 false)
36 // CHECK64: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %{{.*}}, ptr align 4 %{{.*}}, i64 8, i1 false)
37 var.Test2::Test2(var);
43 class Test3 {
44 public:
45 Test3() { a = 10; b = 15; c = 20; }
46 Test3(const Test3& that) { a = that.a; b = that.b; c = that.c; }
47 int a;
48 int b;
49 int c;
52 void f3() {
53 // CHECK32: call x86_thiscallcc void @_ZN5Test3C1Ev(ptr {{[^,]*}} %var)
54 // CHECK64: %call = call noundef ptr @"??0Test3@@QEAA@XZ"(ptr {{[^,]*}} %var)
55 Test3 var;
57 // CHECK32-NEXT: call x86_thiscallcc void @_ZN5Test3C1Ev(ptr {{[^,]*}} %var2)
58 // CHECK64-NEXT: %call1 = call noundef ptr @"??0Test3@@QEAA@XZ"(ptr {{[^,]*}} %var2)
59 Test3 var2;
61 // CHECK32-NEXT: call x86_thiscallcc void @_ZN5Test3C1Ev(ptr {{[^,]*}} %var)
62 // CHECK64-NEXT: %call2 = call noundef ptr @"??0Test3@@QEAA@XZ"(ptr {{[^,]*}} %var)
63 var.Test3::Test3();
65 // CHECK32-NEXT: call x86_thiscallcc void @_ZN5Test3C1ERKS_(ptr {{[^,]*}} %var, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %var2)
66 // CHECK64-NEXT: %call3 = call noundef ptr @"??0Test3@@QEAA@AEBV0@@Z"(ptr {{[^,]*}} %var, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %var2)
67 var.Test3::Test3(var2);