Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / pr20897.cpp
blob5412c7dc91fba530935f4dd06fc2338471295a9c
1 // RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -emit-llvm -std=c++1y -O0 -o - %s | FileCheck %s
2 struct Base {};
4 // __declspec(dllexport) causes us to export the implicit constructor.
5 struct __declspec(dllexport) Derived : virtual Base {
6 // CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc noundef ptr @"??0Derived@@QAE@ABU0@@Z"
7 // CHECK: %[[this:.*]] = load ptr, ptr {{.*}}
8 // CHECK-NEXT: store ptr %[[this]], ptr %[[retval:.*]]
9 // CHECK: %[[dest_a_gep:.*]] = getelementptr inbounds %struct.Derived, ptr %[[this]], i32 0, i32 1
10 // CHECK-NEXT: %[[src_load:.*]] = load ptr, ptr {{.*}}
11 // CHECK-NEXT: %[[src_a_gep:.*]] = getelementptr inbounds %struct.Derived, ptr %[[src_load:.*]], i32 0, i32 1
12 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %[[dest_a_gep]], ptr align 4 %[[src_a_gep]], i64 1, i1 false)
13 // CHECK-NEXT: %[[dest_this:.*]] = load ptr, ptr %[[retval]]
14 // CHECK-NEXT: ret ptr %[[dest_this]]
15 bool a : 1;
16 bool b : 1;
19 // __declspec(dllexport) causes us to export the implicit copy constructor.
20 struct __declspec(dllexport) Derived2 : virtual Base {
21 // CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc noundef ptr @"??0Derived2@@QAE@ABU0@@Z"
22 // CHECK: %[[this:.*]] = load ptr, ptr {{.*}}
23 // CHECK-NEXT: store ptr %[[this]], ptr %[[retval:.*]]
24 // CHECK: %[[dest_a_gep:.*]] = getelementptr inbounds %struct.Derived2, ptr %[[this]], i32 0, i32 1
25 // CHECK-NEXT: %[[src_load:.*]] = load ptr, ptr {{.*}}
26 // CHECK-NEXT: %[[src_a_gep:.*]] = getelementptr inbounds %struct.Derived2, ptr %[[src_load:.*]], i32 0, i32 1
27 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %[[dest_a_gep]], ptr align 4 %[[src_a_gep]], i32 4, i1 false)
28 // CHECK-NEXT: %[[dest_this:.*]] = load ptr, ptr %[[retval]]
29 // CHECK-NEXT: ret ptr %[[dest_this]]
30 int Array[1];