about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-12 04:11:37 +0000
committerbors <bors@rust-lang.org>2024-03-12 04:11:37 +0000
commit0fa7feaf3f287b900176061053619c06306c67b0 (patch)
tree7d3f51248c9bea487602be94be70ffdc5f59695b /tests/codegen
parent5aad51d015b8d3f6d823a6bf9dbc8ae3b9fd10c5 (diff)
parent2eb9c6d49ef949c551892fa58270071f5e997416 (diff)
downloadrust-0fa7feaf3f287b900176061053619c06306c67b0.tar.gz
rust-0fa7feaf3f287b900176061053619c06306c67b0.zip
Auto merge of #121282 - saethlin:gep-null-means-no-provenance, r=scottmcm
Lower transmutes from int to pointer type as gep on null

I thought of this while looking at https://github.com/rust-lang/rust/pull/121242. See that PR's description for why this lowering is preferable.

The UI test that's being changed here crashes without changing the transmutes into casts. Based on that, this PR should not be merged without a crater build-and-test run.
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/intrinsics/transmute.rs4
-rw-r--r--tests/codegen/transmute-scalar.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs
index 5a503e86010..f858562b5f1 100644
--- a/tests/codegen/intrinsics/transmute.rs
+++ b/tests/codegen/intrinsics/transmute.rs
@@ -296,7 +296,7 @@ pub unsafe fn check_pair_with_bool(x: (u8, bool)) -> (bool, i8) {
 pub unsafe fn check_float_to_pointer(x: f64) -> *const () {
     // CHECK-NOT: alloca
     // CHECK: %0 = bitcast double %x to i64
-    // CHECK: %_0 = inttoptr i64 %0 to ptr
+    // CHECK: %_0 = getelementptr i8, ptr null, i64 %0
     // CHECK: ret ptr %_0
     transmute(x)
 }
@@ -371,7 +371,7 @@ pub unsafe fn check_issue_110005(x: (usize, bool)) -> Option<Box<[u8]>> {
 // CHECK-LABEL: @check_pair_to_dst_ref(
 #[no_mangle]
 pub unsafe fn check_pair_to_dst_ref<'a>(x: (usize, usize)) -> &'a [u8] {
-    // CHECK: %_0.0 = inttoptr i64 %x.0 to ptr
+    // CHECK: %_0.0 = getelementptr i8, ptr null, i64 %x.0
     // CHECK: %0 = insertvalue { ptr, i64 } poison, ptr %_0.0, 0
     // CHECK: %1 = insertvalue { ptr, i64 } %0, i64 %x.1, 1
     // CHECK: ret { ptr, i64 } %1
diff --git a/tests/codegen/transmute-scalar.rs b/tests/codegen/transmute-scalar.rs
index 7a5eb4dfcd5..caaa70962d5 100644
--- a/tests/codegen/transmute-scalar.rs
+++ b/tests/codegen/transmute-scalar.rs
@@ -49,7 +49,7 @@ pub fn ptr_to_int(p: *mut u16) -> usize {
 }
 
 // CHECK: define{{.*}}ptr @int_to_ptr([[USIZE]] %i)
-// CHECK: %_0 = inttoptr [[USIZE]] %i to ptr
+// CHECK: %_0 = getelementptr i8, ptr null, [[USIZE]] %i
 // CHECK-NEXT: ret ptr %_0
 #[no_mangle]
 pub fn int_to_ptr(i: usize) -> *mut u16 {