[clang] 864d045 - [CIR] Fix checks following b3d99ac2cda4d6484ac0dff0b95403b4a8c10465. NFC
Michael Liao via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 6 08:45:19 PST 2026
Author: Michael Liao
Date: 2026-03-06T11:45:07-05:00
New Revision: 864d0452233e2f7d3772ad1170b4e0b3a7a6670c
URL: https://github.com/llvm/llvm-project/commit/864d0452233e2f7d3772ad1170b4e0b3a7a6670c
DIFF: https://github.com/llvm/llvm-project/commit/864d0452233e2f7d3772ad1170b4e0b3a7a6670c.diff
LOG: [CIR] Fix checks following b3d99ac2cda4d6484ac0dff0b95403b4a8c10465. NFC
- b3d99ac2cda4d6484ac0dff0b95403b4a8c10465 makes constant folder data
layout aware. Match checks accordingly.
Added:
Modified:
clang/test/CIR/CodeGen/clear-cache.c
clang/test/CIR/CodeGen/complex-cast.cpp
clang/test/CIR/CodeGen/finegrain-bitfield-access.cpp
clang/test/CIR/CodeGen/global-array-dtor.cpp
clang/test/CIR/CodeGen/global-init.cpp
clang/test/CIR/CodeGen/no-odr-use.cpp
clang/test/CIR/CodeGen/struct.c
clang/test/CIR/CodeGen/vtt.cpp
clang/test/CIR/CodeGenBuiltins/builtin-constant-p.c
Removed:
################################################################################
diff --git a/clang/test/CIR/CodeGen/clear-cache.c b/clang/test/CIR/CodeGen/clear-cache.c
index 96254be9ea7f2..bf13985c231be 100644
--- a/clang/test/CIR/CodeGen/clear-cache.c
+++ b/clang/test/CIR/CodeGen/clear-cache.c
@@ -25,7 +25,7 @@ char buffer[32] = "This is a largely unused buffer";
// LLVM: call void @llvm.clear_cache(ptr @buffer, ptr getelementptr inbounds nuw (i8, ptr @buffer, i64 32))
// OGCG-LABEL: main
-// OGCG: call void @llvm.clear_cache(ptr @buffer, ptr getelementptr inbounds (i8, ptr @buffer, i64 32))
+// OGCG: call void @llvm.clear_cache(ptr @buffer, ptr getelementptr inbounds nuw (i8, ptr @buffer, i64 32))
int main(void) {
__builtin___clear_cache(buffer, buffer + 32);
diff --git a/clang/test/CIR/CodeGen/complex-cast.cpp b/clang/test/CIR/CodeGen/complex-cast.cpp
index 5dc08eb414a5b..d3f08694f08d8 100644
--- a/clang/test/CIR/CodeGen/complex-cast.cpp
+++ b/clang/test/CIR/CodeGen/complex-cast.cpp
@@ -33,7 +33,7 @@ void scalar_to_complex() {
// OGCG: %[[REAL:.*]] = load double, ptr {{.*}}, align 8
// OGCG: store double %[[REAL]], ptr {{.*}}, align 8
-// OGCG: store double 0.000000e+00, ptr getelementptr inbounds nuw ({ double, double }, ptr @cd, i32 0, i32 1), align 8
+// OGCG: store double 0.000000e+00, ptr getelementptr inbounds nuw (i8, ptr @cd, i64 8), align 8
// CIR-BEFORE: %[[INT_TO_COMPLEX:.*]] = cir.cast int_to_complex %{{.*}} : !s32i -> !cir.complex<!s32i>
@@ -48,7 +48,7 @@ void scalar_to_complex() {
// OGCG: %[[REAL:.*]] = load i32, ptr {{.*}}, align 4
// OGCG: store i32 %[[REAL]], ptr {{.*}}, align 4
-// OGCG: store i32 0, ptr getelementptr inbounds nuw ({ i32, i32 }, ptr @ci, i32 0, i32 1), align 4
+// OGCG: store i32 0, ptr getelementptr inbounds nuw (i8, ptr @ci, i64 4), align 4
// CIR-BEFORE: %[[INT_TO_FP:.*]] = cir.cast int_to_float %{{.*}} : !s32i -> !cir.double
// CIR-BEFORE: %[[FP_TO_COMPLEX:.*]] = cir.cast float_to_complex %[[INT_TO_FP]] : !cir.double -> !cir.complex<!cir.double>
@@ -67,7 +67,7 @@ void scalar_to_complex() {
// OGCG: %[[TMP:.*]] = load i32, ptr {{.*}}, align 4
// OGCG: %[[REAL:.*]] = sitofp i32 %[[TMP]] to double
// OGCG: store double %[[REAL]], ptr {{.*}}, align 8
-// OGCG: store double 0.000000e+00, ptr getelementptr inbounds nuw ({ double, double }, ptr {{.*}}, i32 0, i32 1), align 8
+// OGCG: store double 0.000000e+00, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 8), align 8
// CIR-BEFORE: %[[FP_TO_INT:.*]] = cir.cast float_to_int %{{.*}} : !cir.double -> !s32i
// CIR-BEFORE: %[[INT_TO_COMPLEX:.*]] = cir.cast int_to_complex %[[FP_TO_INT]] : !s32i -> !cir.complex<!s32i>
@@ -86,7 +86,7 @@ void scalar_to_complex() {
// OGCG: %[[TMP:.*]] = load double, ptr {{.*}}, align 8
// OGCG: %[[REAL:.*]] = fptosi double %[[TMP]] to i32
// OGCG: store i32 %[[REAL]], ptr {{.*}}, align 4
-// OGCG: store i32 0, ptr getelementptr inbounds nuw ({ i32, i32 }, ptr {{.*}}, i32 0, i32 1), align 4
+// OGCG: store i32 0, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 4), align 4
void scalar_to_complex_explicit() {
cd = (double _Complex)sd;
@@ -108,7 +108,7 @@ void scalar_to_complex_explicit() {
// OGCG: %[[REAL:.*]] = load double, ptr {{.*}}, align 8
// OGCG: store double %[[REAL]], ptr {{.*}}, align 8
-// OGCG: store double 0.000000e+00, ptr getelementptr inbounds nuw ({ double, double }, ptr @cd, i32 0, i32 1), align 8
+// OGCG: store double 0.000000e+00, ptr getelementptr inbounds nuw (i8, ptr @cd, i64 8), align 8
// CIR-BEFORE: %[[INT_TO_COMPLEX:.*]] = cir.cast int_to_complex %{{.*}} : !s32i -> !cir.complex<!s32i>
@@ -123,7 +123,7 @@ void scalar_to_complex_explicit() {
// OGCG: %[[REAL:.*]] = load i32, ptr {{.*}}, align 4
// OGCG: store i32 %[[REAL]], ptr {{.*}}, align 4
-// OGCG: store i32 0, ptr getelementptr inbounds nuw ({ i32, i32 }, ptr @ci, i32 0, i32 1), align 4
+// OGCG: store i32 0, ptr getelementptr inbounds nuw (i8, ptr @ci, i64 4), align 4
// CIR-BEFORE: %[[INT_TO_FP:.*]] = cir.cast int_to_float %{{.*}} : !s32i -> !cir.double
// CIR-BEFORE: %[[FP_TO_COMPLEX:.*]] = cir.cast float_to_complex %[[INT_TO_FP]] : !cir.double -> !cir.complex<!cir.double>
@@ -142,7 +142,7 @@ void scalar_to_complex_explicit() {
// OGCG: %[[TMP:.*]] = load i32, ptr {{.*}}, align 4
// OGCG: %[[REAL:.*]] = sitofp i32 %[[TMP]] to double
// OGCG: store double %[[REAL]], ptr {{.*}}, align 8
-// OGCG: store double 0.000000e+00, ptr getelementptr inbounds nuw ({ double, double }, ptr {{.*}}, i32 0, i32 1), align 8
+// OGCG: store double 0.000000e+00, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 8), align 8
// CIR-BEFORE: %[[FP_TO_INT:.*]] = cir.cast float_to_int %{{.*}} : !cir.double -> !s32i
// CIR-BEFORE: %[[INT_TO_COMPLEX:.*]] = cir.cast int_to_complex %[[FP_TO_INT]] : !s32i -> !cir.complex<!s32i>
@@ -161,7 +161,7 @@ void scalar_to_complex_explicit() {
// OGCG: %[[TMP:.*]] = load double, ptr {{.*}}, align 8
// OGCG: %[[REAL:.*]] = fptosi double %[[TMP]] to i32
// OGCG: store i32 %[[REAL]], ptr {{.*}}, align 4
-// OGCG: store i32 0, ptr getelementptr inbounds nuw ({ i32, i32 }, ptr {{.*}}, i32 0, i32 1), align 4
+// OGCG: store i32 0, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 4), align 4
void complex_to_scalar() {
sd = (double)cd;
@@ -241,7 +241,7 @@ void complex_to_bool() {
// LLVM-NEXT: store i8 %[[RESULT]], ptr {{.*}}, align 1
// OGCG: %[[REAL:.*]] = load double, ptr {{.*}}, align 8
-// OGCG: %[[IMAG:.*]] = load double, ptr getelementptr inbounds nuw ({ double, double }, ptr {{.*}}, i32 0, i32 1), align 8
+// OGCG: %[[IMAG:.*]] = load double, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 8), align 8
// OGCG: %[[REAL_TO_BOOL:.*]] = fcmp une double %[[REAL]], 0.000000e+00
// OGCG: %[[IMAG_TO_BOOL:.*]] = fcmp une double %[[IMAG]], 0.000000e+00
// OGCG: %[[COMPLEX_TO_BOOL:.*]] = or i1 %[[REAL_TO_BOOL]], %[[IMAG_TO_BOOL]]
@@ -266,7 +266,7 @@ void complex_to_bool() {
// LLVM-NEXT: store i8 %[[RESULT]], ptr {{.*}}, align 1
// OGCG: %[[REAL:.*]] = load i32, ptr {{.*}}, align 4
-// OGCG: %[[IMAG:.*]] = load i32, ptr getelementptr inbounds nuw ({ i32, i32 }, ptr {{.*}}, i32 0, i32 1), align 4
+// OGCG: %[[IMAG:.*]] = load i32, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 4), align 4
// OGCG: %[[REAL_TO_BOOL:.*]] = icmp ne i32 %[[REAL]], 0
// OGCG: %[[IMAG_TO_BOOL:.*]] = icmp ne i32 %[[IMAG]], 0
// OGCG: %[[COMPLEX_TO_BOOL:.*]] = or i1 %[[REAL_TO_BOOL]], %[[IMAG_TO_BOOL]]
@@ -296,11 +296,11 @@ void complex_to_complex_cast() {
// LLVM: store { double, double } %[[COMPLEX]], ptr {{.*}}, align 8
// OGCG: %[[REAL:.*]] = load float, ptr {{.*}}, align 4
-// OGCG: %[[IMAG:.*]] = load float, ptr getelementptr inbounds nuw ({ float, float }, ptr {{.*}}, i32 0, i32 1), align 4
+// OGCG: %[[IMAG:.*]] = load float, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 4), align 4
// OGCG: %[[REAL_FP_CAST:.*]] = fpext float %[[REAL]] to double
// OGCG: %[[IMAG_FP_CAST:.*]] = fpext float %[[IMAG]] to double
// OGCG: store double %[[REAL_FP_CAST]], ptr {{.*}}, align 8
-// OGCG: store double %[[IMAG_FP_CAST]], ptr getelementptr inbounds nuw ({ double, double }, ptr {{.*}}, i32 0, i32 1), align 8
+// OGCG: store double %[[IMAG_FP_CAST]], ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 8), align 8
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %{{.*}} : !cir.ptr<!cir.complex<!s16i>>, !cir.complex<!s16i>
// CIR-BEFORE: %[[INT_COMPLEX:.*]] = cir.cast int_complex %[[TMP]] : !cir.complex<!s16i> -> !cir.complex<!s32i>
@@ -320,11 +320,11 @@ void complex_to_complex_cast() {
// LLVM: store { i32, i32 } %[[COMPLEX]], ptr {{.*}}, align 4
// OGCG: %[[REAL:.*]] = load i16, ptr {{.*}}, align 2
-// OGCG: %[[IMAG:.*]] = load i16, ptr getelementptr inbounds nuw ({ i16, i16 }, ptr {{.*}}, i32 0, i32 1), align 2
+// OGCG: %[[IMAG:.*]] = load i16, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 2), align 2
// OGCG: %[[REAL_INT_CAST:.*]] = sext i16 %[[REAL]] to i32
// OGCG: %[[IMAG_INT_CAST:.*]] = sext i16 %[[IMAG]] to i32
// OGCG: store i32 %[[REAL_INT_CAST]], ptr {{.*}}, align 4
-// OGCG: store i32 %[[IMAG_INT_CAST]], ptr getelementptr inbounds nuw ({ i32, i32 }, ptr {{.*}}, i32 0, i32 1), align 4
+// OGCG: store i32 %[[IMAG_INT_CAST]], ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 4), align 4
struct CX {
double real;
diff --git a/clang/test/CIR/CodeGen/finegrain-bitfield-access.cpp b/clang/test/CIR/CodeGen/finegrain-bitfield-access.cpp
index ed50954bb2af1..65e98d0a871d0 100644
--- a/clang/test/CIR/CodeGen/finegrain-bitfield-access.cpp
+++ b/clang/test/CIR/CodeGen/finegrain-bitfield-access.cpp
@@ -60,7 +60,7 @@ unsigned read8_1() {
// LLVM: ret i32 [[RET]]
// OGCG-LABEL: @_Z7read8_1v
-// OGCG: [[BFLOAD:%.*]] = load i8, ptr getelementptr inbounds nuw (%struct.S1, ptr {{.*}}, i32 0, i32 1), align 1
+// OGCG: [[BFLOAD:%.*]] = load i8, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 1), align 1
// OGCG-NEXT: [[BFCAST:%.*]] = zext i8 [[BFLOAD]] to i32
// OGCG-NEXT: ret i32 [[BFCAST]]
@@ -78,7 +78,7 @@ void write8_1() {
// LLVM: ret void
// OGCG-LABEL: @_Z8write8_1v
-// OGCG: store i8 3, ptr getelementptr inbounds nuw (%struct.S1, ptr {{.*}}, i32 0, i32 1), align 1
+// OGCG: store i8 3, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 1), align 1
// OGCG-NEXT: ret void
unsigned read8_2() {
@@ -103,7 +103,7 @@ unsigned read8_2() {
// LLVM: ret i32 [[RET]]
// OGCG-LABEL: @_Z7read8_2v
-// OGCG: [[BFLOAD:%.*]] = load i16, ptr getelementptr inbounds nuw (%struct.S1, ptr {{.*}}, i32 0, i32 2), align 2
+// OGCG: [[BFLOAD:%.*]] = load i16, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 2), align 2
// OGCG-NEXT: [[BFLSHR:%.*]] = lshr i16 [[BFLOAD]], 4
// OGCG-NEXT: [[BFCLEAR:%.*]] = and i16 [[BFLSHR]], 255
// OGCG-NEXT: [[BFCAST:%.*]] = zext i16 [[BFCLEAR]] to i32
@@ -126,10 +126,10 @@ void write8_2() {
// LLVM: ret void
// OGCG-LABEL: @_Z8write8_2v
-// OGCG: [[BFLOAD:%.*]] = load i16, ptr getelementptr inbounds nuw (%struct.S1, ptr {{.*}}, i32 0, i32 2), align 2
+// OGCG: [[BFLOAD:%.*]] = load i16, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 2), align 2
// OGCG-NEXT: [[BFCLEAR:%.*]] = and i16 [[BFLOAD]], -4081
// OGCG-NEXT: [[BFSET:%.*]] = or i16 [[BFCLEAR]], 48
-// OGCG-NEXT: store i16 [[BFSET]], ptr getelementptr inbounds nuw (%struct.S1, ptr {{.*}}, i32 0, i32 2), align 2
+// OGCG-NEXT: store i16 [[BFSET]], ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 2), align 2
// OGCG-NEXT: ret void
unsigned read16_1() {
@@ -179,7 +179,7 @@ unsigned read16_2() {
// LLVM: ret i32 [[RET]]
// OGCG-LABEL: @_Z8read16_2v
-// OGCG: [[BFLOAD:%.*]] = load i16, ptr getelementptr inbounds nuw (%struct.S2, ptr {{.*}}, i32 0, i32 1), align 2
+// OGCG: [[BFLOAD:%.*]] = load i16, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 2), align 2
// OGCG-NEXT: [[BFCAST:%.*]] = zext i16 [[BFLOAD]] to i64
// OGCG-NEXT: [[RET:%.*]] = trunc i64 [[BFCAST]] to i32
// OGCG-NEXT: ret i32 [[RET]]
@@ -218,7 +218,7 @@ void write16_2() {
// LLVM: ret void
// OGCG-LABEL: @_Z9write16_2v
-// OGCG: store i16 5, ptr getelementptr inbounds nuw (%struct.S2, ptr {{.*}}, i32 0, i32 1), align 2
+// OGCG: store i16 5, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 2), align 2
// OGCG-NEXT: ret void
unsigned read32_1() {
@@ -242,7 +242,7 @@ unsigned read32_1() {
// LLVM: ret i32 [[RET]]
// OGCG-LABEL: @_Z8read32_1v
-// OGCG: [[BFLOAD:%.*]] = load i32, ptr getelementptr inbounds nuw (%struct.S3, ptr {{.*}}, i32 0, i32 1), align 4
+// OGCG: [[BFLOAD:%.*]] = load i32, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 4), align 4
// OGCG-NEXT: [[BFCAST:%.*]] = zext i32 %bf.load to i64
// OGCG-NEXT: [[RET:%.*]] = trunc i64 %bf.cast to i32
// OGCG-NEXT: ret i32 [[RET]]
@@ -262,5 +262,5 @@ void write32_1() {
// LLVM: ret void
// OGCG-LABEL: @_Z9write32_1v
-// OGCG: store i32 5, ptr getelementptr inbounds nuw (%struct.S3, ptr {{.*}}, i32 0, i32 1), align 4
+// OGCG: store i32 5, ptr getelementptr inbounds nuw (i8, ptr {{.*}}, i64 4), align 4
// OGCG-NEXT: ret void
diff --git a/clang/test/CIR/CodeGen/global-array-dtor.cpp b/clang/test/CIR/CodeGen/global-array-dtor.cpp
index f31c8809ddd36..ee29cf52c75b0 100644
--- a/clang/test/CIR/CodeGen/global-array-dtor.cpp
+++ b/clang/test/CIR/CodeGen/global-array-dtor.cpp
@@ -92,7 +92,7 @@ ArrayDtor arrDtor[16];
// OGCG: store ptr %[[ARG]], ptr %[[UNUSED_ADDR]]
// OGCG: br label %[[LOOP_BODY:.*]]
// OGCG: [[LOOP_BODY]]:
-// OGCG: %[[PREV:.*]] = phi ptr [ getelementptr inbounds (%struct.ArrayDtor, ptr @arrDtor, i64 16), %entry ], [ %[[CUR:.*]], %[[LOOP_BODY]] ]
+// OGCG: %[[PREV:.*]] = phi ptr [ getelementptr inbounds nuw (i8, ptr @arrDtor, i64 16), %entry ], [ %[[CUR:.*]], %[[LOOP_BODY]] ]
// OGCG: %[[CUR]] = getelementptr inbounds %struct.ArrayDtor, ptr %[[PREV]], i64 -1
// OGCG: call void @_ZN9ArrayDtorD1Ev(ptr noundef nonnull align 1 dereferenceable(1) %[[CUR]])
// OGCG: %[[DONE:.*]] = icmp eq ptr %[[CUR]], @arrDtor
diff --git a/clang/test/CIR/CodeGen/global-init.cpp b/clang/test/CIR/CodeGen/global-init.cpp
index cd5adef176de3..59b79e7b41697 100644
--- a/clang/test/CIR/CodeGen/global-init.cpp
+++ b/clang/test/CIR/CodeGen/global-init.cpp
@@ -141,7 +141,7 @@ float _Complex a = {num, num};
// OGCG: %[[REAL:.*]] = load float, ptr @num, align 4
// OGCG: %[[IMAG:.*]] = load float, ptr @num, align 4
// OGCG: store float %[[REAL]], ptr @a, align 4
-// OGCG: store float %[[IMAG]], ptr getelementptr inbounds nuw ({ float, float }, ptr @a, i32 0, i32 1), align 4
+// OGCG: store float %[[IMAG]], ptr getelementptr inbounds nuw (i8, ptr @a, i64 4), align 4
float fp;
int i = (int)fp;
@@ -253,7 +253,7 @@ ArrayDtor arrDtor[16];
// OGCG: store ptr %[[ARG]], ptr %[[UNUSED_ADDR]]
// OGCG: br label %[[LOOP_BODY:.*]]
// OGCG: [[LOOP_BODY]]:
-// OGCG: %[[PREV:.*]] = phi ptr [ getelementptr inbounds (%struct.ArrayDtor, ptr @arrDtor, i64 16), %entry ], [ %[[CUR:.*]], %[[LOOP_BODY]] ]
+// OGCG: %[[PREV:.*]] = phi ptr [ getelementptr inbounds nuw (i8, ptr @arrDtor, i64 16), %entry ], [ %[[CUR:.*]], %[[LOOP_BODY]] ]
// OGCG: %[[CUR]] = getelementptr inbounds %struct.ArrayDtor, ptr %[[PREV]], i64 -1
// OGCG: call void @_ZN9ArrayDtorD1Ev(ptr noundef nonnull align 1 dereferenceable(1) %[[CUR]])
// OGCG: %[[DONE:.*]] = icmp eq ptr %[[CUR]], @arrDtor
diff --git a/clang/test/CIR/CodeGen/no-odr-use.cpp b/clang/test/CIR/CodeGen/no-odr-use.cpp
index 2e1655f700b4b..bd12c70803fc5 100644
--- a/clang/test/CIR/CodeGen/no-odr-use.cpp
+++ b/clang/test/CIR/CodeGen/no-odr-use.cpp
@@ -44,7 +44,7 @@ int f(int i) {
// CIR: %[[ARR:.*]] = cir.get_member %[[A]][2] {name = "arr"} : !cir.ptr<!rec_A> -> !cir.ptr<!cir.array<!s32i x 3>>
// CIR: cir.get_element %[[ARR]][%{{.*}} : !s32i] : !cir.ptr<!cir.array<!s32i x 3>> -> !cir.ptr<!s32i>
// LLVM: getelementptr [3 x i32], ptr getelementptr inbounds nuw (i8, ptr @[[F_A]], i64 12), i32 0, i64 %{{.*}}
- // OGCG: getelementptr inbounds [3 x i32], ptr getelementptr inbounds nuw ({{.*}} @__const._Z1fi.a, i32 0, i32 2), i64 0, i64 %{{.*}}
+ // OGCG: getelementptr inbounds [3 x i32], ptr getelementptr inbounds nuw (i8, ptr @__const._Z1fi.a, i64 12), i64 0, i64 %{{.*}}
? a.arr[n]
// CIR: cir.ternary
// LLVM: br i1
@@ -71,7 +71,7 @@ int f(int i) {
// LLVM: getelementptr [2 x i32], ptr getelementptr inbounds nuw ({{.*}} @[[F_A]], i64 4), i32 0, i64 %{{.*}}
// LLVM: load i32
- // OGCG: getelementptr inbounds [2 x i32], ptr getelementptr inbounds nuw ({{.*}} @__const._Z1fi.a, i32 0, i32 1), i64 0, i64 %{{.*}}
+ // OGCG: getelementptr inbounds [2 x i32], ptr getelementptr inbounds nuw (i8, ptr @__const._Z1fi.a, i64 4), i64 0, i64 %{{.*}}
// OGCG: load i32
: a.y[2 - n]));
}(i, &A::x);
diff --git a/clang/test/CIR/CodeGen/struct.c b/clang/test/CIR/CodeGen/struct.c
index b376153f4eb79..0aeec4ac7e292 100644
--- a/clang/test/CIR/CodeGen/struct.c
+++ b/clang/test/CIR/CodeGen/struct.c
@@ -233,7 +233,7 @@ char f3(int a) {
// OGCG-NEXT: store i32 %[[ARG_A]], ptr %[[A_ADDR]], align 4
// OGCG-NEXT: %[[A_VAL:.*]] = load i32, ptr %[[A_ADDR]], align 4
// OGCG-NEXT: store i32 %[[A_VAL]], ptr @cs, align 4
-// OGCG-NEXT: %[[CS_B_VAL:.*]] = load i8, ptr getelementptr inbounds nuw (%struct.CompleteS, ptr @cs, i32 0, i32 1), align 4
+// OGCG-NEXT: %[[CS_B_VAL:.*]] = load i8, ptr getelementptr inbounds nuw (i8, ptr @cs, i64 4), align 4
// OGCG-NEXT: ret i8 %[[CS_B_VAL]]
char f4(int a, struct CompleteS *p) {
diff --git a/clang/test/CIR/CodeGen/vtt.cpp b/clang/test/CIR/CodeGen/vtt.cpp
index 150bd3bcf2ca9..5880feb323f00 100644
--- a/clang/test/CIR/CodeGen/vtt.cpp
+++ b/clang/test/CIR/CodeGen/vtt.cpp
@@ -540,9 +540,9 @@ D::D() {}
// OGCG-COMMON: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]]
// OGCG-COMMON: %[[A_ADDR:.*]] = getelementptr inbounds i8, ptr %[[THIS]], i64 40
// OGCG-COMMON: call void @_ZN1AC2Ev(ptr {{.*}} %[[A_ADDR]])
-// OGCG-COMMON: call void @_ZN1BC2Ev(ptr {{.*}} %[[THIS]], ptr {{.*}} getelementptr inbounds (ptr, ptr @_ZTT1D, i64 1))
+// 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 (ptr, ptr @_ZTT1D, i64 3))
+// 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: %[[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]]
diff --git a/clang/test/CIR/CodeGenBuiltins/builtin-constant-p.c b/clang/test/CIR/CodeGenBuiltins/builtin-constant-p.c
index 72a6e13edfbb7..a12ea7e61bd61 100644
--- a/clang/test/CIR/CodeGenBuiltins/builtin-constant-p.c
+++ b/clang/test/CIR/CodeGenBuiltins/builtin-constant-p.c
@@ -177,7 +177,7 @@ int test6(void) {
// LLVM: %[[TMP2:.*]] = call i1 @llvm.is.constant.i32(i32 %[[TMP1]])
// OGCG: define {{.*}} i32 @test6()
-// OGCG: %[[TMP1:.*]] = load i32, ptr getelementptr inbounds ([3 x i32], ptr @arr, i64 0, i64 2)
+// OGCG: %[[TMP1:.*]] = load i32, ptr getelementptr inbounds nuw (i8, ptr @arr, i64 8)
// OGCG: %[[TMP2:.*]] = call i1 @llvm.is.constant.i32(i32 %[[TMP1]])
const int c_arr[] = { 1, 2, 3 };
More information about the cfe-commits
mailing list