about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorErik Desjardins <erikdesjardins@users.noreply.github.com>2024-02-23 23:23:35 -0500
committerErik Desjardins <erikdesjardins@users.noreply.github.com>2024-02-26 22:28:09 -0500
commit123015e7224fda0e9600962aa23202ac322271bc (patch)
treea5df56c558e7f196c326824fb7e4e7f7f59006a3 /tests/codegen
parent71ffdf7ff7ac6df5f9f64de7e780b8345797e8a0 (diff)
downloadrust-123015e7224fda0e9600962aa23202ac322271bc.tar.gz
rust-123015e7224fda0e9600962aa23202ac322271bc.zip
always use gep inbounds i8 (ptradd) for field offsets
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/align-struct.rs1
-rw-r--r--tests/codegen/i128-x86-align.rs4
-rw-r--r--tests/codegen/issues/issue-105386-ub-in-debuginfo.rs4
-rw-r--r--tests/codegen/zst-offset.rs4
4 files changed, 6 insertions, 7 deletions
diff --git a/tests/codegen/align-struct.rs b/tests/codegen/align-struct.rs
index 34475a3852b..31859152830 100644
--- a/tests/codegen/align-struct.rs
+++ b/tests/codegen/align-struct.rs
@@ -26,7 +26,6 @@ pub enum Enum64 {
     B(i32),
 }
 // CHECK: %Enum64 = type { i32, [31 x i32] }
-// CHECK: %"Enum64::A" = type { [8 x i64], %Align64 }
 
 // CHECK-LABEL: @align64
 #[no_mangle]
diff --git a/tests/codegen/i128-x86-align.rs b/tests/codegen/i128-x86-align.rs
index 9cc5c3d3ed7..b2e0c294c39 100644
--- a/tests/codegen/i128-x86-align.rs
+++ b/tests/codegen/i128-x86-align.rs
@@ -94,9 +94,9 @@ pub fn store_struct(x: &mut Struct) {
     // CHECK-SAME: align 16 dereferenceable(32) %x
     // CHECK:      [[TMP:%.*]] = alloca %Struct, align 16
     // CHECK:      store i32 1, ptr [[TMP]], align 16
-    // CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds %Struct, ptr [[TMP]], i32 0, i32 1
+    // CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[TMP]], i64 4
     // CHECK-NEXT: store i32 2, ptr [[GEP1]], align 4
-    // CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds %Struct, ptr [[TMP]], i32 0, i32 3
+    // CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[TMP]], i64 16
     // CHECK-NEXT: store i128 3, ptr [[GEP2]], align 16
     // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 %x, ptr align 16 [[TMP]], i64 32, i1 false)
     *x = Struct { a: 1, b: 2, c: 3 };
diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
index 476db7c1358..0bd43dc50b2 100644
--- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
+++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
@@ -16,8 +16,8 @@ pub fn outer_function(x: S, y: S) -> usize {
 // when generating debuginfo.
 // CHECK-LABEL: @outer_function
 // CHECK: [[spill:%.*]] = alloca %"{closure@{{.*.rs}}:9:23: 9:25}"
-// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"{closure@{{.*.rs}}:9:23: 9:25}", ptr [[spill]]
+// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds i8, ptr [[spill]]
 // CHECK-NOT: [[load:%.*]] = load ptr, ptr
 // CHECK: call void @llvm.lifetime.start{{.*}}({{.*}}, ptr [[spill]])
-// CHECK: [[inner:%.*]] = getelementptr inbounds %"{{.*}}", ptr [[spill]]
+// CHECK: [[inner:%.*]] = getelementptr inbounds i8, ptr [[spill]]
 // CHECK: call void @llvm.memcpy{{.*}}(ptr {{align .*}} [[inner]], ptr {{align .*}} %x
diff --git a/tests/codegen/zst-offset.rs b/tests/codegen/zst-offset.rs
index ad996d8ae1b..b623d492d9d 100644
--- a/tests/codegen/zst-offset.rs
+++ b/tests/codegen/zst-offset.rs
@@ -13,7 +13,7 @@ pub fn helper(_: usize) {
 // CHECK-LABEL: @scalar_layout
 #[no_mangle]
 pub fn scalar_layout(s: &(u64, ())) {
-// CHECK: getelementptr i8, {{.+}}, [[USIZE]] 8
+// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 8
     let x = &s.1;
     witness(&x); // keep variable in an alloca
 }
@@ -34,7 +34,7 @@ pub struct U64x4(u64, u64, u64, u64);
 // CHECK-LABEL: @vector_layout
 #[no_mangle]
 pub fn vector_layout(s: &(U64x4, ())) {
-// CHECK: getelementptr i8, {{.+}}, [[USIZE]] 32
+// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 32
     let x = &s.1;
     witness(&x); // keep variable in an alloca
 }