[clang] [CIR] Make vtable entries a layout-independent type (PR #248772)

Konstantinos Parasyris via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 11:52:06 PST 2026


================
@@ -42,8 +42,8 @@ __global__ void kernel(float *out) {
 
 const char *host_name() { return Square(3.0f).name(); }
 
-// CIR-DEV: cir.global {{.*}} @_ZTV6Square = #cir.vtable<{#cir.const_array<[#cir.ptr<null> : !cir.ptr<!u8i>, #cir.ptr<null> : !cir.ptr<!u8i>, #cir.global_view<@_ZN6SquareD1Ev> : !cir.ptr<!u8i>, #cir.global_view<@_ZN6SquareD0Ev> : !cir.ptr<!u8i>, #cir.global_view<@_ZNK6Square4areaEv> : !cir.ptr<!u8i>, #cir.ptr<null> : !cir.ptr<!u8i>, #cir.global_view<@__cxa_deleted_virtual> : !cir.ptr<!u8i>]>
-// CIR-DEV: cir.global {{.*}} @_ZTV5Shape = #cir.vtable<{#cir.const_array<[#cir.ptr<null> : !cir.ptr<!u8i>, #cir.ptr<null> : !cir.ptr<!u8i>, #cir.global_view<@_ZN5ShapeD1Ev> : !cir.ptr<!u8i>, #cir.global_view<@_ZN5ShapeD0Ev> : !cir.ptr<!u8i>, #cir.global_view<@__cxa_pure_virtual> : !cir.ptr<!u8i>, #cir.ptr<null> : !cir.ptr<!u8i>, #cir.global_view<@__cxa_deleted_virtual> : !cir.ptr<!u8i>]>
+// CIR-DEV: cir.global {{.*}} @_ZTV6Square = #cir.vtable<{#cir.const_array<[#cir.vtable_offset<0> : !cir.vtable_entry, #cir.vtable_offset<0> : !cir.vtable_entry, #cir.global_view<@_ZN6SquareD1Ev> : !cir.vtable_entry, #cir.global_view<@_ZN6SquareD0Ev> : !cir.vtable_entry, #cir.global_view<@_ZNK6Square4areaEv> : !cir.vtable_entry, #cir.vtable_offset<0> : !cir.vtable_entry, #cir.global_view<@__cxa_deleted_virtual> : !cir.vtable_entry]>
+// CIR-DEV: cir.global {{.*}} @_ZTV5Shape = #cir.vtable<{#cir.const_array<[#cir.vtable_offset<0> : !cir.vtable_entry, #cir.vtable_offset<0> : !cir.vtable_entry, #cir.global_view<@_ZN5ShapeD1Ev> : !cir.vtable_entry, #cir.global_view<@_ZN5ShapeD0Ev> : !cir.vtable_entry, #cir.global_view<@__cxa_pure_virtual> : !cir.vtable_entry, #cir.vtable_offset<0> : !cir.vtable_entry, #cir.global_view<@__cxa_deleted_virtual> : !cir.vtable_entry]>
 
 // DEV-DAG: @_ZTV6Square = {{.*}}[ptr {{[^,]*}}null, ptr {{[^,]*}}null, ptr {{[^,]*}}@_ZN6SquareD1Ev{{[^,]*}}, ptr {{[^,]*}}@_ZN6SquareD0Ev{{[^,]*}}, ptr {{[^,]*}}@_ZNK6Square4areaEv{{[^,]*}}, ptr {{[^,]*}}null, ptr {{[^,]*}}@__cxa_deleted_virtual{{[^,]*}}]
----------------
koparasy wrote:

Here we hid the AS, but I think with your changes we could remove the regex to make sure we always have the right AS.

https://github.com/llvm/llvm-project/pull/248772


More information about the cfe-commits mailing list