@@ -49,7 +49,7 @@ int f() {
4949// CIR: cir.global linkonce_odr @_ZTT1D = #cir.const_array<[#cir.global_view<@_ZTV1D, [0 : i32, 0 : i32, 3 : i32]> : !cir.ptr<!u8i>, #cir.global_view<@_ZTC1D0_1B, [0 : i32, 0 : i32, 3 : i32]> : !cir.ptr<!u8i>, #cir.global_view<@_ZTC1D0_1B, [0 : i32, 1 : i32, 3 : i32]> : !cir.ptr<!u8i>, #cir.global_view<@_ZTC1D16_1C, [0 : i32, 0 : i32, 3 : i32]> : !cir.ptr<!u8i>, #cir.global_view<@_ZTC1D16_1C, [0 : i32, 1 : i32, 3 : i32]> : !cir.ptr<!u8i>, #cir.global_view<@_ZTV1D, [0 : i32, 2 : i32, 3 : i32]> : !cir.ptr<!u8i>, #cir.global_view<@_ZTV1D, [0 : i32, 1 : i32, 3 : i32]> : !cir.ptr<!u8i>]> : !cir.array<!cir.ptr<!u8i> x 7> {alignment = 8 : i64}
5050
5151// Class B constructor
52- // CIR: cir.func linkonce_odr @_ZN1BC2Ev(%arg0: !cir.ptr<!ty_B> loc({{.*}}), %arg1: !cir.ptr<!cir.ptr<!void>> loc({{.*}})) extra(#fn_attr) {
52+ // CIR: cir.func linkonce_odr @_ZN1BC2Ev(%arg0: !cir.ptr<!ty_B>
5353// CIR: %{{[0-9]+}} = cir.vtt.address_point %{{[0-9]+}} : !cir.ptr<!cir.ptr<!void>>, offset = 0 -> !cir.ptr<!cir.ptr<!void>>
5454// CIR: %{{[0-9]+}} = cir.load align(8) %{{[0-9]+}} : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
5555// CIR: %{{[0-9]+}} = cir.cast(bitcast, %{{[0-9]+}} : !cir.ptr<!ty_B>), !cir.ptr<!cir.ptr<!void>>
@@ -80,7 +80,7 @@ int f() {
8080// LLVM: }
8181
8282// Class C constructor
83- // CIR: cir.func linkonce_odr @_ZN1CC2Ev(%arg0: !cir.ptr<!ty_C> loc({{.*}}), %arg1: !cir.ptr<!cir.ptr<!void>> loc({{.*}})) extra(#fn_attr) {
83+ // CIR: cir.func linkonce_odr @_ZN1CC2Ev(%arg0: !cir.ptr<!ty_C>
8484// CIR: %{{[0-9]+}} = cir.vtt.address_point %{{[0-9]+}} : !cir.ptr<!cir.ptr<!void>>, offset = 0 -> !cir.ptr<!cir.ptr<!void>>
8585// CIR: %{{[0-9]+}} = cir.load align(8) %{{[0-9]+}} : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
8686// CIR: %{{[0-9]+}} = cir.cast(bitcast, %{{[0-9]+}} : !cir.ptr<!ty_C>), !cir.ptr<!cir.ptr<!void>>
@@ -100,7 +100,7 @@ int f() {
100100// CIR: }
101101
102102// Class D constructor
103- // CIR: cir.func linkonce_odr @_ZN1DC1Ev(%arg0: !cir.ptr<!ty_D> loc({{.*}})) extra(#fn_attr) {
103+ // CIR: cir.func linkonce_odr @_ZN1DC1Ev(%arg0: !cir.ptr<!ty_D>
104104// CIR: %{{[0-9]+}} = cir.alloca !cir.ptr<!ty_D>, !cir.ptr<!cir.ptr<!ty_D>>, ["this", init] {alignment = 8 : i64}
105105// CIR: cir.store %arg0, %{{[0-9]+}} : !cir.ptr<!ty_D>, !cir.ptr<!cir.ptr<!ty_D>>
106106// CIR: %[[D_PTR:.*]] = cir.load %0 : !cir.ptr<!cir.ptr<!ty_D>>, !cir.ptr<!ty_D>
@@ -148,4 +148,37 @@ int f() {
148148// LLVM: %[[BASE_C:.*]] = getelementptr i8, ptr %[[THIS]], i32 16
149149// LLVM: call void @_ZN1CC2Ev(ptr %[[BASE_C]], ptr getelementptr inbounds ([7 x ptr], ptr @_ZTT1D, i32 0, i32 3))
150150// LLVM: ret void
151- // LLVM: }
151+ // LLVM: }
152+
153+ namespace other {
154+ struct A {
155+ A ();
156+ ~A ();
157+ };
158+
159+ struct B : virtual A {
160+ B ();
161+ ~B ();
162+ };
163+
164+ extern int foo ();
165+ B::B () {
166+ int x = foo ();
167+ }
168+
169+ B::~B () {
170+ int y = foo ();
171+ }
172+ }
173+
174+ // CIR-LABEL: cir.func @_ZN5other1BD1Ev(
175+ // CIR-SAME: %[[VAL_0:.*]]: !cir.ptr<!ty_other3A3AB>
176+ // CIR: %[[VAL_1:.*]] = cir.alloca !cir.ptr<!ty_other3A3AB>, !cir.ptr<!cir.ptr<!ty_other3A3AB>>, ["this", init] {alignment = 8 : i64}
177+ // CIR: cir.store %[[VAL_0]], %[[VAL_1]] : !cir.ptr<!ty_other3A3AB>, !cir.ptr<!cir.ptr<!ty_other3A3AB>>
178+ // CIR: %[[VAL_2:.*]] = cir.load %[[VAL_1]] : !cir.ptr<!cir.ptr<!ty_other3A3AB>>, !cir.ptr<!ty_other3A3AB>
179+ // CIR: %[[VAL_3:.*]] = cir.vtt.address_point @_ZTTN5other1BE, offset = 0 -> !cir.ptr<!cir.ptr<!void>>
180+ // CIR: cir.call @_ZN5other1BD2Ev(%[[VAL_2]], %[[VAL_3]]) : (!cir.ptr<!ty_other3A3AB>, !cir.ptr<!cir.ptr<!void>>) -> ()
181+ // CIR: %[[VAL_4:.*]] = cir.base_class_addr(%[[VAL_2]] : !cir.ptr<!ty_other3A3AB> nonnull) [0] -> !cir.ptr<!ty_other3A3AA>
182+ // CIR: cir.call @_ZN5other1AD2Ev(%[[VAL_4]]) : (!cir.ptr<!ty_other3A3AA>) -> ()
183+ // CIR: cir.return
184+ // CIR: }
0 commit comments