diff options
| author | bors <bors@rust-lang.org> | 2022-06-21 11:00:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-21 11:00:39 +0000 |
| commit | a25b1315ee968146a5b206a8f3c670c5b307ebfe (patch) | |
| tree | 725cc7bfd11f72a19a2ac5d0212dcb83cfe7ed37 /src/test/codegen | |
| parent | abace0a1f17986d89aedf610819deab2b4afee56 (diff) | |
| parent | 28ff0df6ede91c8bfadb29d5f966cff15b15c9df (diff) | |
| download | rust-a25b1315ee968146a5b206a8f3c670c5b307ebfe.tar.gz rust-a25b1315ee968146a5b206a8f3c670c5b307ebfe.zip | |
Auto merge of #95576 - DrMeepster:box_erasure, r=oli-obk
Remove dereferencing of Box from codegen Through #94043, #94414, #94873, and #95328, I've been fixing issues caused by Box being treated like a pointer when it is not a pointer. However, these PRs just introduced special cases for Box. This PR removes those special cases and instead transforms a deref of Box into a deref of the pointer it contains. Hopefully, this is the end of the Box<T, A> ICEs.
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/loads.rs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/test/codegen/loads.rs b/src/test/codegen/loads.rs index 07de385193f..f448306ba1b 100644 --- a/src/test/codegen/loads.rs +++ b/src/test/codegen/loads.rs @@ -28,93 +28,93 @@ pub fn ptr_alignment_helper(x: &&()) {} // CHECK-LABEL: @load_ref #[no_mangle] pub fn load_ref<'a>(x: &&'a i32) -> &'a i32 { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META:[0-9]+]], !noundef !{{[0-9]+}} + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META:[0-9]+]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_ref_higher_alignment #[no_mangle] pub fn load_ref_higher_alignment<'a>(x: &&'a Align16) -> &'a Align16 { -// CHECK: load {{%Align16\*|i128\*|ptr}}, {{%Align16\*\*|i128\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_16_META:[0-9]+]], !noundef !{{[0-9]+}} + // CHECK: load {{%Align16\*|i128\*|ptr}}, {{%Align16\*\*|i128\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_16_META:[0-9]+]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_scalar_pair #[no_mangle] pub fn load_scalar_pair<'a>(x: &(&'a i32, &'a Align16)) -> (&'a i32, &'a Align16) { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %{{.+}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META]], !noundef !{{[0-9]+}} -// CHECK: load {{i64\*|ptr}}, {{i64\*\*|ptr}} %{{.+}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_16_META]], !noundef !{{[0-9]+}} + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %{{.+}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META]], !noundef !{{[0-9]+}} + // CHECK: load {{i64\*|ptr}}, {{i64\*\*|ptr}} %{{.+}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_16_META]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_raw_pointer #[no_mangle] pub fn load_raw_pointer<'a>(x: &*const i32) -> *const i32 { -// loaded raw pointer should not have !nonnull, !align, or !noundef metadata -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]]{{$}} + // loaded raw pointer should not have !nonnull, !align, or !noundef metadata + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]]{{$}} *x } // CHECK-LABEL: @load_box #[no_mangle] pub fn load_box<'a>(x: Box<Box<i32>>) -> Box<i32> { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META]], !noundef !{{[0-9]+}} + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %{{.*}}, align [[PTR_ALIGNMENT]], !nonnull !{{[0-9]+}}, !align ![[ALIGN_4_META]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_bool #[no_mangle] pub fn load_bool(x: &bool) -> bool { -// CHECK: load i8, {{i8\*|ptr}} %x, align 1, !range ![[BOOL_RANGE:[0-9]+]], !noundef !{{[0-9]+}} + // CHECK: load i8, {{i8\*|ptr}} %x, align 1, !range ![[BOOL_RANGE:[0-9]+]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_maybeuninit_bool #[no_mangle] pub fn load_maybeuninit_bool(x: &MaybeUninit<bool>) -> MaybeUninit<bool> { -// CHECK: load i8, {{i8\*|ptr}} %x, align 1{{$}} + // CHECK: load i8, {{i8\*|ptr}} %x, align 1{{$}} *x } // CHECK-LABEL: @load_enum_bool #[no_mangle] pub fn load_enum_bool(x: &MyBool) -> MyBool { -// CHECK: load i8, {{i8\*|ptr}} %x, align 1, !range ![[BOOL_RANGE]], !noundef !{{[0-9]+}} + // CHECK: load i8, {{i8\*|ptr}} %x, align 1, !range ![[BOOL_RANGE]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_maybeuninit_enum_bool #[no_mangle] pub fn load_maybeuninit_enum_bool(x: &MaybeUninit<MyBool>) -> MaybeUninit<MyBool> { -// CHECK: load i8, {{i8\*|ptr}} %x, align 1{{$}} + // CHECK: load i8, {{i8\*|ptr}} %x, align 1{{$}} *x } // CHECK-LABEL: @load_int #[no_mangle] pub fn load_int(x: &u16) -> u16 { -// CHECK: load i16, {{i16\*|ptr}} %x, align 2{{$}} + // CHECK: load i16, {{i16\*|ptr}} %x, align 2{{$}} *x } // CHECK-LABEL: @load_nonzero_int #[no_mangle] pub fn load_nonzero_int(x: &NonZeroU16) -> NonZeroU16 { -// CHECK: load i16, {{i16\*|ptr}} %x, align 2, !range ![[NONZEROU16_RANGE:[0-9]+]], !noundef !{{[0-9]+}} + // CHECK: load i16, {{i16\*|ptr}} %x, align 2, !range ![[NONZEROU16_RANGE:[0-9]+]], !noundef !{{[0-9]+}} *x } // CHECK-LABEL: @load_option_nonzero_int #[no_mangle] pub fn load_option_nonzero_int(x: &Option<NonZeroU16>) -> Option<NonZeroU16> { -// CHECK: load i16, {{i16\*|ptr}} %x, align 2{{$}} + // CHECK: load i16, {{i16\*|ptr}} %x, align 2{{$}} *x } // CHECK-LABEL: @borrow #[no_mangle] pub fn borrow(x: &i32) -> &i32 { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x{{.*}}, !nonnull + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x{{.*}}, !nonnull &x; // keep variable in an alloca x } @@ -122,7 +122,7 @@ pub fn borrow(x: &i32) -> &i32 { // CHECK-LABEL: @_box #[no_mangle] pub fn _box(x: Box<i32>) -> i32 { -// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x{{.*}}, !nonnull + // CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x{{.*}}, align [[PTR_ALIGNMENT]] *x } @@ -131,8 +131,8 @@ pub fn _box(x: Box<i32>) -> i32 { // dependent alignment #[no_mangle] pub fn small_array_alignment(x: [i8; 4]) -> [i8; 4] { -// CHECK: [[VAR:%[0-9]+]] = load i32, {{i32\*|ptr}} %{{.*}}, align 1 -// CHECK: ret i32 [[VAR]] + // CHECK: [[VAR:%[0-9]+]] = load i32, {{i32\*|ptr}} %{{.*}}, align 1 + // CHECK: ret i32 [[VAR]] x } @@ -141,8 +141,8 @@ pub fn small_array_alignment(x: [i8; 4]) -> [i8; 4] { // dependent alignment #[no_mangle] pub fn small_struct_alignment(x: Bytes) -> Bytes { -// CHECK: [[VAR:%[0-9]+]] = load i32, {{i32\*|ptr}} %{{.*}}, align 1 -// CHECK: ret i32 [[VAR]] + // CHECK: [[VAR:%[0-9]+]] = load i32, {{i32\*|ptr}} %{{.*}}, align 1 + // CHECK: ret i32 [[VAR]] x } |
