================
@@ -47,6 +57,76 @@ void ppp() { B b; }
// OGCG: @_ZTV1B = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x
ptr] [ptr inttoptr (i64 12 to ptr), ptr null, ptr @_ZTI1B] }, comdat, align 8
+// CIR: cir.func {{.*}}@_Z1fv() {
+// CIR: %[[D:.+]] = cir.alloca !rec_Derived, !cir.ptr<!rec_Derived>, ["d",
init]
+// CIR: cir.call @_ZN7DerivedC1Ev(%[[D]]) nothrow : (!cir.ptr<!rec_Derived>)
-> ()
+// CIR: %[[VPTR_PTR:.+]] = cir.vtable.get_vptr %[[D]] :
!cir.ptr<!rec_Derived> -> !cir.ptr<!cir.vptr>
+// CIR: %[[VPTR:.+]] = cir.load {{.*}} %[[VPTR_PTR]] : !cir.ptr<!cir.vptr>,
!cir.vptr
+// CIR: %[[VPTR_I8:.+]] = cir.cast(bitcast, %[[VPTR]] : !cir.vptr),
!cir.ptr<!u8i>
+// CIR: %[[NEG32:.+]] = cir.const #cir.int<-32> : !s64i
+// CIR: %[[ADJ_VPTR_I8:.+]] = cir.ptr_stride(%[[VPTR_I8]] : !cir.ptr<!u8i>,
%[[NEG32]] : !s64i), !cir.ptr<!u8i>
+// CIR: %[[OFFSET_PTR:.+]] = cir.cast(bitcast, %[[ADJ_VPTR_I8]] :
!cir.ptr<!u8i>), !cir.ptr<!s64i>
+// CIR: %[[OFFSET:.+]] = cir.load {{.*}} %[[OFFSET_PTR]] : !cir.ptr<!s64i>,
!s64i
+// CIR: %[[D_I8:.+]] = cir.cast(bitcast, %[[D]] : !cir.ptr<!rec_Derived>),
!cir.ptr<!u8i>
+// CIR: %[[ADJ_THIS_I8:.+]] = cir.ptr_stride(%[[D_I8]] : !cir.ptr<!u8i>,
%[[OFFSET]] : !s64i), !cir.ptr<!u8i>
+// CIR: %[[ADJ_THIS_D:.+]] = cir.cast(bitcast, %[[ADJ_THIS_I8]] :
!cir.ptr<!u8i>), !cir.ptr<!rec_Derived>
+// CIR: %[[BASE_THIS:.+]] = cir.cast(bitcast, %[[ADJ_THIS_D]] :
!cir.ptr<!rec_Derived>), !cir.ptr<!rec_Base>
+// CIR: %[[BASE_VPTR_PTR:.+]] = cir.vtable.get_vptr %[[BASE_THIS]] :
!cir.ptr<!rec_Base> -> !cir.ptr<!cir.vptr>
+// CIR: %[[BASE_VPTR:.+]] = cir.load {{.*}} %[[BASE_VPTR_PTR]] :
!cir.ptr<!cir.vptr>, !cir.vptr
+// CIR: %[[SLOT_PTR:.+]] = cir.vtable.get_virtual_fn_addr %[[BASE_VPTR]][0]
: !cir.vptr -> !cir.ptr<!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>>
+// CIR: %[[FN:.+]] = cir.load {{.*}} %[[SLOT_PTR]] :
!cir.ptr<!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>>,
!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>
+// CIR: cir.call %[[FN]](%[[BASE_THIS]]) :
(!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>, !cir.ptr<!rec_Base>) -> ()
+// CIR: cir.return
+
+// CIR: cir.func {{.*}}@_Z1gv() {
+// CIR: %[[DF:.+]] = cir.alloca !rec_DerivedFinal,
!cir.ptr<!rec_DerivedFinal>, ["df", init]
+// CIR: cir.call @_ZN12DerivedFinalC1Ev(%[[DF]]) nothrow :
(!cir.ptr<!rec_DerivedFinal>) -> ()
+// CIR: %[[BASE_THIS_2:.+]] = cir.base_class_addr %[[DF]] :
!cir.ptr<!rec_DerivedFinal> nonnull [0] -> !cir.ptr<!rec_Base>
+// CIR: %[[BASE_VPTR_PTR_2:.+]] = cir.vtable.get_vptr %[[BASE_THIS_2]] :
!cir.ptr<!rec_Base> -> !cir.ptr<!cir.vptr>
+// CIR: %[[BASE_VPTR_2:.+]] = cir.load {{.*}} %[[BASE_VPTR_PTR_2]] :
!cir.ptr<!cir.vptr>, !cir.vptr
+// CIR: %[[SLOT_PTR_2:.+]] = cir.vtable.get_virtual_fn_addr
%[[BASE_VPTR_2]][0] : !cir.vptr ->
!cir.ptr<!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>>
+// CIR: %[[FN_2:.+]] = cir.load {{.*}} %[[SLOT_PTR_2]] :
!cir.ptr<!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>>,
!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>
+// CIR: cir.call %[[FN_2]](%[[BASE_THIS_2]]) :
(!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>, !cir.ptr<!rec_Base>) -> ()
+// CIR: cir.return
+
+// LLVM: define {{.*}}void @_Z1fv()
----------------
andykaylor wrote:
I'd like to see these checks regrouped so that all the `f1` output is together
followed by all the `g1` output.
https://github.com/llvm/llvm-project/pull/159162
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits