diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-12-01 20:14:04 -0800 | 
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-12-03 11:05:45 -0800 | 
| commit | 612adbb6bf88ecf549fb93cb1f4edcf793bca88e (patch) | |
| tree | 3f37a1552ccefe3df0da67281b5e060bcc2d3d21 /compiler/rustc_mir_transform/src/instsimplify.rs | |
| parent | 490b2cc09860dd62a7595bb07364d71c12ce4e60 (diff) | |
| download | rust-612adbb6bf88ecf549fb93cb1f4edcf793bca88e.tar.gz rust-612adbb6bf88ecf549fb93cb1f4edcf793bca88e.zip | |
Bounds-check with PtrMetadata instead of Len in MIR
Diffstat (limited to 'compiler/rustc_mir_transform/src/instsimplify.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/instsimplify.rs | 13 | 
1 files changed, 0 insertions, 13 deletions
| diff --git a/compiler/rustc_mir_transform/src/instsimplify.rs b/compiler/rustc_mir_transform/src/instsimplify.rs index a6ba2f32d32..adc3374df2e 100644 --- a/compiler/rustc_mir_transform/src/instsimplify.rs +++ b/compiler/rustc_mir_transform/src/instsimplify.rs @@ -47,7 +47,6 @@ impl<'tcx> crate::MirPass<'tcx> for InstSimplify { } ctx.simplify_bool_cmp(rvalue); ctx.simplify_ref_deref(rvalue); - ctx.simplify_len(rvalue); ctx.simplify_ptr_aggregate(rvalue); ctx.simplify_cast(rvalue); } @@ -132,18 +131,6 @@ impl<'tcx> InstSimplifyContext<'_, 'tcx> { } } - /// Transform `Len([_; N])` ==> `N`. - fn simplify_len(&self, rvalue: &mut Rvalue<'tcx>) { - if let Rvalue::Len(ref place) = *rvalue { - let place_ty = place.ty(self.local_decls, self.tcx).ty; - if let ty::Array(_, len) = *place_ty.kind() { - let const_ = Const::from_ty_const(len, self.tcx.types.usize, self.tcx); - let constant = ConstOperand { span: DUMMY_SP, const_, user_ty: None }; - *rvalue = Rvalue::Use(Operand::Constant(Box::new(constant))); - } - } - } - /// Transform `Aggregate(RawPtr, [p, ()])` ==> `Cast(PtrToPtr, p)`. fn simplify_ptr_aggregate(&self, rvalue: &mut Rvalue<'tcx>) { if let Rvalue::Aggregate(box AggregateKind::RawPtr(pointee_ty, mutability), fields) = rvalue | 
