1 // RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -o - | FileCheck %s
3 // For now, just make sure x86_64 doesn't crash.
4 // RUN: %clang_cc1 %s -fno-rtti -triple=x86_64-pc-win32 -emit-llvm -o %t
16 struct D
: virtual C
{
24 D::D() {} // Forces vftable emission.
26 // CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc void @"?f@D@@$4PPPPPPPM@A@AEXXZ"
27 // Note that the vtordisp is applied before really adjusting to D*.
28 // CHECK: %[[ECX:.*]] = load ptr, ptr %{{.*}}
29 // CHECK: %[[VTORDISP_PTR_i8:.*]] = getelementptr inbounds i8, ptr %[[ECX]], i32 -4
30 // CHECK: %[[VTORDISP:.*]] = load i32, ptr %[[VTORDISP_PTR_i8]]
31 // CHECK: %[[VTORDISP_NEG:.*]] = sub i32 0, %[[VTORDISP]]
32 // CHECK: %[[ADJUSTED_i8:.*]] = getelementptr i8, ptr %[[ECX]], i32 %[[VTORDISP_NEG]]
33 // CHECK: call x86_thiscallcc void @"?f@D@@UAEXXZ"(ptr noundef %[[ADJUSTED_i8]])
36 // CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc void @"?f@D@@$4PPPPPPPI@3AEXXZ"
37 // CHECK: %[[ECX:.*]] = load ptr, ptr %{{.*}}
38 // CHECK: %[[VTORDISP_PTR_i8:.*]] = getelementptr inbounds i8, ptr %[[ECX]], i32 -8
39 // CHECK: %[[VTORDISP:.*]] = load i32, ptr %[[VTORDISP_PTR_i8]]
40 // CHECK: %[[VTORDISP_NEG:.*]] = sub i32 0, %[[VTORDISP]]
41 // CHECK: %[[VTORDISP_ADJUSTED_i8:.*]] = getelementptr i8, ptr %[[ECX]], i32 %[[VTORDISP_NEG]]
42 // CHECK: %[[ADJUSTED_i8:.*]] = getelementptr i8, ptr %[[VTORDISP_ADJUSTED_i8]], i32 -4
43 // CHECK: call x86_thiscallcc void @"?f@D@@UAEXXZ"(ptr noundef %[[ADJUSTED_i8]])
46 struct E
: virtual A
{
55 struct G
: virtual F
, virtual E
{
61 G::G() {} // Forces vftable emission.
63 // CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc void @"?f@E@@$R4BA@M@PPPPPPPM@7AEXXZ"(ptr
64 // CHECK: %[[ECX:.*]] = load ptr, ptr %{{.*}}
65 // CHECK: %[[VTORDISP_PTR_i8:.*]] = getelementptr inbounds i8, ptr %[[ECX]], i32 -4
66 // CHECK: %[[VTORDISP:.*]] = load i32, ptr %[[VTORDISP_PTR_i8]]
67 // CHECK: %[[VTORDISP_NEG:.*]] = sub i32 0, %[[VTORDISP]]
68 // CHECK: %[[VTORDISP_ADJUSTED_i8:.*]] = getelementptr i8, ptr %[[ECX]], i32 %[[VTORDISP_NEG]]
69 // CHECK: %[[VBPTR_i8:.*]] = getelementptr inbounds i8, ptr %[[VTORDISP_ADJUSTED_i8]], i32 -16
70 // CHECK: %[[VBTABLE:.*]] = load ptr, ptr %[[VBPTR_i8]]
71 // CHECK: %[[VBOFFSET_PTR:.*]] = getelementptr inbounds i32, ptr %[[VBTABLE]], i32 3
72 // CHECK: %[[VBASE_OFFSET:.*]] = load i32, ptr %[[VBOFFSET_PTR]]
73 // CHECK: %[[VBASE:.*]] = getelementptr inbounds i8, ptr %[[VBPTR_i8]], i32 %[[VBASE_OFFSET]]
74 // CHECK: %[[ARG_i8:.*]] = getelementptr i8, ptr %[[VBASE]], i32 8
75 // CHECK: call x86_thiscallcc void @"?f@E@@UAEXXZ"(ptr noundef %[[ARG_i8]])