about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-05-07 15:39:47 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-05-13 10:12:14 +0000
commit2ec007191348ef7cc13eb55e44e007b02cf75cf3 (patch)
tree0ab24c5018013f8e7423d644aa3987b775bbf77f
parent1c36f50b3eca1581b23cd7c4b7d298be149665ec (diff)
downloadrust-2ec007191348ef7cc13eb55e44e007b02cf75cf3.tar.gz
rust-2ec007191348ef7cc13eb55e44e007b02cf75cf3.zip
Implement references VarDebugInfo.
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/debuginfo.rs52
-rw-r--r--compiler/rustc_const_eval/src/transform/validate.rs10
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs38
-rw-r--r--compiler/rustc_middle/src/mir/pretty.rs9
-rw-r--r--compiler/rustc_middle/src/mir/visit.rs1
-rw-r--r--compiler/rustc_middle/src/ty/structural_impls.rs1
-rw-r--r--compiler/rustc_mir_build/src/build/matches/mod.rs2
-rw-r--r--compiler/rustc_mir_build/src/build/mod.rs2
-rw-r--r--compiler/rustc_mir_transform/src/ref_prop.rs19
-rw-r--r--compiler/rustc_type_ir/src/structural_impls.rs1
-rw-r--r--tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff22
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff58
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff75
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff58
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff58
-rw-r--r--tests/mir-opt/reference_prop.rs24
-rw-r--r--tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff9
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff284
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff72
-rw-r--r--tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir5
20 files changed, 439 insertions, 361 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
index 805dfab2cc1..e2e33f433ce 100644
--- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
@@ -41,6 +41,9 @@ pub struct PerLocalVarDebugInfo<'tcx, D> {
 
     /// `.place.projection` from `mir::VarDebugInfo`.
     pub projection: &'tcx ty::List<mir::PlaceElem<'tcx>>,
+
+    /// `references` from `mir::VarDebugInfo`.
+    pub references: u8,
 }
 
 #[derive(Clone, Copy, Debug)]
@@ -293,6 +296,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                     dbg_var,
                     fragment: None,
                     projection: ty::List::empty(),
+                    references: 0,
                 })
             }
         } else {
@@ -366,14 +370,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         &self,
         bx: &mut Bx,
         local: mir::Local,
-        base: PlaceRef<'tcx, Bx::Value>,
+        mut base: PlaceRef<'tcx, Bx::Value>,
         var: PerLocalVarDebugInfo<'tcx, Bx::DIVariable>,
     ) {
         let Some(dbg_var) = var.dbg_var else { return };
         let Some(dbg_loc) = self.dbg_loc(var.source_info) else { return };
 
-        let DebugInfoOffset { direct_offset, indirect_offsets, result: _ } =
+        let DebugInfoOffset { mut direct_offset, indirect_offsets, result: _ } =
             calculate_debuginfo_offset(bx, local, &var, base.layout);
+        let mut indirect_offsets = &indirect_offsets[..];
 
         // When targeting MSVC, create extra allocas for arguments instead of pointing multiple
         // dbg_var_addr() calls into the same alloca with offsets. MSVC uses CodeView records
@@ -387,28 +392,44 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
             // LLVM can handle simple things but anything more complex than just a direct
             // offset or one indirect offset of 0 is too complex for it to generate CV records
             // correctly.
-            && (direct_offset != Size::ZERO || !matches!(&indirect_offsets[..], [Size::ZERO] | []));
-
-        if should_create_individual_allocas {
-            let DebugInfoOffset { direct_offset: _, indirect_offsets: _, result: place } =
-                calculate_debuginfo_offset(bx, local, &var, base);
+            && (direct_offset != Size::ZERO || !matches!(indirect_offsets, [Size::ZERO] | []));
 
+        let create_alloca = |bx: &mut Bx, place: PlaceRef<'tcx, Bx::Value>, refcount| {
             // Create a variable which will be a pointer to the actual value
             let ptr_ty = bx
                 .tcx()
                 .mk_ptr(ty::TypeAndMut { mutbl: mir::Mutability::Mut, ty: place.layout.ty });
             let ptr_layout = bx.layout_of(ptr_ty);
             let alloca = PlaceRef::alloca(bx, ptr_layout);
-            bx.set_var_name(alloca.llval, &(var.name.to_string() + ".dbg.spill"));
+            bx.set_var_name(alloca.llval, &format!("{}.ref{}.dbg.spill", var.name, refcount));
 
             // Write the pointer to the variable
             bx.store(place.llval, alloca.llval, alloca.align);
 
             // Point the debug info to `*alloca` for the current variable
-            bx.dbg_var_addr(dbg_var, dbg_loc, alloca.llval, Size::ZERO, &[Size::ZERO], None);
-        } else {
-            bx.dbg_var_addr(dbg_var, dbg_loc, base.llval, direct_offset, &indirect_offsets, None);
+            alloca
+        };
+
+        if var.references > 0 {
+            base = calculate_debuginfo_offset(bx, local, &var, base).result;
+
+            // Point the debug info to `&...&base == alloca` for the current variable
+            for refcount in 0..var.references {
+                base = create_alloca(bx, base, refcount);
+            }
+
+            direct_offset = Size::ZERO;
+            indirect_offsets = &[];
+        } else if should_create_individual_allocas {
+            let place = calculate_debuginfo_offset(bx, local, &var, base).result;
+
+            // Point the debug info to `*alloca` for the current variable
+            base = create_alloca(bx, place, 0);
+            direct_offset = Size::ZERO;
+            indirect_offsets = &[Size::ZERO];
         }
+
+        bx.dbg_var_addr(dbg_var, dbg_loc, base.llval, direct_offset, indirect_offsets, None);
     }
 
     pub fn debug_introduce_locals(&self, bx: &mut Bx) {
@@ -441,7 +462,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
             };
 
             let dbg_var = dbg_scope_and_span.map(|(dbg_scope, _, span)| {
-                let (var_ty, var_kind) = match var.value {
+                let (mut var_ty, var_kind) = match var.value {
                     mir::VarDebugInfoContents::Place(place) => {
                         let var_ty = self.monomorphized_place_ty(place.as_ref());
                         let var_kind = if let Some(arg_index) = var.argument_index
@@ -478,6 +499,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                     }
                 };
 
+                for _ in 0..var.references {
+                    var_ty =
+                        bx.tcx().mk_ptr(ty::TypeAndMut { mutbl: mir::Mutability::Mut, ty: var_ty });
+                }
+
                 self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span)
             });
 
@@ -489,6 +515,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                         dbg_var,
                         fragment: None,
                         projection: place.projection,
+                        references: var.references,
                     });
                 }
                 mir::VarDebugInfoContents::Const(c) => {
@@ -542,6 +569,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                                 Some(fragment_start..fragment_start + fragment_layout.size)
                             },
                             projection: place.projection,
+                            references: var.references,
                         });
                     }
                 }
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs
index f46c2d00fe4..c50e937d84f 100644
--- a/compiler/rustc_const_eval/src/transform/validate.rs
+++ b/compiler/rustc_const_eval/src/transform/validate.rs
@@ -448,7 +448,15 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
         };
         match debuginfo.value {
             VarDebugInfoContents::Const(_) => {}
-            VarDebugInfoContents::Place(place) => check_place(place),
+            VarDebugInfoContents::Place(place) => {
+                check_place(place);
+                if debuginfo.references != 0 && place.projection.last() == Some(&PlaceElem::Deref) {
+                    self.fail(
+                        START_BLOCK.start_location(),
+                        format!("debuginfo {:?}, has both ref and deref", debuginfo),
+                    );
+                }
+            }
             VarDebugInfoContents::Composite { ty, ref fragments } => {
                 for f in fragments {
                     check_place(f.contents);
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 55991facd89..6e8e68b616b 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -1111,6 +1111,10 @@ pub struct VarDebugInfo<'tcx> {
     /// originated from (starting from 1). Note, if MIR inlining is enabled, then this is the
     /// argument number in the original function before it was inlined.
     pub argument_index: Option<u16>,
+
+    /// The data represents `name` dereferenced `references` times,
+    /// and not the direct value.
+    pub references: u8,
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -1639,18 +1643,7 @@ impl<'tcx> Place<'tcx> {
             return self;
         }
 
-        let mut v: Vec<PlaceElem<'tcx>>;
-
-        let new_projections = if self.projection.is_empty() {
-            more_projections
-        } else {
-            v = Vec::with_capacity(self.projection.len() + more_projections.len());
-            v.extend(self.projection);
-            v.extend(more_projections);
-            &v
-        };
-
-        Place { local: self.local, projection: tcx.mk_place_elems(new_projections) }
+        self.as_ref().project_deeper(more_projections, tcx)
     }
 }
 
@@ -1721,6 +1714,27 @@ impl<'tcx> PlaceRef<'tcx> {
             (base, *proj)
         })
     }
+
+    /// Generates a new place by appending `more_projections` to the existing ones
+    /// and interning the result.
+    pub fn project_deeper(
+        self,
+        more_projections: &[PlaceElem<'tcx>],
+        tcx: TyCtxt<'tcx>,
+    ) -> Place<'tcx> {
+        let mut v: Vec<PlaceElem<'tcx>>;
+
+        let new_projections = if self.projection.is_empty() {
+            more_projections
+        } else {
+            v = Vec::with_capacity(self.projection.len() + more_projections.len());
+            v.extend(self.projection);
+            v.extend(more_projections);
+            &v
+        };
+
+        Place { local: self.local, projection: tcx.mk_place_elems(new_projections) }
+    }
 }
 
 impl Debug for Place<'_> {
diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs
index fa8a339631e..62c3d8cf239 100644
--- a/compiler/rustc_middle/src/mir/pretty.rs
+++ b/compiler/rustc_middle/src/mir/pretty.rs
@@ -551,8 +551,13 @@ fn write_scope_tree(
         }
 
         let indented_debug_info = format!(
-            "{0:1$}debug {2} => {3:?};",
-            INDENT, indent, var_debug_info.name, var_debug_info.value,
+            "{0:1$}debug {2} => {3:&<4$}{5:?};",
+            INDENT,
+            indent,
+            var_debug_info.name,
+            "",
+            var_debug_info.references as usize,
+            var_debug_info.value,
         );
 
         writeln!(
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs
index d7a7fdebda6..596dd80bf48 100644
--- a/compiler/rustc_middle/src/mir/visit.rs
+++ b/compiler/rustc_middle/src/mir/visit.rs
@@ -842,6 +842,7 @@ macro_rules! make_mir_visitor {
                     source_info,
                     value,
                     argument_index: _,
+                    references: _,
                 } = var_debug_info;
 
                 self.visit_source_info(source_info);
diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs
index 29a3bc8bb97..e73208b877f 100644
--- a/compiler/rustc_middle/src/ty/structural_impls.rs
+++ b/compiler/rustc_middle/src/ty/structural_impls.rs
@@ -204,6 +204,7 @@ CloneLiftImpls! {
     (),
     bool,
     usize,
+    u8,
     u16,
     u32,
     u64,
diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs
index 4926ff85de3..6df06df5c60 100644
--- a/compiler/rustc_mir_build/src/build/matches/mod.rs
+++ b/compiler/rustc_mir_build/src/build/matches/mod.rs
@@ -2241,6 +2241,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
         self.var_debug_info.push(VarDebugInfo {
             name,
             source_info: debug_source_info,
+            references: 0,
             value: VarDebugInfoContents::Place(for_arm_body.into()),
             argument_index: None,
         });
@@ -2260,6 +2261,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
             self.var_debug_info.push(VarDebugInfo {
                 name,
                 source_info: debug_source_info,
+                references: 0,
                 value: VarDebugInfoContents::Place(ref_for_guard.into()),
                 argument_index: None,
             });
diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs
index 20d381eddb1..4e3e98b56e7 100644
--- a/compiler/rustc_mir_build/src/build/mod.rs
+++ b/compiler/rustc_mir_build/src/build/mod.rs
@@ -798,6 +798,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 };
                 self.var_debug_info.push(VarDebugInfo {
                     name,
+                    references: 0,
                     source_info: SourceInfo::outermost(captured_place.var_ident.span),
                     value: VarDebugInfoContents::Place(use_place),
                     argument_index: None,
@@ -828,6 +829,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 self.var_debug_info.push(VarDebugInfo {
                     name,
                     source_info,
+                    references: 0,
                     value: VarDebugInfoContents::Place(arg_local.into()),
                     argument_index: Some(argument_index as u16 + 1),
                 });
diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs
index d1bc9ee9153..0c5e7348e04 100644
--- a/compiler/rustc_mir_transform/src/ref_prop.rs
+++ b/compiler/rustc_mir_transform/src/ref_prop.rs
@@ -263,6 +263,7 @@ fn compute_replacement<'tcx>(
         targets,
         storage_to_remove,
         allowed_replacements,
+        fully_replacable_locals,
         any_replacement: false,
     };
 
@@ -343,6 +344,7 @@ struct Replacer<'tcx> {
     storage_to_remove: BitSet<Local>,
     allowed_replacements: FxHashSet<(Local, Location)>,
     any_replacement: bool,
+    fully_replacable_locals: BitSet<Local>,
 }
 
 impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
@@ -350,6 +352,23 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
         self.tcx
     }
 
+    fn visit_var_debug_info(&mut self, debuginfo: &mut VarDebugInfo<'tcx>) {
+        if let VarDebugInfoContents::Place(ref mut place) = debuginfo.value
+            && place.projection.is_empty()
+            && let Value::Pointer(target, _) = self.targets[place.local]
+            && target.projection.iter().all(|p| p.can_use_in_debuginfo())
+        {
+            if let Some((&PlaceElem::Deref, rest)) = target.projection.split_last() {
+                *place = Place::from(target.local).project_deeper(rest, self.tcx);
+                self.any_replacement = true;
+            } else if self.fully_replacable_locals.contains(place.local) {
+                debuginfo.references += 1;
+                *place = target;
+                self.any_replacement = true;
+            }
+        }
+    }
+
     fn visit_place(&mut self, place: &mut Place<'tcx>, ctxt: PlaceContext, loc: Location) {
         if place.projection.first() != Some(&PlaceElem::Deref) {
             return;
diff --git a/compiler/rustc_type_ir/src/structural_impls.rs b/compiler/rustc_type_ir/src/structural_impls.rs
index c9675f93f95..45a2e9023c9 100644
--- a/compiler/rustc_type_ir/src/structural_impls.rs
+++ b/compiler/rustc_type_ir/src/structural_impls.rs
@@ -21,6 +21,7 @@ TrivialTypeTraversalImpls! {
     (),
     bool,
     usize,
+    u8,
     u16,
     u32,
     u64,
diff --git a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
index af8ee2411d3..09bc9dc7bcc 100644
--- a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
@@ -13,13 +13,16 @@
           debug x => _1;                   // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:14
           let _2: &mut i32;                // in scope 1 at $DIR/reference_prop.rs:+2:9: +2:13
           scope 2 {
-              debug xref => _2;            // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13
+-             debug xref => _2;            // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13
++             debug xref => &_1;           // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13
               let _3: *mut i32;            // in scope 2 at $DIR/reference_prop.rs:+3:9: +3:13
               scope 3 {
-                  debug xraw => _3;        // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13
+-                 debug xraw => _3;        // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13
++                 debug xraw => _4;        // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13
                   let _6: &i32;            // in scope 3 at $DIR/reference_prop.rs:+4:9: +4:13
                   scope 4 {
-                      debug xshr => _6;    // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13
+-                     debug xshr => _6;    // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13
++                     debug xshr => _2;    // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13
                       let _7: i32;         // in scope 4 at $DIR/reference_prop.rs:+6:9: +6:10
                       scope 5 {
                           debug a => _7;   // in scope 5 at $DIR/reference_prop.rs:+6:9: +6:10
@@ -36,18 +39,17 @@
           _1 = const 2_i32;                // scope 0 at $DIR/reference_prop.rs:+1:17: +1:18
 -         StorageLive(_2);                 // scope 1 at $DIR/reference_prop.rs:+2:9: +2:13
           _2 = &mut _1;                    // scope 1 at $DIR/reference_prop.rs:+2:16: +2:22
-          StorageLive(_3);                 // scope 2 at $DIR/reference_prop.rs:+3:9: +3:13
+-         StorageLive(_3);                 // scope 2 at $DIR/reference_prop.rs:+3:9: +3:13
 -         StorageLive(_4);                 // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36
 -         StorageLive(_5);                 // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
 -         _5 = &mut (*_2);                 // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
 -         _4 = &raw mut (*_5);             // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
-+         _4 = &raw mut _1;                // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
-          _3 = _4;                         // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36
+-         _3 = _4;                         // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36
 -         StorageDead(_5);                 // scope 2 at $DIR/reference_prop.rs:+3:36: +3:37
 -         StorageDead(_4);                 // scope 2 at $DIR/reference_prop.rs:+3:36: +3:37
-          StorageLive(_6);                 // scope 3 at $DIR/reference_prop.rs:+4:9: +4:13
+-         StorageLive(_6);                 // scope 3 at $DIR/reference_prop.rs:+4:9: +4:13
 -         _6 = &(*_2);                     // scope 3 at $DIR/reference_prop.rs:+4:16: +4:22
-+         _6 = &_1;                        // scope 3 at $DIR/reference_prop.rs:+4:16: +4:22
++         _4 = &raw mut _1;                // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
           StorageLive(_7);                 // scope 4 at $DIR/reference_prop.rs:+6:9: +6:10
 -         _7 = (*_6);                      // scope 4 at $DIR/reference_prop.rs:+6:13: +6:18
 -         StorageLive(_8);                 // scope 5 at $DIR/reference_prop.rs:+7:5: +7:26
@@ -64,8 +66,8 @@
           StorageDead(_10);                // scope 5 at $DIR/reference_prop.rs:+8:10: +8:11
           StorageDead(_9);                 // scope 5 at $DIR/reference_prop.rs:+8:10: +8:11
           StorageDead(_7);                 // scope 4 at $DIR/reference_prop.rs:+9:1: +9:2
-          StorageDead(_6);                 // scope 3 at $DIR/reference_prop.rs:+9:1: +9:2
-          StorageDead(_3);                 // scope 2 at $DIR/reference_prop.rs:+9:1: +9:2
+-         StorageDead(_6);                 // scope 3 at $DIR/reference_prop.rs:+9:1: +9:2
+-         StorageDead(_3);                 // scope 2 at $DIR/reference_prop.rs:+9:1: +9:2
 -         StorageDead(_2);                 // scope 1 at $DIR/reference_prop.rs:+9:1: +9:2
           StorageDead(_1);                 // scope 0 at $DIR/reference_prop.rs:+9:1: +9:2
           return;                          // scope 0 at $DIR/reference_prop.rs:+9:2: +9:2
diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff
index e41fc28461a..e08954ba2fd 100644
--- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff
@@ -17,12 +17,12 @@
       let mut _17: ();                     // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
       let _18: ();                         // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
       let _19: usize;                      // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:14
-      let _23: ();                         // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:19
-      let mut _24: ();                     // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:18
+      let _23: ();                         // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
+      let mut _24: &&usize;                // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
       let _25: ();                         // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
       let _26: usize;                      // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:14
-      let _30: ();                         // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:19
-      let mut _31: ();                     // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:18
+      let _30: ();                         // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
+      let mut _31: *mut &usize;            // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
       let _32: ();                         // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
       let _33: usize;                      // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:14
       let _36: ();                         // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
@@ -44,7 +44,8 @@
           debug a => _4;                   // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14
           let _5: &usize;                  // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
           scope 2 {
-              debug b => _5;               // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+-             debug b => _5;               // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
++             debug b => &_4;              // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
               let _6: usize;               // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
               scope 3 {
                   debug c => _6;           // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
@@ -86,7 +87,7 @@
           let mut _27: &usize;             // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
           scope 13 {
               debug b => _27;              // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18
-              let _28: &mut &usize;        // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
+              let _28: *mut &usize;        // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
               scope 14 {
                   debug d => _28;          // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14
                   let _29: usize;          // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
@@ -131,7 +132,8 @@
           }
       }
       scope 25 {
-          debug a => _48;                  // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
+-         debug a => _48;                  // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
++         debug a => _1;                   // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
           let _49: T;                      // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
           scope 26 {
               debug b => _49;              // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14
@@ -149,8 +151,8 @@
 -         StorageLive(_3);                 // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
           StorageLive(_4);                 // scope 0 at $DIR/reference_prop.rs:+3:13: +3:14
           _4 = const 5_usize;              // scope 0 at $DIR/reference_prop.rs:+3:17: +3:24
-          StorageLive(_5);                 // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
-          _5 = &_4;                        // scope 1 at $DIR/reference_prop.rs:+4:17: +4:19
+-         StorageLive(_5);                 // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
+-         _5 = &_4;                        // scope 1 at $DIR/reference_prop.rs:+4:17: +4:19
           StorageLive(_6);                 // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
 -         _6 = (*_5);                      // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
 +         _6 = _4;                         // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
@@ -168,7 +170,7 @@
           StorageDead(_7);                 // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20
 -         _3 = const ();                   // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
           StorageDead(_6);                 // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
-          StorageDead(_5);                 // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
+-         StorageDead(_5);                 // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
           StorageDead(_4);                 // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
 -         StorageDead(_3);                 // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
 -         StorageLive(_9);                 // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
@@ -215,18 +217,18 @@
           _21 = &_20;                      // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19
           StorageLive(_22);                // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
           _22 = (*_20);                    // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19
-          StorageLive(_23);                // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19
-          StorageLive(_24);                // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18
-          _24 = ();                        // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18
-          _23 = opaque::<()>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19
+          StorageLive(_23);                // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
+          StorageLive(_24);                // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
+          _24 = _21;                       // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
+          _23 = opaque::<&&usize>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
                                            // mir::Constant
                                            // + span: $DIR/reference_prop.rs:36:9: 36:15
-                                           // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+                                           // + literal: Const { ty: fn(&&usize) {opaque::<&&usize>}, val: Value(<ZST>) }
       }
   
       bb3: {
-          StorageDead(_24);                // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19
-          StorageDead(_23);                // scope 11 at $DIR/reference_prop.rs:+26:19: +26:20
+          StorageDead(_24);                // scope 11 at $DIR/reference_prop.rs:+26:17: +26:18
+          StorageDead(_23);                // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19
 -         _18 = const ();                  // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
           StorageDead(_22);                // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
           StorageDead(_21);                // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6
@@ -239,21 +241,21 @@
           StorageLive(_27);                // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
           _27 = &_26;                      // scope 12 at $DIR/reference_prop.rs:+32:21: +32:23
           StorageLive(_28);                // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
-          _28 = &mut _27;                  // scope 13 at $DIR/reference_prop.rs:+33:17: +33:23
+          _28 = &raw mut _27;              // scope 13 at $DIR/reference_prop.rs:+33:17: +33:27
           StorageLive(_29);                // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
           _29 = (*_27);                    // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19
-          StorageLive(_30);                // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19
-          StorageLive(_31);                // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18
-          _31 = ();                        // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18
-          _30 = opaque::<()>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19
+          StorageLive(_30);                // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
+          StorageLive(_31);                // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
+          _31 = _28;                       // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
+          _30 = opaque::<*mut &usize>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
                                            // mir::Constant
                                            // + span: $DIR/reference_prop.rs:45:9: 45:15
-                                           // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+                                           // + literal: Const { ty: fn(*mut &usize) {opaque::<*mut &usize>}, val: Value(<ZST>) }
       }
   
       bb4: {
-          StorageDead(_31);                // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19
-          StorageDead(_30);                // scope 15 at $DIR/reference_prop.rs:+35:19: +35:20
+          StorageDead(_31);                // scope 15 at $DIR/reference_prop.rs:+35:17: +35:18
+          StorageDead(_30);                // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19
 -         _25 = const ();                  // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
           StorageDead(_29);                // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6
           StorageDead(_28);                // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6
@@ -321,8 +323,8 @@
           StorageDead(_39);                // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
 -         StorageDead(_38);                // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
 -         StorageLive(_47);                // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
-          StorageLive(_48);                // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
-          _48 = &(*_1);                    // scope 0 at $DIR/reference_prop.rs:+61:17: +61:25
+-         StorageLive(_48);                // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
+-         _48 = &(*_1);                    // scope 0 at $DIR/reference_prop.rs:+61:17: +61:25
           StorageLive(_49);                // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
 -         _49 = (*_48);                    // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
 +         _49 = (*_1);                     // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
@@ -340,7 +342,7 @@
           StorageDead(_50);                // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20
 -         _47 = const ();                  // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
           StorageDead(_49);                // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6
-          StorageDead(_48);                // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
+-         StorageDead(_48);                // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
 -         StorageDead(_47);                // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
           StorageLive(_52);                // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
           _52 = &(*_2);                    // scope 0 at $DIR/reference_prop.rs:+68:17: +68:27
diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
index 712727915d0..62cc180a602 100644
--- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
@@ -13,11 +13,11 @@
       let _15: ();                         // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
       let mut _16: ();                     // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
       let _17: ();                         // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
-      let _22: ();                         // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:19
-      let mut _23: ();                     // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:18
+      let _22: ();                         // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
+      let mut _23: &*const usize;          // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
       let _24: ();                         // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
-      let _29: ();                         // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:19
-      let mut _30: ();                     // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:18
+      let _29: ();                         // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
+      let mut _30: *mut *const usize;      // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
       let _31: ();                         // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
       let _35: ();                         // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
       let mut _36: *const usize;           // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
@@ -39,7 +39,8 @@
               debug a => _4;               // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:14
               let _5: *const usize;        // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
               scope 3 {
-                  debug b => _5;           // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
+-                 debug b => _5;           // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
++                 debug b => &_4;          // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
                   let _6: usize;           // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
                   scope 4 {
                       debug c => _6;       // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14
@@ -90,7 +91,7 @@
               let mut _26: *const usize;   // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
               scope 17 {
                   debug b => _26;          // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18
-                  let _27: &mut *const usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
+                  let _27: *mut *const usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
                   scope 18 {
                       debug d => _27;      // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14
                       let _28: usize;      // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
@@ -144,7 +145,8 @@
       scope 31 {
           let _47: *const T;               // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
           scope 32 {
-              debug a => _47;              // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
+-             debug a => _47;              // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
++             debug a => _1;               // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
               let _48: T;                  // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
               scope 33 {
                   debug b => _48;          // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14
@@ -167,10 +169,12 @@
               debug a => _57;              // in scope 38 at $DIR/reference_prop.rs:+76:13: +76:14
               let _58: *const usize;       // in scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
               scope 39 {
-                  debug b => _58;          // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
+-                 debug b => _58;          // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
++                 debug b => &_57;         // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
                   let _59: *const usize;   // in scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
                   scope 40 {
-                      debug c => _59;      // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
+-                     debug c => _59;      // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
++                     debug c => &_57;     // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
                       let _60: usize;      // in scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
                       scope 41 {
                           debug e => _60;  // in scope 41 at $DIR/reference_prop.rs:+79:13: +79:14
@@ -184,8 +188,8 @@
 -         StorageLive(_3);                 // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
           StorageLive(_4);                 // scope 1 at $DIR/reference_prop.rs:+3:13: +3:14
           _4 = const 5_usize;              // scope 1 at $DIR/reference_prop.rs:+3:17: +3:24
-          StorageLive(_5);                 // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
-          _5 = &raw const _4;              // scope 2 at $DIR/reference_prop.rs:+4:17: +4:29
+-         StorageLive(_5);                 // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+-         _5 = &raw const _4;              // scope 2 at $DIR/reference_prop.rs:+4:17: +4:29
           StorageLive(_6);                 // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
 -         _6 = (*_5);                      // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
 +         _6 = _4;                         // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
@@ -203,7 +207,7 @@
           StorageDead(_7);                 // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20
 -         _3 = const ();                   // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6
           StorageDead(_6);                 // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6
-          StorageDead(_5);                 // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
+-         StorageDead(_5);                 // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
           StorageDead(_4);                 // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
 -         StorageDead(_3);                 // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
 -         StorageLive(_9);                 // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
@@ -246,18 +250,18 @@
           _20 = &_19;                      // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19
           StorageLive(_21);                // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
           _21 = (*_19);                    // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19
-          StorageLive(_22);                // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19
-          StorageLive(_23);                // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18
-          _23 = ();                        // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18
-          _22 = opaque::<()>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19
+          StorageLive(_22);                // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
+          StorageLive(_23);                // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
+          _23 = _20;                       // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
+          _22 = opaque::<&*const usize>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
                                            // mir::Constant
                                            // + span: $DIR/reference_prop.rs:186:9: 186:15
-                                           // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+                                           // + literal: Const { ty: fn(&*const usize) {opaque::<&*const usize>}, val: Value(<ZST>) }
       }
   
       bb3: {
-          StorageDead(_23);                // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19
-          StorageDead(_22);                // scope 14 at $DIR/reference_prop.rs:+26:19: +26:20
+          StorageDead(_23);                // scope 14 at $DIR/reference_prop.rs:+26:17: +26:18
+          StorageDead(_22);                // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19
 -         _17 = const ();                  // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6
           StorageDead(_21);                // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6
           StorageDead(_20);                // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6
@@ -270,21 +274,21 @@
           StorageLive(_26);                // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
           _26 = &raw const _25;            // scope 16 at $DIR/reference_prop.rs:+32:21: +32:33
           StorageLive(_27);                // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
-          _27 = &mut _26;                  // scope 17 at $DIR/reference_prop.rs:+33:17: +33:23
+          _27 = &raw mut _26;              // scope 17 at $DIR/reference_prop.rs:+33:17: +33:27
           StorageLive(_28);                // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
           _28 = (*_26);                    // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19
-          StorageLive(_29);                // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19
-          StorageLive(_30);                // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18
-          _30 = ();                        // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18
-          _29 = opaque::<()>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19
+          StorageLive(_29);                // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
+          StorageLive(_30);                // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
+          _30 = _27;                       // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
+          _29 = opaque::<*mut *const usize>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
                                            // mir::Constant
                                            // + span: $DIR/reference_prop.rs:195:9: 195:15
-                                           // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+                                           // + literal: Const { ty: fn(*mut *const usize) {opaque::<*mut *const usize>}, val: Value(<ZST>) }
       }
   
       bb4: {
-          StorageDead(_30);                // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19
-          StorageDead(_29);                // scope 19 at $DIR/reference_prop.rs:+35:19: +35:20
+          StorageDead(_30);                // scope 19 at $DIR/reference_prop.rs:+35:17: +35:18
+          StorageDead(_29);                // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19
 -         _24 = const ();                  // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6
           StorageDead(_28);                // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6
           StorageDead(_27);                // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6
@@ -352,8 +356,8 @@
           StorageDead(_38);                // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6
 -         StorageDead(_37);                // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
 -         StorageLive(_46);                // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
-          StorageLive(_47);                // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
-          _47 = &raw const (*_1);          // scope 31 at $DIR/reference_prop.rs:+61:17: +61:35
+-         StorageLive(_47);                // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
+-         _47 = &raw const (*_1);          // scope 31 at $DIR/reference_prop.rs:+61:17: +61:35
           StorageLive(_48);                // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
 -         _48 = (*_47);                    // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
 +         _48 = (*_1);                     // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
@@ -371,7 +375,7 @@
           StorageDead(_49);                // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20
 -         _46 = const ();                  // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6
           StorageDead(_48);                // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6
-          StorageDead(_47);                // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6
+-         StorageDead(_47);                // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6
 -         StorageDead(_46);                // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
 -         StorageLive(_51);                // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
           StorageLive(_52);                // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
@@ -400,11 +404,10 @@
 -         StorageDead(_51);                // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
           StorageLive(_57);                // scope 37 at $DIR/reference_prop.rs:+76:13: +76:14
           _57 = const 13_usize;            // scope 37 at $DIR/reference_prop.rs:+76:17: +76:25
-          StorageLive(_58);                // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
-          _58 = &raw const _57;            // scope 38 at $DIR/reference_prop.rs:+77:17: +77:29
-          StorageLive(_59);                // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
+-         StorageLive(_58);                // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
+-         _58 = &raw const _57;            // scope 38 at $DIR/reference_prop.rs:+77:17: +77:29
+-         StorageLive(_59);                // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
 -         _59 = &raw const (*_58);         // scope 39 at $DIR/reference_prop.rs:+78:17: +78:30
-+         _59 = &raw const _57;            // scope 39 at $DIR/reference_prop.rs:+78:17: +78:30
           StorageLive(_60);                // scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
 -         _60 = (*_59);                    // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
 +         _60 = _57;                       // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
@@ -422,8 +425,8 @@
           StorageDead(_61);                // scope 41 at $DIR/reference_prop.rs:+80:19: +80:20
           _0 = const ();                   // scope 37 at $DIR/reference_prop.rs:+75:5: +81:6
           StorageDead(_60);                // scope 40 at $DIR/reference_prop.rs:+81:5: +81:6
-          StorageDead(_59);                // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6
-          StorageDead(_58);                // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6
+-         StorageDead(_59);                // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6
+-         StorageDead(_58);                // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6
           StorageDead(_57);                // scope 37 at $DIR/reference_prop.rs:+81:5: +81:6
           return;                          // scope 0 at $DIR/reference_prop.rs:+82:2: +82:2
       }
diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff
index 44ddbbc3066..aedc08d7f92 100644
--- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff
@@ -17,12 +17,12 @@
       let mut _17: ();                     // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
       let _18: ();                         // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
       let mut _19: usize;                  // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:18
-      let _23: ();                         // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:19
-      let mut _24: ();                     // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:18
+      let _23: ();                         // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
+      let mut _24: &&mut usize;            // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
       let _25: ();                         // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
       let mut _26: usize;                  // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:18
-      let _30: ();                         // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:19
-      let mut _31: ();                     // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:18
+      let _30: ();                         // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
+      let mut _31: *mut &mut usize;        // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
       let _32: ();                         // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
       let mut _33: usize;                  // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:18
       let _36: ();                         // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
@@ -44,7 +44,8 @@
           debug a => _4;                   // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18
           let _5: &mut usize;              // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
           scope 2 {
-              debug b => _5;               // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+-             debug b => _5;               // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
++             debug b => &_4;              // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
               let _6: usize;               // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
               scope 3 {
                   debug c => _6;           // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
@@ -86,7 +87,7 @@
           let mut _27: &mut usize;         // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
           scope 13 {
               debug b => _27;              // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18
-              let _28: &mut &mut usize;    // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
+              let _28: *mut &mut usize;    // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
               scope 14 {
                   debug d => _28;          // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14
                   let _29: usize;          // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
@@ -131,7 +132,8 @@
           }
       }
       scope 25 {
-          debug a => _48;                  // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
+-         debug a => _48;                  // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
++         debug a => _1;                   // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
           let _49: T;                      // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
           scope 26 {
               debug b => _49;              // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14
@@ -149,8 +151,8 @@
 -         StorageLive(_3);                 // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
           StorageLive(_4);                 // scope 0 at $DIR/reference_prop.rs:+3:13: +3:18
           _4 = const 5_usize;              // scope 0 at $DIR/reference_prop.rs:+3:21: +3:28
-          StorageLive(_5);                 // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
-          _5 = &mut _4;                    // scope 1 at $DIR/reference_prop.rs:+4:17: +4:23
+-         StorageLive(_5);                 // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
+-         _5 = &mut _4;                    // scope 1 at $DIR/reference_prop.rs:+4:17: +4:23
           StorageLive(_6);                 // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
 -         _6 = (*_5);                      // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
 +         _6 = _4;                         // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
@@ -168,7 +170,7 @@
           StorageDead(_7);                 // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20
 -         _3 = const ();                   // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
           StorageDead(_6);                 // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
-          StorageDead(_5);                 // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
+-         StorageDead(_5);                 // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
           StorageDead(_4);                 // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
 -         StorageDead(_3);                 // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
 -         StorageLive(_9);                 // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
@@ -215,18 +217,18 @@
           _21 = &_20;                      // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19
           StorageLive(_22);                // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
           _22 = (*_20);                    // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19
-          StorageLive(_23);                // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19
-          StorageLive(_24);                // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18
-          _24 = ();                        // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18
-          _23 = opaque::<()>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19
+          StorageLive(_23);                // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
+          StorageLive(_24);                // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
+          _24 = _21;                       // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
+          _23 = opaque::<&&mut usize>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
                                            // mir::Constant
                                            // + span: $DIR/reference_prop.rs:111:9: 111:15
-                                           // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+                                           // + literal: Const { ty: fn(&&mut usize) {opaque::<&&mut usize>}, val: Value(<ZST>) }
       }
   
       bb3: {
-          StorageDead(_24);                // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19
-          StorageDead(_23);                // scope 11 at $DIR/reference_prop.rs:+26:19: +26:20
+          StorageDead(_24);                // scope 11 at $DIR/reference_prop.rs:+26:17: +26:18
+          StorageDead(_23);                // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19
 -         _18 = const ();                  // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
           StorageDead(_22);                // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
           StorageDead(_21);                // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6
@@ -239,21 +241,21 @@
           StorageLive(_27);                // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
           _27 = &mut _26;                  // scope 12 at $DIR/reference_prop.rs:+32:21: +32:27
           StorageLive(_28);                // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
-          _28 = &mut _27;                  // scope 13 at $DIR/reference_prop.rs:+33:17: +33:23
+          _28 = &raw mut _27;              // scope 13 at $DIR/reference_prop.rs:+33:17: +33:27
           StorageLive(_29);                // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
           _29 = (*_27);                    // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19
-          StorageLive(_30);                // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19
-          StorageLive(_31);                // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18
-          _31 = ();                        // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18
-          _30 = opaque::<()>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19
+          StorageLive(_30);                // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
+          StorageLive(_31);                // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
+          _31 = _28;                       // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
+          _30 = opaque::<*mut &mut usize>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
                                            // mir::Constant
                                            // + span: $DIR/reference_prop.rs:120:9: 120:15
-                                           // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+                                           // + literal: Const { ty: fn(*mut &mut usize) {opaque::<*mut &mut usize>}, val: Value(<ZST>) }
       }
   
       bb4: {
-          StorageDead(_31);                // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19
-          StorageDead(_30);                // scope 15 at $DIR/reference_prop.rs:+35:19: +35:20
+          StorageDead(_31);                // scope 15 at $DIR/reference_prop.rs:+35:17: +35:18
+          StorageDead(_30);                // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19
 -         _25 = const ();                  // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
           StorageDead(_29);                // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6
           StorageDead(_28);                // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6
@@ -318,8 +320,8 @@
           StorageDead(_39);                // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
 -         StorageDead(_38);                // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
 -         StorageLive(_47);                // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
-          StorageLive(_48);                // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
-          _48 = &mut (*_1);                // scope 0 at $DIR/reference_prop.rs:+61:17: +61:29
+-         StorageLive(_48);                // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
+-         _48 = &mut (*_1);                // scope 0 at $DIR/reference_prop.rs:+61:17: +61:29
           StorageLive(_49);                // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
 -         _49 = (*_48);                    // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
 +         _49 = (*_1);                     // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
@@ -337,7 +339,7 @@
           StorageDead(_50);                // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20
 -         _47 = const ();                  // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
           StorageDead(_49);                // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6
-          StorageDead(_48);                // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
+-         StorageDead(_48);                // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
 -         StorageDead(_47);                // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
           StorageLive(_52);                // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
           _52 = &mut (*_2);                // scope 0 at $DIR/reference_prop.rs:+68:17: +68:31
diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
index c55b5eb4bed..83478b83b2d 100644
--- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
@@ -13,11 +13,11 @@
       let _15: ();                         // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
       let mut _16: ();                     // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
       let _17: ();                         // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
-      let _22: ();                         // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:19
-      let mut _23: ();                     // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:18
+      let _22: ();                         // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
+      let mut _23: &*mut usize;            // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
       let _24: ();                         // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
-      let _29: ();                         // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:19
-      let mut _30: ();                     // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:18
+      let _29: ();                         // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
+      let mut _30: *mut *mut usize;        // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
       let _31: ();                         // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
       let _35: ();                         // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
       let mut _36: *mut usize;             // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
@@ -36,7 +36,8 @@
               debug a => _4;               // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:18
               let _5: *mut usize;          // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
               scope 3 {
-                  debug b => _5;           // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
+-                 debug b => _5;           // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
++                 debug b => &_4;          // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
                   let _6: usize;           // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
                   scope 4 {
                       debug c => _6;       // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14
@@ -87,7 +88,7 @@
               let mut _26: *mut usize;     // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
               scope 17 {
                   debug b => _26;          // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18
-                  let _27: &mut *mut usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
+                  let _27: *mut *mut usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
                   scope 18 {
                       debug d => _27;      // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14
                       let _28: usize;      // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
@@ -141,7 +142,8 @@
       scope 31 {
           let _47: *mut T;                 // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
           scope 32 {
-              debug a => _47;              // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
+-             debug a => _47;              // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
++             debug a => _1;               // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
               let _48: T;                  // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
               scope 33 {
                   debug b => _48;          // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14
@@ -163,8 +165,8 @@
 -         StorageLive(_3);                 // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
           StorageLive(_4);                 // scope 1 at $DIR/reference_prop.rs:+3:13: +3:18
           _4 = const 5_usize;              // scope 1 at $DIR/reference_prop.rs:+3:21: +3:28
-          StorageLive(_5);                 // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
-          _5 = &raw mut _4;                // scope 2 at $DIR/reference_prop.rs:+4:17: +4:27
+-         StorageLive(_5);                 // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+-         _5 = &raw mut _4;                // scope 2 at $DIR/reference_prop.rs:+4:17: +4:27
           StorageLive(_6);                 // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
 -         _6 = (*_5);                      // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
 +         _6 = _4;                         // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
@@ -182,7 +184,7 @@
           StorageDead(_7);                 // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20
 -         _3 = const ();                   // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6
           StorageDead(_6);                 // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6
-          StorageDead(_5);                 // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
+-         StorageDead(_5);                 // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
           StorageDead(_4);                 // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
 -         StorageDead(_3);                 // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
 -         StorageLive(_9);                 // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
@@ -225,18 +227,18 @@
           _20 = &_19;                      // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19
           StorageLive(_21);                // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
           _21 = (*_19);                    // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19
-          StorageLive(_22);                // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19
-          StorageLive(_23);                // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18
-          _23 = ();                        // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18
-          _22 = opaque::<()>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19
+          StorageLive(_22);                // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
+          StorageLive(_23);                // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
+          _23 = _20;                       // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
+          _22 = opaque::<&*mut usize>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
                                            // mir::Constant
                                            // + span: $DIR/reference_prop.rs:270:9: 270:15
-                                           // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+                                           // + literal: Const { ty: fn(&*mut usize) {opaque::<&*mut usize>}, val: Value(<ZST>) }
       }
   
       bb3: {
-          StorageDead(_23);                // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19
-          StorageDead(_22);                // scope 14 at $DIR/reference_prop.rs:+26:19: +26:20
+          StorageDead(_23);                // scope 14 at $DIR/reference_prop.rs:+26:17: +26:18
+          StorageDead(_22);                // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19
 -         _17 = const ();                  // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6
           StorageDead(_21);                // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6
           StorageDead(_20);                // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6
@@ -249,21 +251,21 @@
           StorageLive(_26);                // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
           _26 = &raw mut _25;              // scope 16 at $DIR/reference_prop.rs:+32:21: +32:31
           StorageLive(_27);                // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
-          _27 = &mut _26;                  // scope 17 at $DIR/reference_prop.rs:+33:17: +33:23
+          _27 = &raw mut _26;              // scope 17 at $DIR/reference_prop.rs:+33:17: +33:27
           StorageLive(_28);                // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
           _28 = (*_26);                    // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19
-          StorageLive(_29);                // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19
-          StorageLive(_30);                // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18
-          _30 = ();                        // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18
-          _29 = opaque::<()>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19
+          StorageLive(_29);                // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
+          StorageLive(_30);                // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
+          _30 = _27;                       // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
+          _29 = opaque::<*mut *mut usize>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
                                            // mir::Constant
                                            // + span: $DIR/reference_prop.rs:279:9: 279:15
-                                           // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+                                           // + literal: Const { ty: fn(*mut *mut usize) {opaque::<*mut *mut usize>}, val: Value(<ZST>) }
       }
   
       bb4: {
-          StorageDead(_30);                // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19
-          StorageDead(_29);                // scope 19 at $DIR/reference_prop.rs:+35:19: +35:20
+          StorageDead(_30);                // scope 19 at $DIR/reference_prop.rs:+35:17: +35:18
+          StorageDead(_29);                // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19
 -         _24 = const ();                  // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6
           StorageDead(_28);                // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6
           StorageDead(_27);                // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6
@@ -328,8 +330,8 @@
           StorageDead(_38);                // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6
 -         StorageDead(_37);                // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
 -         StorageLive(_46);                // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
-          StorageLive(_47);                // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
-          _47 = &raw mut (*_1);            // scope 31 at $DIR/reference_prop.rs:+61:17: +61:33
+-         StorageLive(_47);                // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
+-         _47 = &raw mut (*_1);            // scope 31 at $DIR/reference_prop.rs:+61:17: +61:33
           StorageLive(_48);                // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
 -         _48 = (*_47);                    // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
 +         _48 = (*_1);                     // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
@@ -347,7 +349,7 @@
           StorageDead(_49);                // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20
 -         _46 = const ();                  // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6
           StorageDead(_48);                // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6
-          StorageDead(_47);                // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6
+-         StorageDead(_47);                // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6
 -         StorageDead(_46);                // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
           StorageLive(_51);                // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
           _51 = &raw mut (*_2);            // scope 34 at $DIR/reference_prop.rs:+68:17: +68:35
diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs
index 93f8d1df8e8..6301ee839e9 100644
--- a/tests/mir-opt/reference_prop.rs
+++ b/tests/mir-opt/reference_prop.rs
@@ -33,16 +33,16 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
         let b = &a;
         let d = &b;
         let c = *b; // `b` is immutably borrowed, we know its value, but do not propagate it
-        opaque(());
+        opaque(d); // prevent `d` from being removed.
     }
 
     // Propagation through a borrowed reference.
     {
         let a = 5_usize;
         let mut b = &a;
-        let d = &mut b;
+        let d = &raw mut b;
         let c = *b; // `b` is mutably borrowed, we cannot know its value.
-        opaque(());
+        opaque(d); // prevent `d` from being removed.
     }
 
     // Propagation through an escaping borrow.
@@ -108,16 +108,16 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
         let b = &mut a;
         let d = &b;
         let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
-        opaque(());
+        opaque(d); // prevent `d` from being removed.
     }
 
     // Propagation through a borrowed reference.
     {
         let mut a = 5_usize;
         let mut b = &mut a;
-        let d = &mut b;
+        let d = &raw mut b;
         let c = *b; // `b` is mutably borrowed, we cannot know its value.
-        opaque(());
+        opaque(d); // prevent `d` from being removed.
     }
 
     // Propagation through an escaping borrow.
@@ -183,16 +183,16 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
         let b = &raw const a;
         let d = &b;
         let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
-        opaque(());
+        opaque(d); // prevent `d` from being removed.
     }
 
     // Propagation through a borrowed reference.
     unsafe {
         let a = 5_usize;
         let mut b = &raw const a;
-        let d = &mut b;
+        let d = &raw mut b;
         let c = *b; // `b` is mutably borrowed, we cannot know its value.
-        opaque(());
+        opaque(d); // prevent `d` from being removed.
     }
 
     // Propagation through an escaping borrow.
@@ -267,16 +267,16 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
         let b = &raw mut a;
         let d = &b;
         let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
-        opaque(());
+        opaque(d); // prevent `d` from being removed.
     }
 
     // Propagation through a borrowed reference.
     unsafe {
         let mut a = 5_usize;
         let mut b = &raw mut a;
-        let d = &mut b;
+        let d = &raw mut b;
         let c = *b; // `b` is mutably borrowed, we cannot know its value.
-        opaque(());
+        opaque(d); // prevent `d` from being removed.
     }
 
     // Propagation through an escaping borrow.
diff --git a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff
index 2cda2409e80..7ef6832570f 100644
--- a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff
@@ -10,7 +10,8 @@
       let _6: ();                          // in scope 0 at $DIR/reference_prop.rs:+9:14: +9:24
       let mut _7: i32;                     // in scope 0 at $DIR/reference_prop.rs:+9:21: +9:23
       scope 1 {
-          debug y => _1;                   // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10
+-         debug y => _1;                   // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10
++         debug y => _3;                   // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10
           scope 5 {
           }
       }
@@ -25,7 +26,7 @@
       }
   
       bb0: {
-          StorageLive(_1);                 // scope 0 at $DIR/reference_prop.rs:+1:9: +1:10
+-         StorageLive(_1);                 // scope 0 at $DIR/reference_prop.rs:+1:9: +1:10
           StorageLive(_2);                 // scope 0 at $DIR/reference_prop.rs:+2:13: +2:18
           _2 = const 0_i32;                // scope 0 at $DIR/reference_prop.rs:+2:21: +2:22
 -         StorageLive(_3);                 // scope 2 at $DIR/reference_prop.rs:+3:13: +3:14
@@ -42,7 +43,7 @@
       bb1: {
           StorageDead(_5);                 // scope 4 at $DIR/reference_prop.rs:+5:27: +5:28
           StorageDead(_4);                 // scope 3 at $DIR/reference_prop.rs:+5:30: +5:31
-          _1 = _3;                         // scope 3 at $DIR/reference_prop.rs:+6:9: +6:10
+-         _1 = _3;                         // scope 3 at $DIR/reference_prop.rs:+6:9: +6:10
 -         StorageDead(_3);                 // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
           StorageDead(_2);                 // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
           StorageLive(_6);                 // scope 1 at $DIR/reference_prop.rs:+9:5: +9:26
@@ -59,7 +60,7 @@
           StorageDead(_7);                 // scope 5 at $DIR/reference_prop.rs:+9:23: +9:24
           StorageDead(_6);                 // scope 1 at $DIR/reference_prop.rs:+9:26: +9:27
           _0 = const ();                   // scope 0 at $DIR/reference_prop.rs:+0:25: +10:2
-          StorageDead(_1);                 // scope 0 at $DIR/reference_prop.rs:+10:1: +10:2
+-         StorageDead(_1);                 // scope 0 at $DIR/reference_prop.rs:+10:1: +10:2
           return;                          // scope 0 at $DIR/reference_prop.rs:+10:2: +10:2
       }
   }
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
index 7ad1ccf28a6..6fd0f936742 100644
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
+++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
@@ -9,81 +9,77 @@
       let _6: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
       let mut _7: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
       let mut _8: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
-      let mut _9: &&usize;                 // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41
-      let mut _10: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
-      let _11: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
-      let mut _12: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
-      let mut _13: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51
-      let mut _14: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
-      let _15: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
-      let mut _16: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
-      let mut _17: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
-      let mut _18: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61
-      let mut _19: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
-      let _20: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
-      let mut _21: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
-      let mut _22: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71
-      let mut _23: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-      let _24: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-      let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
-      let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
-      let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
-      let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+      let _9: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
+      let mut _10: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
+      let _11: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
+      let mut _12: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
+      let mut _13: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
+      let _14: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
+      let mut _15: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
+      let _16: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+      let mut _17: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+      let mut _18: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+      let mut _19: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+      let mut _20: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
       scope 1 {
 -         debug a => _3;                   // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
 -         debug b => _4;                   // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
 -         debug c => _5;                   // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
 -         debug d => _6;                   // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
-+         debug a => _20;                  // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
-+         debug b => _15;                  // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
-+         debug c => _11;                  // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
-+         debug d => _24;                  // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
++         debug a => _14;                  // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
++         debug b => _11;                  // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
++         debug c => _9;                   // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
++         debug d => _16;                  // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
           scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:40: 8:46
-              debug self => _9;            // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => _10;          // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              let mut _29: &usize;         // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              let mut _30: &usize;         // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug self => &_3;           // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug self => &_14;          // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              debug other => &_9;          // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              let mut _21: &usize;         // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              let mut _22: &usize;         // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
               scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug self => _29;       // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug other => _30;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _31: usize;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _32: usize;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  debug self => _21;       // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  debug other => _22;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  let mut _23: usize;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  let mut _24: usize;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
               }
           }
           scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:60: 8:66
-              debug self => _18;           // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => _19;          // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              let mut _33: &usize;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              let mut _34: &usize;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug self => &_5;           // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug self => &_9;           // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              debug other => &_14;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              let mut _25: &usize;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              let mut _26: &usize;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
               scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug self => _33;       // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug other => _34;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _35: usize;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _36: usize;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  debug self => _25;       // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  debug other => _26;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  let mut _27: usize;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  let mut _28: usize;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
               }
           }
           scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:50: 8:56
-              debug self => _13;           // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => _14;          // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              let mut _37: &usize;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              let mut _38: &usize;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug self => &_6;           // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug self => &_16;          // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              debug other => &_11;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              let mut _29: &usize;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              let mut _30: &usize;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
               scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug self => _37;       // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug other => _38;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _39: usize;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _40: usize;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  debug self => _29;       // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  debug other => _30;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  let mut _31: usize;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  let mut _32: usize;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
               }
           }
           scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:70: 8:76
-              debug self => _22;           // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => _23;          // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              let mut _41: &usize;         // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              let mut _42: &usize;         // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug self => &_4;           // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug self => &_11;          // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              debug other => &_16;         // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              let mut _33: &usize;         // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+              let mut _34: &usize;         // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
               scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug self => _41;       // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug other => _42;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _43: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _44: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  debug self => _33;       // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  debug other => _34;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  let mut _35: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                  let mut _36: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
               }
           }
       }
@@ -91,47 +87,43 @@
       bb0: {
 -         StorageLive(_3);                 // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
 +         nop;                             // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
-          _25 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
--         _3 = &((*_25).0: usize);         // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+          _17 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+-         _3 = &((*_17).0: usize);         // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
 -         StorageLive(_4);                 // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
-+         _20 = &((*_25).0: usize);        // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
++         _14 = &((*_17).0: usize);        // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
 +         nop;                             // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
-          _26 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
--         _4 = &((*_26).1: usize);         // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+          _18 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+-         _4 = &((*_18).1: usize);         // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
 -         StorageLive(_5);                 // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
-+         _15 = &((*_26).1: usize);        // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
++         _11 = &((*_18).1: usize);        // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
 +         nop;                             // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
-          _27 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
--         _5 = &((*_27).2: usize);         // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+          _19 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+-         _5 = &((*_19).2: usize);         // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
 -         StorageLive(_6);                 // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
-+         _11 = &((*_27).2: usize);        // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
++         _9 = &((*_19).2: usize);         // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
 +         nop;                             // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
-          _28 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
--         _6 = &((*_28).3: usize);         // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+          _20 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+-         _6 = &((*_20).3: usize);         // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
 -         StorageLive(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-+         _24 = &((*_28).3: usize);        // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
++         _16 = &((*_20).3: usize);        // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
           StorageLive(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
-          StorageLive(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
-          StorageLive(_10);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
--         StorageLive(_11);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
--         _11 = _5;                        // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
--         _29 = deref_copy _3;             // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-         StorageLive(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+-         _9 = _5;                         // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+-         _21 = deref_copy _3;             // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-+         _29 = deref_copy _20;            // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _30 = deref_copy _11;            // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_31);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _31 = (*_29);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_32);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _32 = (*_30);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _8 = Le(move _31, move _32);     // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_32);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_31);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
++         _21 = deref_copy _14;            // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _22 = deref_copy _9;             // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_23);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _23 = (*_21);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_24);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _24 = (*_22);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _8 = Le(move _23, move _24);     // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageDead(_24);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageDead(_23);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-         StorageDead(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-          StorageDead(_10);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-          StorageDead(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
           switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
       }
   
@@ -141,34 +133,30 @@
       }
   
       bb2: {
--         StorageLive(_16);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+-         StorageLive(_12);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
-          StorageLive(_17);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
-          StorageLive(_18);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
-          StorageLive(_19);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
--         StorageLive(_20);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
--         _20 = _3;                        // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
--         _33 = deref_copy _5;             // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_13);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
+-         StorageLive(_14);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+-         _14 = _3;                        // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+-         _25 = deref_copy _5;             // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-+         _33 = deref_copy _11;            // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _34 = deref_copy _20;            // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_35);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _35 = (*_33);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_36);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _36 = (*_34);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _17 = Le(move _35, move _36);    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_36);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_35);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageDead(_20);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
++         _25 = deref_copy _9;             // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _26 = deref_copy _14;            // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_27);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _27 = (*_25);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_28);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _28 = (*_26);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _13 = Le(move _27, move _28);    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageDead(_28);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageDead(_27);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-         StorageDead(_14);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-          StorageDead(_19);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-          StorageDead(_18);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-          switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+          switchInt(move _13) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
       }
   
       bb3: {
--         StorageDead(_16);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
 -         StorageDead(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
 -         StorageDead(_6);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
 -         StorageDead(_5);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
@@ -184,84 +172,76 @@
       }
   
       bb4: {
--         StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+-         StorageDead(_10);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
           StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
           goto -> bb2;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
       }
   
       bb5: {
--         StorageLive(_12);                // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
+-         StorageLive(_10);                // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
+-         StorageLive(_11);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+-         _11 = _4;                        // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+-         _29 = deref_copy _6;             // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
-          StorageLive(_13);                // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
-          StorageLive(_14);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
--         StorageLive(_15);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
--         _15 = _4;                        // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
--         _37 = deref_copy _6;             // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-+         _37 = deref_copy _24;            // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _38 = deref_copy _15;            // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_39);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _39 = (*_37);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_40);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _40 = (*_38);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _12 = Le(move _39, move _40);    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_40);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_39);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageDead(_15);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
++         _29 = deref_copy _16;            // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _30 = deref_copy _11;            // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_31);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _31 = (*_29);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_32);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _32 = (*_30);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _10 = Le(move _31, move _32);    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageDead(_32);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageDead(_31);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-         StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+-         _7 = move _10;                   // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+-         StorageDead(_10);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-          StorageDead(_14);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-          StorageDead(_13);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
--         _7 = move _12;                   // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
--         StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
           StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
 -         switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-+         switchInt(move _12) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
++         switchInt(move _10) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
       }
   
       bb6: {
--         _16 = const false;               // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+-         _12 = const false;               // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
 +         _0 = const false;                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
           goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
       }
   
       bb7: {
--         StorageLive(_21);                // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
+-         StorageLive(_15);                // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
+-         StorageLive(_16);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         _16 = _6;                        // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         _33 = deref_copy _4;             // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
-          StorageLive(_22);                // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
-          StorageLive(_23);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
--         StorageLive(_24);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
--         _24 = _6;                        // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
--         _41 = deref_copy _4;             // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-+         _41 = deref_copy _15;            // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _42 = deref_copy _24;            // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_43);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _43 = (*_41);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_44);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _44 = (*_42);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _21 = Le(move _43, move _44);    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _0 = Le(move _43, move _44);     // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_44);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_43);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageDead(_24);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
++         _33 = deref_copy _11;            // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _34 = deref_copy _16;            // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_35);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _35 = (*_33);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageLive(_36);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          _36 = (*_34);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-         _15 = Le(move _35, move _36);    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
++         _0 = Le(move _35, move _36);     // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageDead(_36);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+          StorageDead(_35);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-         StorageDead(_16);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         _12 = move _15;                  // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-          StorageDead(_23);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-          StorageDead(_22);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
--         _16 = move _21;                  // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
           goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
       }
   
       bb8: {
--         StorageDead(_21);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         StorageDead(_15);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-          StorageDead(_17);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
--         _0 = move _16;                   // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+          StorageDead(_13);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         _0 = move _12;                   // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
 +         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
           goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
       }
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
index f6350b3812a..503af523872 100644
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
+++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
@@ -43,8 +43,10 @@
           debug c => _5;                   // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
           debug d => _6;                   // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
           scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:40: 8:46
-              debug self => _9;            // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => _10;          // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug self => _9;            // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug other => _10;          // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug self => &_3;           // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug other => &_11;         // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
               let mut _29: &usize;         // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
               let mut _30: &usize;         // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
               scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
@@ -55,8 +57,10 @@
               }
           }
           scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:60: 8:66
-              debug self => _18;           // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => _19;          // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug self => _18;           // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug other => _19;          // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug self => &_5;           // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug other => &_20;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
               let mut _35: &usize;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
               let mut _36: &usize;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
               scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
@@ -67,8 +71,10 @@
               }
           }
           scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:50: 8:56
-              debug self => _13;           // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => _14;          // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug self => _13;           // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug other => _14;          // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug self => &_6;           // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug other => &_15;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
               let mut _41: &usize;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
               let mut _42: &usize;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
               scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
@@ -79,8 +85,10 @@
               }
           }
           scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:70: 8:76
-              debug self => _22;           // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => _23;          // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug self => _22;           // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+-             debug other => _23;          // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug self => &_4;           // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
++             debug other => &_24;         // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
               let mut _47: &usize;         // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
               let mut _48: &usize;         // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
               scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
@@ -107,12 +115,12 @@
           _6 = &((*_28).3: usize);         // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
           StorageLive(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
           StorageLive(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
-          StorageLive(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
-          _9 = &_3;                        // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
-          StorageLive(_10);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+-         StorageLive(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
+-         _9 = &_3;                        // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
+-         StorageLive(_10);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
           StorageLive(_11);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
           _11 = _5;                        // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-          _10 = &_11;                      // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+-         _10 = &_11;                      // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
 -         _29 = deref_copy (*_9);          // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
 -         _30 = deref_copy (*_10);         // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         _29 = deref_copy _3;             // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
@@ -125,8 +133,8 @@
           StorageDead(_34);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
           StorageDead(_33);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
           StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-          StorageDead(_10);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-          StorageDead(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+-         StorageDead(_10);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+-         StorageDead(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
           switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
       }
   
@@ -138,12 +146,12 @@
       bb2: {
           StorageLive(_16);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
           StorageLive(_17);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
-          StorageLive(_18);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
-          _18 = &_5;                       // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
-          StorageLive(_19);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+-         StorageLive(_18);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
+-         _18 = &_5;                       // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
+-         StorageLive(_19);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
           StorageLive(_20);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
           _20 = _3;                        // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-          _19 = &_20;                      // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+-         _19 = &_20;                      // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
 -         _35 = deref_copy (*_18);         // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
 -         _36 = deref_copy (*_19);         // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         _35 = deref_copy _5;             // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
@@ -156,8 +164,8 @@
           StorageDead(_40);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
           StorageDead(_39);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
           StorageDead(_20);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-          StorageDead(_19);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-          StorageDead(_18);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+-         StorageDead(_19);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+-         StorageDead(_18);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
           switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
       }
   
@@ -180,12 +188,12 @@
   
       bb5: {
           StorageLive(_12);                // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
-          StorageLive(_13);                // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
-          _13 = &_6;                       // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
-          StorageLive(_14);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+-         StorageLive(_13);                // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
+-         _13 = &_6;                       // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
+-         StorageLive(_14);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
           StorageLive(_15);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
           _15 = _4;                        // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-          _14 = &_15;                      // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+-         _14 = &_15;                      // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
 -         _41 = deref_copy (*_13);         // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
 -         _42 = deref_copy (*_14);         // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         _41 = deref_copy _6;             // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
@@ -198,8 +206,8 @@
           StorageDead(_46);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
           StorageDead(_45);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
           StorageDead(_15);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-          StorageDead(_14);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-          StorageDead(_13);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+-         StorageDead(_14);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+-         StorageDead(_13);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
           _7 = move _12;                   // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
           StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
           StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
@@ -213,12 +221,12 @@
   
       bb7: {
           StorageLive(_21);                // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
-          StorageLive(_22);                // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
-          _22 = &_4;                       // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
-          StorageLive(_23);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         StorageLive(_22);                // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
+-         _22 = &_4;                       // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
+-         StorageLive(_23);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
           StorageLive(_24);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
           _24 = _6;                        // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-          _23 = &_24;                      // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         _23 = &_24;                      // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
 -         _47 = deref_copy (*_22);         // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
 -         _48 = deref_copy (*_23);         // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
 +         _47 = deref_copy _4;             // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
@@ -231,8 +239,8 @@
           StorageDead(_52);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
           StorageDead(_51);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
           StorageDead(_24);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-          StorageDead(_23);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-          StorageDead(_22);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         StorageDead(_23);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+-         StorageDead(_22);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
           _16 = move _21;                  // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
           goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
       }
diff --git a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
index 2af864998cb..4b2a16b50b4 100644
--- a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
+++ b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
@@ -3,16 +3,13 @@
 fn process_void(_1: *const Void) -> () {
     debug input => _1;                   // in scope 0 at $DIR/uninhabited_enum.rs:+0:21: +0:26
     let mut _0: ();                      // return place in scope 0 at $DIR/uninhabited_enum.rs:+0:41: +0:41
-    let _2: &Void;                       // in scope 0 at $DIR/uninhabited_enum.rs:+1:8: +1:14
     scope 1 {
-        debug _input => _2;              // in scope 1 at $DIR/uninhabited_enum.rs:+1:8: +1:14
+        debug _input => _1;              // in scope 1 at $DIR/uninhabited_enum.rs:+1:8: +1:14
     }
     scope 2 {
     }
 
     bb0: {
-        StorageLive(_2);                 // scope 0 at $DIR/uninhabited_enum.rs:+1:8: +1:14
-        StorageDead(_2);                 // scope 0 at $DIR/uninhabited_enum.rs:+4:1: +4:2
         return;                          // scope 0 at $DIR/uninhabited_enum.rs:+4:2: +4:2
     }
 }