[clang] [Clang][CIR] Fix tests post #225415 (PR #225784)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 23 07:03:48 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Andrzej WarzyĆski (banach-space)
<details>
<summary>Changes</summary>
AI Assisted (codex)
---
Patch is 22.37 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/225784.diff
14 Files Affected:
- (modified) clang/test/CIR/CodeGen/base-init-eh.cpp (+1-1)
- (modified) clang/test/CIR/CodeGen/ctor-null-init.cpp (+2-2)
- (modified) clang/test/CIR/CodeGen/delegating-ctor.cpp (+3-3)
- (modified) clang/test/CIR/CodeGen/destructor-vtable-reinit.cpp (+4-4)
- (modified) clang/test/CIR/CodeGen/global-ptr-init.cpp (+1-1)
- (modified) clang/test/CIR/CodeGen/inherited-ctors.cpp (+1-1)
- (modified) clang/test/CIR/CodeGen/multi-vtable.cpp (+2-2)
- (modified) clang/test/CIR/CodeGen/rtti-member-pointer.cpp (+4-4)
- (modified) clang/test/CIR/CodeGen/rtti-qualfn.cpp (+4-5)
- (modified) clang/test/CIR/CodeGen/vbase.cpp (+1-1)
- (modified) clang/test/CIR/CodeGen/virtual-function-calls.cpp (+1-5)
- (modified) clang/test/CIR/CodeGen/vtt.cpp (+12-12)
- (modified) clang/test/CIR/CodeGenCXX/base-layout.cpp (+1-1)
- (modified) clang/test/CIR/CodeGenCXX/vtable-pure-deleted-funcs.cpp (+1-1)
``````````diff
diff --git a/clang/test/CIR/CodeGen/base-init-eh.cpp b/clang/test/CIR/CodeGen/base-init-eh.cpp
index c16aac8ef77a0..24f6f7a93e73f 100644
--- a/clang/test/CIR/CodeGen/base-init-eh.cpp
+++ b/clang/test/CIR/CodeGen/base-init-eh.cpp
@@ -100,7 +100,7 @@ void test_virt_base_initializer() {
// OGCG: define {{.*}} void @_ZN11VirtDerivedC1Ev
// OGCG: %[[THIS:.*]] = load ptr, ptr %{{.*}}
// OGCG: call void @_ZN4BaseC2Ei(ptr {{.*}} %[[THIS]], i32 {{.*}} 0)
-// OGCG: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr] }, ptr @_ZTV11VirtDerived, i32 0, i32 0, i32 3), ptr %[[THIS]]
+// OGCG: store ptr getelementptr inbounds inrange(-24, 0) (i8, ptr @_ZTV11VirtDerived, i64 24), ptr %[[THIS]]
// OGCG: invoke void @_Z8mayThrowv()
// OGCG: to label %[[INVOKE_CONT:.*]] unwind label %[[LPAD:.*]]
// OGCG: [[INVOKE_CONT:.*]]:
diff --git a/clang/test/CIR/CodeGen/ctor-null-init.cpp b/clang/test/CIR/CodeGen/ctor-null-init.cpp
index d7fcdd3221de7..1e54556c4665e 100644
--- a/clang/test/CIR/CodeGen/ctor-null-init.cpp
+++ b/clang/test/CIR/CodeGen/ctor-null-init.cpp
@@ -103,7 +103,7 @@ VDerived::VDerived() : VBase() {}
// OGCG: %[[ADDR:.*]] = getelementptr inbounds i8, ptr %[[THIS:.*]],
// OGCG: call void @llvm.memset.p0.i64(ptr align 8 %[[ADDR]], i8 0, i64 8, i1 false)
// OGCG: call void @_ZN5VBaseC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %[[THIS]])
-// OGCG: store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV8VDerived, i32 0, i32 0, i32 2), ptr %[[THIS]], align 8
+// OGCG: store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV8VDerived, i64 16), ptr %[[THIS]], align 8
// CIR-LABEL: cir.func {{.*}}@_ZN8VDerivedC2Ev
// CIR: %[[BASE:.*]] = cir.base_class_addr {{.*}} : !cir.ptr<!rec_VDerived> nonnull [0] -> !cir.ptr<!rec_VBase>
@@ -125,4 +125,4 @@ VDerived::VDerived() : VBase() {}
// LLVM-LABEL: define {{.*}}@_ZN5VBaseC2Ev
// LLVM: store ptr getelementptr inbounds nuw (i8, ptr @_ZTV5VBase, i64 16), ptr %
// OGCG-LABEL: define {{.*}}@_ZN5VBaseC2Ev
-// OGCG: store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV5VBase, i32 0, i32 0, i32 2), ptr %
+// OGCG: store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV5VBase, i64 16), ptr %
diff --git a/clang/test/CIR/CodeGen/delegating-ctor.cpp b/clang/test/CIR/CodeGen/delegating-ctor.cpp
index 1dbd44ee068c0..f90eecf21b322 100644
--- a/clang/test/CIR/CodeGen/delegating-ctor.cpp
+++ b/clang/test/CIR/CodeGen/delegating-ctor.cpp
@@ -283,8 +283,8 @@ Derived::Derived(const void *inVoid) { squawk(); }
// OGCG: store ptr %[[INVOID_ARG]], ptr %[[INVOID_ADDR]]
// OGCG: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
// OGCG: call void @_ZN4BaseC2Ev(ptr {{.*}} %[[THIS]])
-// OGCG: store ptr getelementptr inbounds inrange(-32, 8) ({ [5 x ptr] }, ptr @_ZTV7Derived, i32 0, i32 0, i32 4), ptr %[[THIS]]
-// OGCG: store ptr getelementptr inbounds inrange(-32, 8) ({ [5 x ptr] }, ptr @_ZTV7Derived, i32 0, i32 0, i32 4), ptr %[[THIS]]
+// OGCG: store ptr getelementptr inbounds inrange(-32, 8) (i8, ptr @_ZTV7Derived, i64 32), ptr %[[THIS]]
+// OGCG: store ptr getelementptr inbounds inrange(-32, 8) (i8, ptr @_ZTV7Derived, i64 32), ptr %[[THIS]]
// OGCG: %[[VPTR:.*]] = load ptr, ptr %[[THIS]]
// OGCG: %[[SQUAWK_ADDR:.*]] = getelementptr inbounds ptr, ptr %[[VPTR]], i64 0
// OGCG: %[[SQUAWK:.*]] = load ptr, ptr %[[SQUAWK_ADDR]]
@@ -320,7 +320,7 @@ Derived::Derived(const void *inVoid) { squawk(); }
// OGCG: %[[THIS_ADDR:.*]] = alloca ptr
// OGCG: store ptr %[[THIS_ARG]], ptr %[[THIS_ADDR]]
// OGCG: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
-// OGCG: store ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV4Base, i32 0, i32 0, i32 2), ptr %[[THIS]]
+// OGCG: store ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTV4Base, i64 16), ptr %[[THIS]]
// OGCG: %[[VPTR:.*]] = load ptr, ptr %[[THIS]]
// OGCG: %[[SQUAWK_ADDR:.*]] = getelementptr inbounds ptr, ptr %[[VPTR]], i64 0
// OGCG: %[[SQUAWK:.*]] = load ptr, ptr %[[SQUAWK_ADDR]]
diff --git a/clang/test/CIR/CodeGen/destructor-vtable-reinit.cpp b/clang/test/CIR/CodeGen/destructor-vtable-reinit.cpp
index 887c22588d263..38d5fe9721e0e 100644
--- a/clang/test/CIR/CodeGen/destructor-vtable-reinit.cpp
+++ b/clang/test/CIR/CodeGen/destructor-vtable-reinit.cpp
@@ -30,7 +30,7 @@ Base::~Base() { some_function(); }
// LLVM: %[[THIS_ADDR:.*]] = alloca ptr
// LLVM: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
// LLVMCIR-NEXT:store ptr getelementptr inbounds nuw (i8, ptr @_ZTV4Base, i64 16), ptr %[[THIS]]
-// OGCG-NEXT: store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV4Base, i32 0, i32 0, i32 2), ptr %[[THIS]]
+// OGCG-NEXT: store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV4Base, i64 16), ptr %[[THIS]]
// LLVM-NEXT: call void @_Z13some_functionv()
// LLVM-NEXT: ret void
@@ -59,7 +59,7 @@ Derived::~Derived() { some_function(); }
// LLVM: %[[THIS_ADDR:.*]] = alloca ptr
// LLVM: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
// LLVMCIR: store ptr getelementptr inbounds nuw (i8, ptr @_ZTV7Derived, i64 16), ptr %[[THIS]]
-// OGCG: store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV7Derived, i32 0, i32 0, i32 2), ptr %[[THIS]]
+// OGCG: store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV7Derived, i64 16), ptr %[[THIS]]
// LLVM-NEXT: call void @_Z13some_functionv()
// LLVM: call void @_ZN4BaseD2Ev(ptr {{.*}}%[[THIS]])
// LLVM: ret void
@@ -169,10 +169,10 @@ MultiBase::~MultiBase() { some_function(); }
// LLVM: %[[THIS_ADDR:.*]] = alloca ptr
// LLVM: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
// LLVMCIR: store ptr getelementptr inbounds nuw (i8, ptr @_ZTV9MultiBase, i64 16), ptr %[[THIS]]
-// OGCG: store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr], [4 x ptr] }, ptr @_ZTV9MultiBase, i32 0, i32 0, i32 2), ptr %[[THIS]]
+// OGCG: store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV9MultiBase, i64 16), ptr %[[THIS]]
// LLVM: %[[FATHER_ADDR:.*]] = getelementptr {{.*}}i8, ptr %[[THIS]], i{{32|64}} 8
// LLVMCIR: store ptr getelementptr inbounds nuw (i8, ptr @_ZTV9MultiBase, i64 48), ptr %[[FATHER_ADDR]]
-// OGCG: store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr], [4 x ptr] }, ptr @_ZTV9MultiBase, i32 0, i32 1, i32 2), ptr %[[FATHER_ADDR]]
+// OGCG: store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV9MultiBase, i64 48), ptr %[[FATHER_ADDR]]
// LLVM: call void @_Z13some_functionv()
// LLVM: call void @_ZN6FatherD2Ev(ptr {{.*}})
// LLVM: call void @_ZN6MotherD2Ev(ptr {{.*}}%[[THIS]])
diff --git a/clang/test/CIR/CodeGen/global-ptr-init.cpp b/clang/test/CIR/CodeGen/global-ptr-init.cpp
index 1520485cf3597..9a9824881a98c 100644
--- a/clang/test/CIR/CodeGen/global-ptr-init.cpp
+++ b/clang/test/CIR/CodeGen/global-ptr-init.cpp
@@ -13,4 +13,4 @@ B x;
// CIR: cir.global external @x = #cir.const_record<{#cir.global_view<@_ZTV1B, [0 : i32, 2 : i32]> : !cir.vptr}> : !rec_B
// LLVM: @x = global %struct.B { ptr getelementptr inbounds nuw (i8, ptr @_ZTV1B, i64 16) }, align 8
-// OGCG: @x = global %struct.B { ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr] }, ptr @_ZTV1B, i32 0, i32 0, i32 2) }, align 8
+// OGCG: @x = global %struct.B { ptr getelementptr inbounds inrange(-16, 24) (i8, ptr @_ZTV1B, i64 16) }, align 8
diff --git a/clang/test/CIR/CodeGen/inherited-ctors.cpp b/clang/test/CIR/CodeGen/inherited-ctors.cpp
index e78279018772b..6871c00da5850 100644
--- a/clang/test/CIR/CodeGen/inherited-ctors.cpp
+++ b/clang/test/CIR/CodeGen/inherited-ctors.cpp
@@ -162,7 +162,7 @@ void fallsthrough() {
// Note: see the note above for the CIR/LLVM-IR difference here.
// OGCG: %[[X_LOAD:.*]] = load i32, ptr %[[X_ALLOCA]]
// OGCG: call void @_ZN11VirtDerivedCI24BaseEi(ptr {{.*}}%[[THIS_LOAD]], ptr {{.*}}(i8, ptr @_ZTT21VirtualDelegatingCtor, i64 8), i32{{.*}}%[[X_LOAD]])
-// OGCG: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr] }, ptr @_ZTV21VirtualDelegatingCtor, i32 0, i32 0, i32 3), ptr %[[THIS_LOAD]]
+// OGCG: store ptr getelementptr inbounds inrange(-24, 0) (i8, ptr @_ZTV21VirtualDelegatingCtor, i64 24), ptr %[[THIS_LOAD]]
//
// OGCG-LABEL: define linkonce_odr void @_ZN7DerivedCI24BaseEi(ptr {{.*}}, i32 {{.*}})
// OGCG: %[[THIS_ALLOCA:.*]] = alloca ptr
diff --git a/clang/test/CIR/CodeGen/multi-vtable.cpp b/clang/test/CIR/CodeGen/multi-vtable.cpp
index 33980b459886e..e47cfd3cf90d3 100644
--- a/clang/test/CIR/CodeGen/multi-vtable.cpp
+++ b/clang/test/CIR/CodeGen/multi-vtable.cpp
@@ -177,7 +177,7 @@ Child::Child() {}
// OGCG: call void @_ZN6MotherC2Ev(ptr {{.*}} %[[THIS]])
// OGCG: %[[FATHER_BASE:.*]] = getelementptr{{.*}} i8, ptr %[[THIS]], i64 8
// OGCG: call void @_ZN6FatherC2Ev(ptr{{.*}} %[[FATHER_BASE]])
-// OGCG: store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV5Child, i32 0, i32 0, i32 2), ptr %[[THIS]]
+// OGCG: store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV5Child, i64 16), ptr %[[THIS]]
// OGCG: %[[FATHER_BASE:.*]] = getelementptr{{.*}} i8, ptr %[[THIS]], i64 8
-// OGCG: store ptr getelementptr inbounds inrange(-16, 8) ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV5Child, i32 0, i32 1, i32 2), ptr %[[FATHER_BASE]]
+// OGCG: store ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTV5Child, i64 48), ptr %[[FATHER_BASE]]
// OGCG: ret void
diff --git a/clang/test/CIR/CodeGen/rtti-member-pointer.cpp b/clang/test/CIR/CodeGen/rtti-member-pointer.cpp
index a041db2cab628..93975ebd0814d 100644
--- a/clang/test/CIR/CodeGen/rtti-member-pointer.cpp
+++ b/clang/test/CIR/CodeGen/rtti-member-pointer.cpp
@@ -31,8 +31,8 @@ void throw_data_member_ptr() {
// OGCG-DAG: @_ZTSM1Ai = linkonce_odr constant [5 x i8] c"M1Ai\00", comdat
// OGCG-DAG: @_ZTS1A = linkonce_odr constant [3 x i8] c"1A\00", comdat
-// OGCG-DAG: @_ZTI1A = linkonce_odr constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), ptr @_ZTS1A }, comdat
-// OGCG-DAG: @_ZTIM1Ai = linkonce_odr constant { ptr, ptr, i32, ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv129__pointer_to_member_type_infoE, i64 2), ptr @_ZTSM1Ai, i32 0, ptr @_ZTIi, ptr @_ZTI1A }, comdat
+// OGCG-DAG: @_ZTI1A = linkonce_odr constant { ptr, ptr } { ptr getelementptr inbounds (i8, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 16), ptr @_ZTS1A }, comdat
+// OGCG-DAG: @_ZTIM1Ai = linkonce_odr constant { ptr, ptr, i32, ptr, ptr } { ptr getelementptr inbounds (i8, ptr @_ZTVN10__cxxabiv129__pointer_to_member_type_infoE, i64 16), ptr @_ZTSM1Ai, i32 0, ptr @_ZTIi, ptr @_ZTI1A }, comdat
// OGCG-DAG: call void @__cxa_throw(ptr %{{.*}}, ptr @_ZTIM1Ai, ptr null)
void throw_member_fn_ptr() {
@@ -53,6 +53,6 @@ void throw_member_fn_ptr() {
// OGCG-DAG: @_ZTSM1AFvvE = linkonce_odr constant [8 x i8] c"M1AFvvE\00", comdat
// OGCG-DAG: @_ZTSFvvE = linkonce_odr constant [5 x i8] c"FvvE\00", comdat
-// OGCG-DAG: @_ZTIFvvE = linkonce_odr constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv120__function_type_infoE, i64 2), ptr @_ZTSFvvE }, comdat
-// OGCG-DAG: @_ZTIM1AFvvE = linkonce_odr constant { ptr, ptr, i32, ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv129__pointer_to_member_type_infoE, i64 2), ptr @_ZTSM1AFvvE, i32 0, ptr @_ZTIFvvE, ptr @_ZTI1A }, comdat
+// OGCG-DAG: @_ZTIFvvE = linkonce_odr constant { ptr, ptr } { ptr getelementptr inbounds (i8, ptr @_ZTVN10__cxxabiv120__function_type_infoE, i64 16), ptr @_ZTSFvvE }, comdat
+// OGCG-DAG: @_ZTIM1AFvvE = linkonce_odr constant { ptr, ptr, i32, ptr, ptr } { ptr getelementptr inbounds (i8, ptr @_ZTVN10__cxxabiv129__pointer_to_member_type_infoE, i64 16), ptr @_ZTSM1AFvvE, i32 0, ptr @_ZTIFvvE, ptr @_ZTI1A }, comdat
// OGCG-DAG: call void @__cxa_throw(ptr %{{.*}}, ptr @_ZTIM1AFvvE, ptr null)
diff --git a/clang/test/CIR/CodeGen/rtti-qualfn.cpp b/clang/test/CIR/CodeGen/rtti-qualfn.cpp
index 57fbf714a7d88..6a85498d48408 100644
--- a/clang/test/CIR/CodeGen/rtti-qualfn.cpp
+++ b/clang/test/CIR/CodeGen/rtti-qualfn.cpp
@@ -26,13 +26,12 @@ void f() noexcept {
// LLVM-DAG: @_ZTSFvvE = linkonce_odr constant [5 x i8] c"FvvE\00", comdat
// LLVM-DAG: @_ZTSPDoFvvE = linkonce_odr constant [8 x i8] c"PDoFvvE\00", comdat
-// CIR and OGCG represent the reference to the type info vtable differently,
-// as a byte offset from the vtable symbol or as an index into an array of
-// pointers, but both name its address point.
+// CIR and OGCG use byte offsets to name the type info vtable address point.
+// OGCG additionally marks these GEPs inbounds.
// LLVMCIR-DAG: @_ZTIFvvE = linkonce_odr constant { ptr, ptr } { ptr getelementptr (i8, ptr @_ZTVN10__cxxabiv120__function_type_infoE, i64 16), ptr @_ZTSFvvE }, comdat
// LLVMCIR-DAG: @_ZTIPDoFvvE = linkonce_odr constant { ptr, ptr, i32, ptr } { ptr getelementptr (i8, ptr @_ZTVN10__cxxabiv119__pointer_type_infoE, i64 16), ptr @_ZTSPDoFvvE, i32 64, ptr @_ZTIFvvE }, comdat
-// OGCG-DAG: @_ZTIFvvE = linkonce_odr constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv120__function_type_infoE, i64 2), ptr @_ZTSFvvE }, comdat
-// OGCG-DAG: @_ZTIPDoFvvE = linkonce_odr constant { ptr, ptr, i32, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv119__pointer_type_infoE, i64 2), ptr @_ZTSPDoFvvE, i32 64, ptr @_ZTIFvvE }, comdat
+// OGCG-DAG: @_ZTIFvvE = linkonce_odr constant { ptr, ptr } { ptr getelementptr inbounds (i8, ptr @_ZTVN10__cxxabiv120__function_type_infoE, i64 16), ptr @_ZTSFvvE }, comdat
+// OGCG-DAG: @_ZTIPDoFvvE = linkonce_odr constant { ptr, ptr, i32, ptr } { ptr getelementptr inbounds (i8, ptr @_ZTVN10__cxxabiv119__pointer_type_infoE, i64 16), ptr @_ZTSPDoFvvE, i32 64, ptr @_ZTIFvvE }, comdat
// The throw unwinds to the terminate scope of the enclosing noexcept function.
// LLVM-LABEL: define{{.*}} void @_Z1fv()
diff --git a/clang/test/CIR/CodeGen/vbase.cpp b/clang/test/CIR/CodeGen/vbase.cpp
index fb37a49c7856e..b480609af620d 100644
--- a/clang/test/CIR/CodeGen/vbase.cpp
+++ b/clang/test/CIR/CodeGen/vbase.cpp
@@ -136,5 +136,5 @@ void ppp() { B b; }
// OGCG: store ptr %[[THIS_ARG]], ptr %[[THIS_ADDR]]
// OGCG: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
// OGCG: %[[BASE_A_ADDR:.*]] = getelementptr inbounds i8, ptr %[[THIS]], i64 12
-// OGCG: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr] }, ptr @_ZTV1B, i32 0, i32 0, i32 3), ptr %[[THIS]]
+// OGCG: store ptr getelementptr inbounds inrange(-24, 0) (i8, ptr @_ZTV1B, i64 24), ptr %[[THIS]]
// OGCG: ret void
diff --git a/clang/test/CIR/CodeGen/virtual-function-calls.cpp b/clang/test/CIR/CodeGen/virtual-function-calls.cpp
index 3d7e3a8ae4712..482b374c2d3b9 100644
--- a/clang/test/CIR/CodeGen/virtual-function-calls.cpp
+++ b/clang/test/CIR/CodeGen/virtual-function-calls.cpp
@@ -41,11 +41,7 @@ A::A() {}
// OGCG: %[[THIS_ADDR:.*]] = alloca ptr
// OGCG: store ptr %[[ARG0]], ptr %[[THIS_ADDR]]
// OGCG: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
-// OGCG: store ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV1A, i32 0, i32 0, i32 2), ptr %[[THIS]]
-
-// NOTE: The GEP in OGCG looks very different from the one generated with CIR,
-// but it is equivalent. The OGCG GEP indexes by base pointer, then
-// structure, then array, whereas the CIR GEP indexes by byte offset.
+// OGCG: store ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTV1A, i64 16), ptr %[[THIS]]
void f1(A *a) {
a->f('c');
diff --git a/clang/test/CIR/CodeGen/vtt.cpp b/clang/test/CIR/CodeGen/vtt.cpp
index 91283befe84be..795b26ded3b9c 100644
--- a/clang/test/CIR/CodeGen/vtt.cpp
+++ b/clang/test/CIR/CodeGen/vtt.cpp
@@ -127,13 +127,13 @@ void D::y() {}
// LLVM-COMMON-SAME: ], align 8
// OGCG-COMMON: @_ZTT1D = unnamed_addr constant [7 x ptr] [
-// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 16) ({ [5 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTV1D, i32 0, i32 0, i32 3),
-// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) ({ [4 x ptr], [4 x ptr] }, ptr @_ZTC1D0_1B, i32 0, i32 0, i32 3),
-// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) ({ [4 x ptr], [4 x ptr] }, ptr @_ZTC1D0_1B, i32 0, i32 1, i32 3),
-// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) ({ [4 x ptr], [4 x ptr] }, ptr @_ZTC1D16_1C, i32 0, i32 0, i32 3),
-// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) ({ [4 x ptr], [4 x ptr] }, ptr @_ZTC1D16_1C, i32 0, i32 1, i32 3),
-// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) ({ [5 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTV1D, i32 0, i32 2, i32 3),
-// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) ({ [5 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTV1D, i32 0, i32 1, i32 3)
+// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 16) (i8, ptr @_ZTV1D, i64 24),
+// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) (i8, ptr @_ZTC1D0_1B, i64 24),
+// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) (i8, ptr @_ZTC1D0_1B, i64 56),
+// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) (i8, ptr @_ZTC1D16_1C, i64 24),
+// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) (i8, ptr @_ZTC1D16_1C, i64 56),
+// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) (i8, ptr @_ZTV1D, i64 96),
+// OGCG-COMMON-SAME: ptr getelementptr inbounds inrange(-24, 8) (i8, ptr @_ZTV1D, i64 64)
// OGCG-COMMON-SAME: ], align 8
// Construction vtable for B-in-D
@@ -234,7 +234,7 @@ void D::y() {}
// LLVM-RTTI-SAME: ptr @_ZTS1D, i32 2, i32 2, ptr @_ZTI1B, i64 2, ptr @_ZTI1C, i64 4098 }
// OGCG-RTTI: @_ZTI1D = constant { ptr, ptr, i32, i32, ptr, i64, ptr, i64 } {
-// OGCG-RTTI-SAME: ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 2),
+// OGCG-RTTI-SAME: ptr getelementptr inbounds (i8, ptr @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 16),
// OGCG-RTTI-SAME: ptr @_ZTS1D, i32 2, i32 2, ptr @_ZTI1B, i64 2, ptr @_ZTI1C, i64 4098 }, align 8
// OGCG-RTTI: @_ZTVN10__cxxabiv121__vmi_class_type_infoE = external global [0 x ptr]
@@ -522,11 +522,11 @@ D::D() {}
// OGCG-COMMON: call void @_ZN1BC2Ev(ptr {{.*}} %[[THIS]], ptr {{.*}} getelementptr inbounds nuw (i8, ptr @_ZTT1D, i64 8))
// OGCG-COMMON: %[[C_ADDR:.*]] = getelementptr inbounds i8, ptr %[[THIS]], i64 16
// OGCG-COMMON: call void @_ZN1CC2Ev(ptr {{.*}} %[[C_ADDR]], ptr {{.*}} getelementptr inbounds nuw (i8, ptr @_ZTT1D, i64 24))
-// OGCG-COMMON: store ptr getelementptr inbounds inrange(-24, 16) ({ [5 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTV1D, i32 0, i32 0, i32 3), ptr %[[THIS]]
+// OGCG-COMMON: store ptr getelementptr inbounds inrange(-24, 16) (i8, ptr @_ZTV1D, i64 24), ptr %[[THIS]]
// OGCG-COMMON: %[[A_ADDR:.*]] = getelementptr inbounds i8, ptr %[[THIS]], i64 40
-// OGCG-COMMON: store ptr getelementptr inbounds inrange(-24, 8) ({ [5 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTV1D, i32 0, i32 2, i32 3), ptr %[[A_ADDR]]
+// OGCG-COMMON: store ptr getelementptr inbounds inrange(-24, 8) (i8, ptr @_ZTV1D, i64 96), ptr %[[A_ADDR]]
// OGCG-COMMON: %[[C_ADDR:.*]] = getelementptr inbounds i8, ptr %[[THIS]], i64 16
-// OGCG-COMMON: store ptr getelementptr inbounds inrange(-24, 8) ({ [5 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTV1D, i32 0, i32 1, i32 3), ptr %[[C_ADDR]]
+// OGCG-COMMON: store ptr getelementptr inbounds inrange(-24, 8) (i8, ptr @_ZTV1D, i64 64), ptr %[[C_ADDR]]
// Base (C2) constructor for A
@@ -549,4 +549,4 @@ D::D() {}
// OGCG-COMMON: %[[THIS_ADDR:.*]] = alloca ptr
// OGCG-COMMON: store ptr %[[THIS_ARG]], ptr %[[THIS_ADDR]]
// OGCG-COMMON: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
-// OGCG-COMMON: store ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV1A, i32 0, i32 0, i32 2), ptr %[[THIS]]
+// OGCG-COMMON: store ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTV1A, i64 16), ptr %[[THIS]]
diff --git a/clang/test/CIR/CodeGenCXX/base-layout.cpp b/clang/test/CIR/CodeGenCXX/base-layout.cpp
index 62d2a1e8b285f..a083e435194dd 100644
--- a/clang/test/CIR/CodeGenCXX/base-layout.cpp
+++ b/clang/test/CIR/CodeGenCXX/base-layout.cpp
@@ -16,7 +16,7 @@ struct D : V3, B {};
con...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/225784
More information about the cfe-commits
mailing list