about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-05 09:59:14 +0000
committerbors <bors@rust-lang.org>2023-10-05 09:59:14 +0000
commit5c3a0e932b7c6864f98dac739b576e9ff5913739 (patch)
treecbad8c7ef15a64044778e6f9999c631aff576e63
parente2939270168f2a23ef2ec0b2a193dbb63f92ae07 (diff)
parente63d19c4ddae8f7ce51e1953bfc4a61235f528f7 (diff)
downloadrust-5c3a0e932b7c6864f98dac739b576e9ff5913739.tar.gz
rust-5c3a0e932b7c6864f98dac739b576e9ff5913739.zip
Auto merge of #116427 - cjgillot:no-internal, r=oli-obk
Remove mir::LocalDecl::internal.

It does not serve any purpose, as we don't have typeck-based generator witnesses any more.
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs2
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs26
-rw-r--r--compiler/rustc_middle/src/mir/patch.rs11
-rw-r--r--compiler/rustc_middle/src/mir/visit.rs1
-rw-r--r--compiler/rustc_mir_build/src/build/expr/as_rvalue.rs2
-rw-r--r--compiler/rustc_mir_build/src/build/expr/as_temp.rs2
-rw-r--r--compiler/rustc_mir_build/src/build/matches/mod.rs3
-rw-r--r--compiler/rustc_mir_build/src/build/misc.rs4
-rw-r--r--compiler/rustc_mir_build/src/build/scope.rs2
-rw-r--r--compiler/rustc_mir_transform/src/check_unsafety.rs2
-rw-r--r--compiler/rustc_mir_transform/src/deref_separator.rs2
-rw-r--r--compiler/rustc_mir_transform/src/elaborate_box_derefs.rs2
-rw-r--r--compiler/rustc_mir_transform/src/elaborate_drops.rs2
-rw-r--r--compiler/rustc_mir_transform/src/generator.rs2
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs8
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir4
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff4
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff4
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff10
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff10
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff2
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir4
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir4
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff2
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir2
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir5
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir5
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir16
-rw-r--r--tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff2
38 files changed, 106 insertions, 57 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index d380849fefe..c4d806c5161 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -237,7 +237,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
         if self.const_kind() == hir::ConstContext::ConstFn {
             for (idx, local) in body.local_decls.iter_enumerated() {
                 // Handle the return place below.
-                if idx == RETURN_PLACE || local.internal {
+                if idx == RETURN_PLACE {
                     continue;
                 }
 
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 0bb1c66da0c..7534c9c0a68 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -830,22 +830,6 @@ pub struct LocalDecl<'tcx> {
     // FIXME(matthewjasper) Don't store in this in `Body`
     pub local_info: ClearCrossCrate<Box<LocalInfo<'tcx>>>,
 
-    /// `true` if this is an internal local.
-    ///
-    /// These locals are not based on types in the source code and are only used
-    /// for a few desugarings at the moment.
-    ///
-    /// The generator transformation will sanity check the locals which are live
-    /// across a suspension point against the type components of the generator
-    /// which type checking knows are live across a suspension point. We need to
-    /// flag drop flags to avoid triggering this check as they are introduced
-    /// outside of type inference.
-    ///
-    /// This should be sound because the drop flags are fully algebraic, and
-    /// therefore don't affect the auto-trait or outlives properties of the
-    /// generator.
-    pub internal: bool,
-
     /// The type of this local.
     pub ty: Ty<'tcx>,
 
@@ -1058,7 +1042,7 @@ impl<'tcx> LocalDecl<'tcx> {
         self.source_info.span.desugaring_kind().is_some()
     }
 
-    /// Creates a new `LocalDecl` for a temporary: mutable, non-internal.
+    /// Creates a new `LocalDecl` for a temporary, mutable.
     #[inline]
     pub fn new(ty: Ty<'tcx>, span: Span) -> Self {
         Self::with_source_info(ty, SourceInfo::outermost(span))
@@ -1070,20 +1054,12 @@ impl<'tcx> LocalDecl<'tcx> {
         LocalDecl {
             mutability: Mutability::Mut,
             local_info: ClearCrossCrate::Set(Box::new(LocalInfo::Boring)),
-            internal: false,
             ty,
             user_ty: None,
             source_info,
         }
     }
 
-    /// Converts `self` into same `LocalDecl` except tagged as internal.
-    #[inline]
-    pub fn internal(mut self) -> Self {
-        self.internal = true;
-        self
-    }
-
     /// Converts `self` into same `LocalDecl` except tagged as immutable.
     #[inline]
     pub fn immutable(mut self) -> Self {
diff --git a/compiler/rustc_middle/src/mir/patch.rs b/compiler/rustc_middle/src/mir/patch.rs
index da486c3465a..ce2ddec0116 100644
--- a/compiler/rustc_middle/src/mir/patch.rs
+++ b/compiler/rustc_middle/src/mir/patch.rs
@@ -127,7 +127,7 @@ impl<'tcx> MirPatch<'tcx> {
         Location { block: bb, statement_index: offset }
     }
 
-    pub fn new_internal_with_info(
+    pub fn new_local_with_info(
         &mut self,
         ty: Ty<'tcx>,
         span: Span,
@@ -135,7 +135,7 @@ impl<'tcx> MirPatch<'tcx> {
     ) -> Local {
         let index = self.next_local;
         self.next_local += 1;
-        let mut new_decl = LocalDecl::new(ty, span).internal();
+        let mut new_decl = LocalDecl::new(ty, span);
         **new_decl.local_info.as_mut().assert_crate_local() = local_info;
         self.new_locals.push(new_decl);
         Local::new(index)
@@ -148,13 +148,6 @@ impl<'tcx> MirPatch<'tcx> {
         Local::new(index)
     }
 
-    pub fn new_internal(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
-        let index = self.next_local;
-        self.next_local += 1;
-        self.new_locals.push(LocalDecl::new(ty, span).internal());
-        Local::new(index)
-    }
-
     pub fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock {
         let block = BasicBlock::new(self.patch_map.len());
         debug!("MirPatch: new_block: {:?}: {:?}", block, data);
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs
index 60f78bef0af..9bd682d37ab 100644
--- a/compiler/rustc_middle/src/mir/visit.rs
+++ b/compiler/rustc_middle/src/mir/visit.rs
@@ -815,7 +815,6 @@ macro_rules! make_mir_visitor {
                     ty,
                     user_ty,
                     source_info,
-                    internal: _,
                     local_info: _,
                 } = local_decl;
 
diff --git a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
index d4089eef483..afb65ffbe8c 100644
--- a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
+++ b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
@@ -183,7 +183,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 // The `Box<T>` temporary created here is not a part of the HIR,
                 // and therefore is not considered during generator auto-trait
                 // determination. See the comment about `box` at `yield_in_scope`.
-                let result = this.local_decls.push(LocalDecl::new(expr.ty, expr_span).internal());
+                let result = this.local_decls.push(LocalDecl::new(expr.ty, expr_span));
                 this.cfg.push(
                     block,
                     Statement { source_info, kind: StatementKind::StorageLive(result) },
diff --git a/compiler/rustc_mir_build/src/build/expr/as_temp.rs b/compiler/rustc_mir_build/src/build/expr/as_temp.rs
index c8910c272b1..a4ab365fa9a 100644
--- a/compiler/rustc_mir_build/src/build/expr/as_temp.rs
+++ b/compiler/rustc_mir_build/src/build/expr/as_temp.rs
@@ -52,12 +52,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
             let local_info = match expr.kind {
                 ExprKind::StaticRef { def_id, .. } => {
                     assert!(!this.tcx.is_thread_local_static(def_id));
-                    local_decl.internal = true;
                     LocalInfo::StaticRef { def_id, is_thread_local: false }
                 }
                 ExprKind::ThreadLocalRef(def_id) => {
                     assert!(this.tcx.is_thread_local_static(def_id));
-                    local_decl.internal = true;
                     LocalInfo::StaticRef { def_id, is_thread_local: true }
                 }
                 ExprKind::NamedConst { def_id, .. } | ExprKind::ConstParam { def_id, .. } => {
diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs
index 921a5ca1175..eb1c6a9824a 100644
--- a/compiler/rustc_mir_build/src/build/matches/mod.rs
+++ b/compiler/rustc_mir_build/src/build/matches/mod.rs
@@ -1798,7 +1798,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 let fake_borrow_ty =
                     Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, fake_borrow_deref_ty);
                 let mut fake_borrow_temp = LocalDecl::new(fake_borrow_ty, temp_span);
-                fake_borrow_temp.internal = self.local_decls[matched_place.local].internal;
                 fake_borrow_temp.local_info = ClearCrossCrate::Set(Box::new(LocalInfo::FakeBorrow));
                 let fake_borrow_temp = self.local_decls.push(fake_borrow_temp);
 
@@ -2268,7 +2267,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
             ty: var_ty,
             user_ty: if user_ty.is_empty() { None } else { Some(Box::new(user_ty)) },
             source_info,
-            internal: false,
             local_info: ClearCrossCrate::Set(Box::new(LocalInfo::User(BindingForm::Var(
                 VarBindingForm {
                     binding_mode,
@@ -2298,7 +2296,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 ty: Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, var_ty),
                 user_ty: None,
                 source_info,
-                internal: false,
                 local_info: ClearCrossCrate::Set(Box::new(LocalInfo::User(
                     BindingForm::RefForGuard,
                 ))),
diff --git a/compiler/rustc_mir_build/src/build/misc.rs b/compiler/rustc_mir_build/src/build/misc.rs
index c96e99ef0e7..c263de79c3b 100644
--- a/compiler/rustc_mir_build/src/build/misc.rs
+++ b/compiler/rustc_mir_build/src/build/misc.rs
@@ -15,9 +15,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
     /// N.B., **No cleanup is scheduled for this temporary.** You should
     /// call `schedule_drop` once the temporary is initialized.
     pub(crate) fn temp(&mut self, ty: Ty<'tcx>, span: Span) -> Place<'tcx> {
-        // Mark this local as internal to avoid temporaries with types not present in the
-        // user's code resulting in ICEs from the generator transform.
-        let temp = self.local_decls.push(LocalDecl::new(ty, span).internal());
+        let temp = self.local_decls.push(LocalDecl::new(ty, span));
         let place = Place::from(temp);
         debug!("temp: created temp {:?} with type {:?}", place, self.local_decls[temp].ty);
         place
diff --git a/compiler/rustc_mir_build/src/build/scope.rs b/compiler/rustc_mir_build/src/build/scope.rs
index 4cf6a349af7..bc151cc7058 100644
--- a/compiler/rustc_mir_build/src/build/scope.rs
+++ b/compiler/rustc_mir_build/src/build/scope.rs
@@ -725,7 +725,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
     // Add a dummy `Assign` statement to the CFG, with the span for the source code's `continue`
     // statement.
     fn add_dummy_assignment(&mut self, span: Span, block: BasicBlock, source_info: SourceInfo) {
-        let local_decl = LocalDecl::new(Ty::new_unit(self.tcx), span).internal();
+        let local_decl = LocalDecl::new(Ty::new_unit(self.tcx), span);
         let temp_place = Place::from(self.local_decls.push(local_decl));
         self.cfg.push_assign_unit(block, source_info, temp_place, self.tcx);
     }
diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs
index bacabc62ee4..c428007707e 100644
--- a/compiler/rustc_mir_transform/src/check_unsafety.rs
+++ b/compiler/rustc_mir_transform/src/check_unsafety.rs
@@ -179,7 +179,7 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> {
         // Check the base local: it might be an unsafe-to-access static. We only check derefs of the
         // temporary holding the static pointer to avoid duplicate errors
         // <https://github.com/rust-lang/rust/pull/78068#issuecomment-731753506>.
-        if decl.internal && place.projection.first() == Some(&ProjectionElem::Deref) {
+        if place.projection.first() == Some(&ProjectionElem::Deref) {
             // If the projection root is an artificial local that we introduced when
             // desugaring `static`, give a more specific error message
             // (avoid the general "raw pointer" clause below, that would only be confusing).
diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs
index 95898b5b73c..42be7457018 100644
--- a/compiler/rustc_mir_transform/src/deref_separator.rs
+++ b/compiler/rustc_mir_transform/src/deref_separator.rs
@@ -37,7 +37,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for DerefChecker<'a, 'tcx> {
             for (idx, (p_ref, p_elem)) in place.iter_projections().enumerate() {
                 if !p_ref.projection.is_empty() && p_elem == ProjectionElem::Deref {
                     let ty = p_ref.ty(self.local_decls, self.tcx).ty;
-                    let temp = self.patcher.new_internal_with_info(
+                    let temp = self.patcher.new_local_with_info(
                         ty,
                         self.local_decls[p_ref.local].source_info.span,
                         LocalInfo::DerefTemp,
diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs
index e51f771e00d..1c917a85c03 100644
--- a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs
+++ b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs
@@ -69,7 +69,7 @@ impl<'tcx, 'a> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'tcx, 'a> {
             let (unique_ty, nonnull_ty, ptr_ty) =
                 build_ptr_tys(tcx, base_ty.boxed_ty(), self.unique_did, self.nonnull_did);
 
-            let ptr_local = self.patch.new_internal(ptr_ty, source_info.span);
+            let ptr_local = self.patch.new_temp(ptr_ty, source_info.span);
 
             self.patch.add_assign(
                 location,
diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs
index b62d7da2a4c..d18fdaaf22f 100644
--- a/compiler/rustc_mir_transform/src/elaborate_drops.rs
+++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs
@@ -271,7 +271,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
         let tcx = self.tcx;
         let patch = &mut self.patch;
         debug!("create_drop_flag({:?})", self.body.span);
-        self.drop_flags[index].get_or_insert_with(|| patch.new_internal(tcx.types.bool, span));
+        self.drop_flags[index].get_or_insert_with(|| patch.new_temp(tcx.types.bool, span));
     }
 
     fn drop_flag(&mut self, index: MovePathIndex) -> Option<Place<'tcx>> {
diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs
index 8a807d786a5..c16f07a453c 100644
--- a/compiler/rustc_mir_transform/src/generator.rs
+++ b/compiler/rustc_mir_transform/src/generator.rs
@@ -321,7 +321,7 @@ impl<'tcx> TransformVisitor<'tcx> {
 
     // Create a statement which reads the discriminant into a temporary
     fn get_discr(&self, body: &mut Body<'tcx>) -> (Statement<'tcx>, Place<'tcx>) {
-        let temp_decl = LocalDecl::new(self.discr_ty, body.span).internal();
+        let temp_decl = LocalDecl::new(self.discr_ty, body.span);
         let local_decls_len = body.local_decls.push(temp_decl);
         let temp = Place::from(local_decls_len);
 
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index b53e0852c09..32dfb743905 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -616,9 +616,7 @@ impl<'tcx> Inliner<'tcx> {
                 // If there are any locals without storage markers, give them storage only for the
                 // duration of the call.
                 for local in callee_body.vars_and_temps_iter() {
-                    if !callee_body.local_decls[local].internal
-                        && integrator.always_live_locals.contains(local)
-                    {
+                    if integrator.always_live_locals.contains(local) {
                         let new_local = integrator.map_local(local);
                         caller_body[callsite.block].statements.push(Statement {
                             source_info: callsite.source_info,
@@ -641,9 +639,7 @@ impl<'tcx> Inliner<'tcx> {
                         n += 1;
                     }
                     for local in callee_body.vars_and_temps_iter().rev() {
-                        if !callee_body.local_decls[local].internal
-                            && integrator.always_live_locals.contains(local)
-                        {
+                        if integrator.always_live_locals.contains(local) {
                             let new_local = integrator.map_local(local);
                             caller_body[block].statements.push(Statement {
                                 source_info: callsite.source_info,
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
index 7ba51ccdbf6..d585ae89e82 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
@@ -20,6 +20,7 @@
           _2 = const u8::MAX;
           StorageLive(_3);
           _3 = const 1_u8;
+          StorageLive(_4);
 -         _4 = CheckedAdd(_2, _3);
 -         assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
 +         _4 = const (0_u8, true);
@@ -29,6 +30,7 @@
       bb1: {
 -         _1 = move (_4.0: u8);
 +         _1 = const 0_u8;
+          StorageDead(_4);
           StorageDead(_3);
           StorageDead(_2);
           StorageDead(_1);
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
index 545b7f22f6e..9fe39090638 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
@@ -20,6 +20,7 @@
           _2 = const u8::MAX;
           StorageLive(_3);
           _3 = const 1_u8;
+          StorageLive(_4);
 -         _4 = CheckedAdd(_2, _3);
 -         assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
 +         _4 = const (0_u8, true);
@@ -29,6 +30,7 @@
       bb1: {
 -         _1 = move (_4.0: u8);
 +         _1 = const 0_u8;
+          StorageDead(_4);
           StorageDead(_3);
           StorageDead(_2);
           StorageDead(_1);
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
index 9a68d3b51b5..87bb1454c96 100644
--- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
@@ -20,6 +20,7 @@
           _2 = const u8::MAX;
           StorageLive(_3);
           _3 = const 1_u8;
+          StorageLive(_4);
 -         _4 = CheckedAdd(_2, _3);
 -         assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
 +         _4 = CheckedAdd(const u8::MAX, const 1_u8);
@@ -29,6 +30,7 @@
       bb1: {
 -         _1 = move (_4.0: u8);
 +         _1 = const 0_u8;
+          StorageDead(_4);
           StorageDead(_3);
           StorageDead(_2);
           StorageDead(_1);
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff
index c1d281ab788..b2f13640a4c 100644
--- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff
@@ -20,6 +20,7 @@
           _2 = const u8::MAX;
           StorageLive(_3);
           _3 = const 1_u8;
+          StorageLive(_4);
 -         _4 = CheckedAdd(_2, _3);
 -         assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
 +         _4 = CheckedAdd(const u8::MAX, const 1_u8);
@@ -29,6 +30,7 @@
       bb1: {
 -         _1 = move (_4.0: u8);
 +         _1 = const 0_u8;
+          StorageDead(_4);
           StorageDead(_3);
           StorageDead(_2);
           StorageDead(_1);
diff --git a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
index 721fac27d88..10b81e59b5f 100644
--- a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
@@ -41,6 +41,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
         _7 = (move _8,);
         StorageLive(_9);
         _9 = move (_7.0: i32);
+        StorageLive(_10);
+        StorageLive(_12);
         StorageLive(_11);
         _10 = ((*_6).0: &i32);
         _11 = (*_10);
@@ -50,6 +52,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
         _0 = (move _11, move _13);
         StorageDead(_13);
         StorageDead(_11);
+        StorageDead(_12);
+        StorageDead(_10);
         StorageDead(_9);
         StorageDead(_8);
         StorageDead(_7);
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
index 4a816e024c5..d592ddfd183 100644
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
@@ -44,6 +44,8 @@
 +         StorageDead(_3);
 +         StorageLive(_6);
 +         _6 = const false;
++         StorageLive(_7);
++         StorageLive(_8);
 +         _7 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
 +         _8 = discriminant((*_7));
 +         switchInt(move _8) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
@@ -52,6 +54,8 @@
       bb1: {
 -         _3 = &mut _4;
 -         _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable];
++         StorageDead(_8);
++         StorageDead(_7);
 +         StorageDead(_6);
 +         StorageDead(_2);
 +         drop(_4) -> [return: bb2, unwind unreachable];
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
index 2b910cd6543..120aa52ac01 100644
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
@@ -52,6 +52,8 @@
 -         _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
 +         StorageLive(_6);
 +         _6 = const false;
++         StorageLive(_7);
++         StorageLive(_8);
 +         _7 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
 +         _8 = discriminant((*_7));
 +         switchInt(move _8) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11];
@@ -59,6 +61,8 @@
   
 -     bb3: {
 +     bb1: {
++         StorageDead(_8);
++         StorageDead(_7);
 +         StorageDead(_6);
           StorageDead(_2);
 -         drop(_4) -> [return: bb4, unwind: bb6];
diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
index dc0ab255afd..b90e0505c54 100644
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
@@ -122,9 +122,14 @@
 +         _3 = const _;
 +         _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
 +         StorageDead(_3);
++         StorageLive(_4);
++         StorageLive(_5);
++         StorageLive(_6);
++         StorageLive(_7);
 +         _4 = SizeOf(std::vec::Vec<u32>);
 +         _5 = AlignOf(std::vec::Vec<u32>);
 +         StorageLive(_8);
++         StorageLive(_10);
 +         StorageLive(_11);
 +         StorageLive(_12);
 +         StorageLive(_13);
@@ -178,10 +183,15 @@
 +         StorageDead(_13);
 +         StorageDead(_12);
 +         StorageDead(_11);
++         StorageDead(_10);
 +         StorageDead(_8);
 +         _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
 +         _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
 +         (*_7) = move _2;
++         StorageDead(_7);
++         StorageDead(_6);
++         StorageDead(_5);
++         StorageDead(_4);
           StorageDead(_2);
           _0 = const ();
 -         drop(_1) -> [return: bb3, unwind unreachable];
diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
index 675292f06d6..f9c637caa18 100644
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
@@ -122,9 +122,14 @@
 +         _3 = const _;
 +         _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
 +         StorageDead(_3);
++         StorageLive(_4);
++         StorageLive(_5);
++         StorageLive(_6);
++         StorageLive(_7);
 +         _4 = SizeOf(std::vec::Vec<u32>);
 +         _5 = AlignOf(std::vec::Vec<u32>);
 +         StorageLive(_8);
++         StorageLive(_10);
 +         StorageLive(_11);
 +         StorageLive(_12);
 +         StorageLive(_13);
@@ -195,10 +200,15 @@
 +         StorageDead(_13);
 +         StorageDead(_12);
 +         StorageDead(_11);
++         StorageDead(_10);
 +         StorageDead(_8);
 +         _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
 +         _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
 +         (*_7) = move _2;
++         StorageDead(_7);
++         StorageDead(_6);
++         StorageDead(_5);
++         StorageDead(_4);
 +         StorageDead(_2);
 +         _0 = const ();
 +         drop(_1) -> [return: bb1, unwind: bb2];
diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
index 3d0c1072527..688ab9c563a 100644
--- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
@@ -18,6 +18,7 @@
       bb0: {
 -         _0 = inner() -> [return: bb1, unwind unreachable];
 +         StorageLive(_1);
++         StorageLive(_2);
 +         _1 = const _;
 +         _0 = index() -> [return: bb1, unwind unreachable];
       }
@@ -40,6 +41,7 @@
 + 
 +     bb4: {
 +         StorageDead(_3);
++         StorageDead(_2);
 +         StorageDead(_1);
           return;
       }
diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
index 16a19f4a356..e4d2b1a7ffb 100644
--- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
@@ -18,6 +18,7 @@
       bb0: {
 -         _0 = inner() -> [return: bb1, unwind continue];
 +         StorageLive(_1);
++         StorageLive(_2);
 +         _1 = const _;
 +         _0 = index() -> [return: bb1, unwind continue];
       }
@@ -40,6 +41,7 @@
 + 
 +     bb4: {
 +         StorageDead(_3);
++         StorageDead(_2);
 +         StorageDead(_1);
           return;
       }
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
index 6837da27a96..62d7e839f5a 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
@@ -17,9 +17,13 @@ fn b(_1: &mut Box<T>) -> &mut T {
         StorageLive(_3);
         StorageLive(_4);
         _4 = &mut (*_1);
+        StorageLive(_5);
+        StorageLive(_6);
         _5 = deref_copy (*_4);
         _6 = (((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
         _3 = &mut (*_6);
+        StorageDead(_6);
+        StorageDead(_5);
         _2 = &mut (*_3);
         StorageDead(_4);
         _0 = &mut (*_2);
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
index d09bfc33ff1..bc0aa06a752 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
@@ -15,9 +15,13 @@ fn d(_1: &Box<T>) -> &T {
         StorageLive(_2);
         StorageLive(_3);
         _3 = &(*_1);
+        StorageLive(_4);
+        StorageLive(_5);
         _4 = deref_copy (*_3);
         _5 = (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
         _2 = &(*_5);
+        StorageDead(_5);
+        StorageDead(_4);
         _0 = &(*_2);
         StorageDead(_3);
         StorageDead(_2);
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
index e3c57347392..018b6c1ee95 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
@@ -30,6 +30,7 @@
           _2 = move _1;
 -         _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable];
 +         StorageLive(_3);
++         StorageLive(_4);
 +         _4 = discriminant(_2);
 +         switchInt(move _4) -> [1: bb2, otherwise: bb1];
       }
@@ -40,6 +41,7 @@
 + 
 +     bb2: {
 +         _0 = move ((_2 as Some).0: T);
++         StorageDead(_4);
 +         StorageDead(_3);
           StorageDead(_2);
           return;
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff
index fc638cb3ace..47845758a3f 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff
@@ -30,6 +30,7 @@
           _2 = move _1;
 -         _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2];
 +         StorageLive(_3);
++         StorageLive(_4);
 +         _4 = discriminant(_2);
 +         switchInt(move _4) -> [1: bb2, otherwise: bb1];
       }
@@ -44,6 +45,7 @@
 -         resume;
 +     bb2: {
 +         _0 = move ((_2 as Some).0: T);
++         StorageDead(_4);
 +         StorageDead(_3);
 +         StorageDead(_2);
 +         return;
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir
index fcc4d43ced6..392f085bd4d 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir
@@ -25,12 +25,14 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
 
     bb0: {
         StorageLive(_3);
+        StorageLive(_2);
         _2 = discriminant(_1);
         switchInt(move _2) -> [1: bb1, otherwise: bb2];
     }
 
     bb1: {
         _0 = move ((_1 as Some).0: T);
+        StorageDead(_2);
         StorageDead(_3);
         return;
     }
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir
index fcc4d43ced6..392f085bd4d 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir
@@ -25,12 +25,14 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
 
     bb0: {
         StorageLive(_3);
+        StorageLive(_2);
         _2 = discriminant(_1);
         switchInt(move _2) -> [1: bb1, otherwise: bb2];
     }
 
     bb1: {
         _0 = move ((_1 as Some).0: T);
+        StorageDead(_2);
         StorageDead(_3);
         return;
     }
diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir
index f8c85941813..55ccf6a8b45 100644
--- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir
@@ -30,6 +30,7 @@ fn num_to_digit(_1: char) -> u32 {
     }
 
     bb1: {
+        StorageLive(_3);
         _3 = discriminant(_2);
         StorageDead(_7);
         StorageDead(_2);
@@ -37,11 +38,13 @@ fn num_to_digit(_1: char) -> u32 {
     }
 
     bb2: {
+        StorageDead(_3);
         StorageLive(_4);
         _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable];
     }
 
     bb3: {
+        StorageLive(_5);
         _5 = discriminant(_4);
         switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6];
     }
@@ -52,6 +55,7 @@ fn num_to_digit(_1: char) -> u32 {
 
     bb5: {
         _0 = move ((_4 as Some).0: u32);
+        StorageDead(_5);
         StorageDead(_4);
         goto -> bb8;
     }
@@ -61,6 +65,7 @@ fn num_to_digit(_1: char) -> u32 {
     }
 
     bb7: {
+        StorageDead(_3);
         _0 = const 0_u32;
         goto -> bb8;
     }
diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir
index df7392edc50..cb70a83e7f8 100644
--- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir
@@ -30,6 +30,7 @@ fn num_to_digit(_1: char) -> u32 {
     }
 
     bb1: {
+        StorageLive(_3);
         _3 = discriminant(_2);
         StorageDead(_7);
         StorageDead(_2);
@@ -37,11 +38,13 @@ fn num_to_digit(_1: char) -> u32 {
     }
 
     bb2: {
+        StorageDead(_3);
         StorageLive(_4);
         _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue];
     }
 
     bb3: {
+        StorageLive(_5);
         _5 = discriminant(_4);
         switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6];
     }
@@ -52,6 +55,7 @@ fn num_to_digit(_1: char) -> u32 {
 
     bb5: {
         _0 = move ((_4 as Some).0: u32);
+        StorageDead(_5);
         StorageDead(_4);
         goto -> bb8;
     }
@@ -61,6 +65,7 @@ fn num_to_digit(_1: char) -> u32 {
     }
 
     bb7: {
+        StorageDead(_3);
         _0 = const 0_u32;
         goto -> bb8;
     }
diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
index 75f81c5aaca..e3c81061a46 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
@@ -36,8 +36,10 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
 
     bb1: {
         StorageLive(_5);
+        StorageLive(_4);
         _4 = discriminant(_3);
         _5 = Eq(_4, const 1_isize);
+        StorageDead(_4);
         _6 = Not(move _5);
         StorageDead(_5);
         switchInt(move _6) -> [0: bb2, otherwise: bb3];
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
index 48b780aea62..80a470c9482 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
@@ -18,6 +18,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
     }
 
     bb0: {
+        StorageLive(_2);
         _2 = discriminant(_1);
         switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
     }
@@ -37,6 +38,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
     }
 
     bb3: {
+        StorageDead(_2);
         return;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
index ed286beb4ca..9c10e96b0ea 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
@@ -98,6 +98,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
         StorageLive(_35);
         StorageLive(_11);
         _11 = _8;
+        StorageLive(_12);
+        StorageLive(_13);
         _12 = deref_copy _4;
         _13 = deref_copy _11;
         StorageLive(_14);
@@ -107,6 +109,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
         _16 = Le(move _14, move _15);
         StorageDead(_15);
         StorageDead(_14);
+        StorageDead(_13);
+        StorageDead(_12);
         switchInt(move _16) -> [0: bb1, otherwise: bb2];
     }
 
@@ -126,6 +130,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
         StorageLive(_37);
         StorageLive(_17);
         _17 = _6;
+        StorageLive(_18);
+        StorageLive(_19);
         _18 = deref_copy _10;
         _19 = deref_copy _17;
         StorageLive(_20);
@@ -135,6 +141,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
         _22 = Le(move _20, move _21);
         StorageDead(_21);
         StorageDead(_20);
+        StorageDead(_19);
+        StorageDead(_18);
         switchInt(move _22) -> [0: bb3, otherwise: bb8];
     }
 
@@ -151,6 +159,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
         StorageLive(_39);
         StorageLive(_23);
         _23 = _4;
+        StorageLive(_24);
+        StorageLive(_25);
         _24 = deref_copy _8;
         _25 = deref_copy _23;
         StorageLive(_26);
@@ -160,6 +170,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
         _28 = Le(move _26, move _27);
         StorageDead(_27);
         StorageDead(_26);
+        StorageDead(_25);
+        StorageDead(_24);
         switchInt(move _28) -> [0: bb5, otherwise: bb6];
     }
 
@@ -179,6 +191,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
         StorageLive(_41);
         StorageLive(_29);
         _29 = _10;
+        StorageLive(_30);
+        StorageLive(_31);
         _30 = deref_copy _6;
         _31 = deref_copy _29;
         StorageLive(_32);
@@ -188,6 +202,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
         _0 = Le(move _32, move _33);
         StorageDead(_33);
         StorageDead(_32);
+        StorageDead(_31);
+        StorageDead(_30);
         StorageDead(_29);
         StorageDead(_41);
         StorageDead(_40);
diff --git a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
index ca1528b6ab1..491db551a7d 100644
--- a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
+++ b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
@@ -48,6 +48,7 @@
   
       bb0: {
           StorageLive(_3);
+          StorageLive(_9);
           StorageLive(_10);
           StorageLive(_11);
           _9 = discriminant(_1);
@@ -57,6 +58,7 @@
       bb1: {
           StorageDead(_11);
           StorageDead(_10);
+          StorageDead(_9);
           _5 = discriminant(_3);
           switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3];
       }