about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-02 02:36:07 +0000
committerbors <bors@rust-lang.org>2023-06-02 02:36:07 +0000
commit774a3d1523bde3a16f8a92dbaac01d211ba911c3 (patch)
tree768293afbb39c58c3d23ad5481c5240e4cebca0c
parentf85ab544dfbbce7448993c490ad16c176339b939 (diff)
parentd796c600ad53392c47dd5db3257612c0cb29d88a (diff)
downloadrust-774a3d1523bde3a16f8a92dbaac01d211ba911c3.tar.gz
rust-774a3d1523bde3a16f8a92dbaac01d211ba911c3.zip
Auto merge of #111553 - cjgillot:mir-e2e, r=scottmcm
Add a few MIR pre-codegen tests

r? `@scottmcm`
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir84
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir127
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir126
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.rs51
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir144
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.rs17
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir64
-rw-r--r--tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir102
-rw-r--r--tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir118
-rw-r--r--tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir91
-rw-r--r--tests/mir-opt/pre-codegen/loops.rs37
-rw-r--r--tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir83
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.rs15
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir228
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir92
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir213
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir155
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.rs15
-rw-r--r--tests/mir-opt/slice_filter.rs20
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff279
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff165
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff267
-rw-r--r--tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff139
-rw-r--r--tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff109
-rw-r--r--tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff103
25 files changed, 1762 insertions, 1082 deletions
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir
new file mode 100644
index 00000000000..40ddf82f4cf
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir
@@ -0,0 +1,84 @@
+// MIR for `bitand` after PreCodegen
+
+fn bitand(_1: &Blueprint, _2: &Blueprint) -> bool {
+    debug a => _1;                       // in scope 0 at $DIR/chained_comparison.rs:+0:15: +0:16
+    debug b => _2;                       // in scope 0 at $DIR/chained_comparison.rs:+0:30: +0:31
+    let mut _0: bool;                    // return place in scope 0 at $DIR/chained_comparison.rs:+0:48: +0:52
+    let mut _3: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
+    let mut _4: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
+    let mut _5: bool;                    // in scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
+    let mut _6: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21
+    let mut _7: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34
+    let mut _8: bool;                    // in scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35
+    let mut _9: bool;                    // in scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35
+    let mut _10: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28
+    let mut _11: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48
+    let mut _12: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49
+    let mut _13: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49
+    let mut _14: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25
+    let mut _15: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42
+    let mut _16: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43
+    let mut _17: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43
+    let mut _18: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21
+    let mut _19: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34
+    let mut _20: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35
+
+    bb0: {
+        StorageLive(_17);                // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43
+        StorageLive(_13);                // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49
+        StorageLive(_9);                 // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35
+        StorageLive(_5);                 // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
+        StorageLive(_3);                 // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
+        _3 = ((*_1).0: u32);             // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
+        StorageLive(_4);                 // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
+        _4 = ((*_2).0: u32);             // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
+        _5 = Eq(move _3, move _4);       // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
+        StorageDead(_4);                 // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43
+        StorageDead(_3);                 // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43
+        StorageLive(_8);                 // scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35
+        StorageLive(_6);                 // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21
+        _6 = ((*_1).1: u32);             // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21
+        StorageLive(_7);                 // scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34
+        _7 = ((*_2).1: u32);             // scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34
+        _8 = Eq(move _6, move _7);       // scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35
+        StorageDead(_7);                 // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35
+        StorageDead(_6);                 // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35
+        _9 = BitAnd(move _5, move _8);   // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35
+        StorageDead(_8);                 // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35
+        StorageDead(_5);                 // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35
+        StorageLive(_12);                // scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49
+        StorageLive(_10);                // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28
+        _10 = ((*_1).2: u32);            // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28
+        StorageLive(_11);                // scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48
+        _11 = ((*_2).2: u32);            // scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48
+        _12 = Eq(move _10, move _11);    // scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49
+        StorageDead(_11);                // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49
+        StorageDead(_10);                // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49
+        _13 = BitAnd(move _9, move _12); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49
+        StorageDead(_12);                // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49
+        StorageDead(_9);                 // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49
+        StorageLive(_16);                // scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43
+        StorageLive(_14);                // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25
+        _14 = ((*_1).3: u32);            // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25
+        StorageLive(_15);                // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42
+        _15 = ((*_2).3: u32);            // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42
+        _16 = Eq(move _14, move _15);    // scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43
+        StorageDead(_15);                // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43
+        StorageDead(_14);                // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43
+        _17 = BitAnd(move _13, move _16); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43
+        StorageDead(_16);                // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43
+        StorageDead(_13);                // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43
+        StorageLive(_20);                // scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35
+        StorageLive(_18);                // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21
+        _18 = ((*_1).4: u32);            // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21
+        StorageLive(_19);                // scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34
+        _19 = ((*_2).4: u32);            // scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34
+        _20 = Eq(move _18, move _19);    // scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35
+        StorageDead(_19);                // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35
+        StorageDead(_18);                // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35
+        _0 = BitAnd(move _17, move _20); // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:35
+        StorageDead(_20);                // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35
+        StorageDead(_17);                // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35
+        return;                          // scope 0 at $DIR/chained_comparison.rs:+6:2: +6:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
new file mode 100644
index 00000000000..26ce7fda4ed
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
@@ -0,0 +1,127 @@
+// MIR for `naive` after PreCodegen
+
+fn naive(_1: &Blueprint, _2: &Blueprint) -> bool {
+    debug a => _1;                       // in scope 0 at $DIR/chained_comparison.rs:+0:14: +0:15
+    debug b => _2;                       // in scope 0 at $DIR/chained_comparison.rs:+0:29: +0:30
+    let mut _0: bool;                    // return place in scope 0 at $DIR/chained_comparison.rs:+0:47: +0:51
+    let mut _3: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
+    let mut _4: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
+    let mut _5: bool;                    // in scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
+    let mut _6: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22
+    let mut _7: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35
+    let mut _8: bool;                    // in scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36
+    let mut _9: bool;                    // in scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
+    let mut _10: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29
+    let mut _11: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49
+    let mut _12: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50
+    let mut _13: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
+    let mut _14: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26
+    let mut _15: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43
+    let mut _16: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44
+    let mut _17: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
+    let mut _18: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22
+    let mut _19: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35
+    let mut _20: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36
+
+    bb0: {
+        StorageLive(_17);                // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
+        StorageLive(_13);                // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
+        StorageLive(_9);                 // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
+        StorageLive(_5);                 // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
+        StorageLive(_3);                 // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
+        _3 = ((*_1).0: u32);             // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
+        StorageLive(_4);                 // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
+        _4 = ((*_2).0: u32);             // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
+        _5 = Eq(move _3, move _4);       // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
+        StorageDead(_4);                 // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43
+        StorageDead(_3);                 // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43
+        switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
+    }
+
+    bb1: {
+        StorageDead(_8);                 // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
+        StorageDead(_5);                 // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
+        goto -> bb3;                     // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
+    }
+
+    bb2: {
+        StorageLive(_8);                 // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36
+        StorageLive(_6);                 // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22
+        _6 = ((*_1).1: u32);             // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22
+        StorageLive(_7);                 // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35
+        _7 = ((*_2).1: u32);             // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35
+        _8 = Eq(move _6, move _7);       // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36
+        StorageDead(_7);                 // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
+        StorageDead(_6);                 // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
+        _9 = move _8;                    // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
+        StorageDead(_8);                 // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
+        StorageDead(_5);                 // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
+        switchInt(move _9) -> [0: bb3, otherwise: bb4]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
+    }
+
+    bb3: {
+        StorageDead(_12);                // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
+        StorageDead(_9);                 // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
+        goto -> bb5;                     // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
+    }
+
+    bb4: {
+        StorageLive(_12);                // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50
+        StorageLive(_10);                // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29
+        _10 = ((*_1).2: u32);            // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29
+        StorageLive(_11);                // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49
+        _11 = ((*_2).2: u32);            // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49
+        _12 = Eq(move _10, move _11);    // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50
+        StorageDead(_11);                // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
+        StorageDead(_10);                // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
+        _13 = move _12;                  // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
+        StorageDead(_12);                // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
+        StorageDead(_9);                 // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
+        switchInt(move _13) -> [0: bb5, otherwise: bb6]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
+    }
+
+    bb5: {
+        StorageDead(_16);                // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
+        StorageDead(_13);                // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
+        goto -> bb7;                     // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
+    }
+
+    bb6: {
+        StorageLive(_16);                // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44
+        StorageLive(_14);                // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26
+        _14 = ((*_1).3: u32);            // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26
+        StorageLive(_15);                // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43
+        _15 = ((*_2).3: u32);            // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43
+        _16 = Eq(move _14, move _15);    // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44
+        StorageDead(_15);                // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
+        StorageDead(_14);                // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
+        _17 = move _16;                  // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
+        StorageDead(_16);                // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
+        StorageDead(_13);                // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
+        switchInt(move _17) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
+    }
+
+    bb7: {
+        _0 = const false;                // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
+        goto -> bb9;                     // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
+    }
+
+    bb8: {
+        StorageLive(_20);                // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36
+        StorageLive(_18);                // scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22
+        _18 = ((*_1).4: u32);            // scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22
+        StorageLive(_19);                // scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35
+        _19 = ((*_2).4: u32);            // scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35
+        _20 = Eq(move _18, move _19);    // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36
+        StorageDead(_19);                // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36
+        StorageDead(_18);                // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36
+        _0 = move _20;                   // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
+        goto -> bb9;                     // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
+    }
+
+    bb9: {
+        StorageDead(_20);                // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36
+        StorageDead(_17);                // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36
+        return;                          // scope 0 at $DIR/chained_comparison.rs:+6:2: +6:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
new file mode 100644
index 00000000000..7560e1e26ce
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
@@ -0,0 +1,126 @@
+// MIR for `returning` after PreCodegen
+
+fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
+    debug a => _1;                       // in scope 0 at $DIR/chained_comparison.rs:+0:18: +0:19
+    debug b => _2;                       // in scope 0 at $DIR/chained_comparison.rs:+0:33: +0:34
+    let mut _0: bool;                    // return place in scope 0 at $DIR/chained_comparison.rs:+0:51: +0:55
+    let mut _3: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24
+    let mut _4: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44
+    let mut _5: bool;                    // in scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44
+    let mut _6: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17
+    let mut _7: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30
+    let mut _8: bool;                    // in scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30
+    let mut _9: u32;                     // in scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24
+    let mut _10: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44
+    let mut _11: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44
+    let mut _12: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21
+    let mut _13: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38
+    let mut _14: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38
+    let mut _15: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17
+    let mut _16: u32;                    // in scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30
+    let mut _17: bool;                   // in scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30
+
+    bb0: {
+        StorageLive(_5);                 // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44
+        StorageLive(_3);                 // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24
+        _3 = ((*_1).0: u32);             // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24
+        StorageLive(_4);                 // scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44
+        _4 = ((*_2).0: u32);             // scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44
+        _5 = Ne(move _3, move _4);       // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44
+        StorageDead(_4);                 // scope 0 at $DIR/chained_comparison.rs:+1:43: +1:44
+        StorageDead(_3);                 // scope 0 at $DIR/chained_comparison.rs:+1:43: +1:44
+        switchInt(move _5) -> [0: bb1, otherwise: bb10]; // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44
+    }
+
+    bb1: {
+        StorageDead(_5);                 // scope 0 at $DIR/chained_comparison.rs:+3:5: +3:6
+        StorageLive(_8);                 // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30
+        StorageLive(_6);                 // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17
+        _6 = ((*_1).1: u32);             // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17
+        StorageLive(_7);                 // scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30
+        _7 = ((*_2).1: u32);             // scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30
+        _8 = Ne(move _6, move _7);       // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30
+        StorageDead(_7);                 // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:30
+        StorageDead(_6);                 // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:30
+        switchInt(move _8) -> [0: bb2, otherwise: bb9]; // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30
+    }
+
+    bb2: {
+        StorageDead(_8);                 // scope 0 at $DIR/chained_comparison.rs:+6:5: +6:6
+        StorageLive(_11);                // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44
+        StorageLive(_9);                 // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24
+        _9 = ((*_1).2: u32);             // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24
+        StorageLive(_10);                // scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44
+        _10 = ((*_2).2: u32);            // scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44
+        _11 = Ne(move _9, move _10);     // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44
+        StorageDead(_10);                // scope 0 at $DIR/chained_comparison.rs:+7:43: +7:44
+        StorageDead(_9);                 // scope 0 at $DIR/chained_comparison.rs:+7:43: +7:44
+        switchInt(move _11) -> [0: bb3, otherwise: bb8]; // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44
+    }
+
+    bb3: {
+        StorageDead(_11);                // scope 0 at $DIR/chained_comparison.rs:+9:5: +9:6
+        StorageLive(_14);                // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38
+        StorageLive(_12);                // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21
+        _12 = ((*_1).3: u32);            // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21
+        StorageLive(_13);                // scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38
+        _13 = ((*_2).3: u32);            // scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38
+        _14 = Ne(move _12, move _13);    // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38
+        StorageDead(_13);                // scope 0 at $DIR/chained_comparison.rs:+10:37: +10:38
+        StorageDead(_12);                // scope 0 at $DIR/chained_comparison.rs:+10:37: +10:38
+        switchInt(move _14) -> [0: bb4, otherwise: bb7]; // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38
+    }
+
+    bb4: {
+        StorageDead(_14);                // scope 0 at $DIR/chained_comparison.rs:+12:5: +12:6
+        StorageLive(_17);                // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30
+        StorageLive(_15);                // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17
+        _15 = ((*_1).4: u32);            // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17
+        StorageLive(_16);                // scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30
+        _16 = ((*_2).4: u32);            // scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30
+        _17 = Ne(move _15, move _16);    // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30
+        StorageDead(_16);                // scope 0 at $DIR/chained_comparison.rs:+13:29: +13:30
+        StorageDead(_15);                // scope 0 at $DIR/chained_comparison.rs:+13:29: +13:30
+        switchInt(move _17) -> [0: bb5, otherwise: bb6]; // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30
+    }
+
+    bb5: {
+        StorageDead(_17);                // scope 0 at $DIR/chained_comparison.rs:+15:5: +15:6
+        _0 = const true;                 // scope 0 at $DIR/chained_comparison.rs:+16:5: +16:9
+        goto -> bb11;                    // scope 0 at $DIR/chained_comparison.rs:+17:2: +17:2
+    }
+
+    bb6: {
+        _0 = const false;                // scope 0 at $DIR/chained_comparison.rs:+14:16: +14:21
+        StorageDead(_17);                // scope 0 at $DIR/chained_comparison.rs:+15:5: +15:6
+        goto -> bb11;                    // scope 0 at no-location
+    }
+
+    bb7: {
+        _0 = const false;                // scope 0 at $DIR/chained_comparison.rs:+11:16: +11:21
+        StorageDead(_14);                // scope 0 at $DIR/chained_comparison.rs:+12:5: +12:6
+        goto -> bb11;                    // scope 0 at no-location
+    }
+
+    bb8: {
+        _0 = const false;                // scope 0 at $DIR/chained_comparison.rs:+8:16: +8:21
+        StorageDead(_11);                // scope 0 at $DIR/chained_comparison.rs:+9:5: +9:6
+        goto -> bb11;                    // scope 0 at no-location
+    }
+
+    bb9: {
+        _0 = const false;                // scope 0 at $DIR/chained_comparison.rs:+5:16: +5:21
+        StorageDead(_8);                 // scope 0 at $DIR/chained_comparison.rs:+6:5: +6:6
+        goto -> bb11;                    // scope 0 at no-location
+    }
+
+    bb10: {
+        _0 = const false;                // scope 0 at $DIR/chained_comparison.rs:+2:16: +2:21
+        StorageDead(_5);                 // scope 0 at $DIR/chained_comparison.rs:+3:5: +3:6
+        goto -> bb11;                    // scope 0 at no-location
+    }
+
+    bb11: {
+        return;                          // scope 0 at $DIR/chained_comparison.rs:+17:2: +17:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs
new file mode 100644
index 00000000000..f7879140f81
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/chained_comparison.rs
@@ -0,0 +1,51 @@
+// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
+// ignore-debug
+
+#![crate_type = "lib"]
+
+pub struct Blueprint {
+    pub fuel_tank_size: u32,
+    pub payload: u32,
+    pub wheel_diameter: u32,
+    pub wheel_width: u32,
+    pub storage: u32,
+}
+
+pub fn naive(a: &Blueprint, b: &Blueprint) -> bool {
+    (a.fuel_tank_size == b.fuel_tank_size)
+        && (a.payload == b.payload)
+        && (a.wheel_diameter == b.wheel_diameter)
+        && (a.wheel_width == b.wheel_width)
+        && (a.storage == b.storage)
+}
+
+pub fn bitand(a: &Blueprint, b: &Blueprint) -> bool {
+    (a.fuel_tank_size == b.fuel_tank_size)
+        & (a.payload == b.payload)
+        & (a.wheel_diameter == b.wheel_diameter)
+        & (a.wheel_width == b.wheel_width)
+        & (a.storage == b.storage)
+}
+
+pub fn returning(a: &Blueprint, b: &Blueprint) -> bool {
+    if a.fuel_tank_size != b.fuel_tank_size {
+        return false;
+    }
+    if a.payload != b.payload {
+        return false;
+    }
+    if a.wheel_diameter != b.wheel_diameter {
+        return false;
+    }
+    if a.wheel_width != b.wheel_width {
+        return false;
+    }
+    if a.storage != b.storage {
+        return false;
+    }
+    true
+}
+
+// EMIT_MIR chained_comparison.naive.PreCodegen.after.mir
+// EMIT_MIR chained_comparison.bitand.PreCodegen.after.mir
+// EMIT_MIR chained_comparison.returning.PreCodegen.after.mir
diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir
new file mode 100644
index 00000000000..55945bbc8fc
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir
@@ -0,0 +1,144 @@
+// MIR for `checked_shl` after PreCodegen
+
+fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
+    debug x => _1;                       // in scope 0 at $DIR/checked_ops.rs:+0:20: +0:21
+    debug rhs => _2;                     // in scope 0 at $DIR/checked_ops.rs:+0:28: +0:31
+    let mut _0: std::option::Option<u32>; // return place in scope 0 at $DIR/checked_ops.rs:+0:41: +0:52
+    scope 1 (inlined core::num::<impl u32>::checked_shl) { // at $DIR/checked_ops.rs:16:7: 16:23
+        debug self => _1;                // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        debug rhs => _2;                 // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        let mut _11: u32;                // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        let mut _12: bool;               // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        scope 2 {
+            debug a => _11;              // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+            debug b => _10;              // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        }
+        scope 3 (inlined core::num::<impl u32>::overflowing_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+            debug self => _1;            // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+            debug rhs => _2;             // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+            let mut _9: u32;             // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+            let mut _10: bool;           // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+            scope 4 (inlined core::num::<impl u32>::wrapping_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                debug self => _1;        // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                debug rhs => _2;         // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                let mut _3: u32;         // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                let mut _4: u32;         // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                scope 5 {
+                    scope 6 (inlined core::num::<impl u32>::unchecked_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                        debug self => _1; // in scope 6 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                        debug rhs => _4; // in scope 6 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                        let mut _8: u32; // in scope 6 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                        scope 7 {
+                            scope 8 (inlined core::num::<impl u32>::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                debug x => _4; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                let mut _5: std::result::Result<u32, std::convert::Infallible>; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                let mut _7: std::option::Option<u32>; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                scope 9 {
+                                    scope 10 (inlined <u32 as TryInto<u32>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                        debug self => _4; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+                                        scope 11 (inlined <u32 as TryFrom<u32>>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+                                            debug value => _4; // in scope 11 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+                                            scope 21 (inlined <u32 as Into<u32>>::into) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+                                                debug self => _4; // in scope 21 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+                                                scope 22 (inlined <u32 as From<u32>>::from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+                                                    debug t => _4; // in scope 22 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+                                                }
+                                            }
+                                        }
+                                    }
+                                    scope 12 (inlined Result::<u32, Infallible>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                        debug self => _5; // in scope 12 at $SRC_DIR/core/src/result.rs:LL:COL
+                                        let _6: u32; // in scope 12 at $SRC_DIR/core/src/result.rs:LL:COL
+                                        scope 13 {
+                                            debug x => _6; // in scope 13 at $SRC_DIR/core/src/result.rs:LL:COL
+                                        }
+                                    }
+                                    scope 14 (inlined #[track_caller] Option::<u32>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                        debug self => _7; // in scope 14 at $SRC_DIR/core/src/option.rs:LL:COL
+                                        let mut _13: &std::option::Option<u32>; // in scope 14 at $SRC_DIR/core/src/option.rs:LL:COL
+                                        scope 15 {
+                                            debug val => _8; // in scope 15 at $SRC_DIR/core/src/option.rs:LL:COL
+                                        }
+                                        scope 16 {
+                                            scope 18 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
+                                                scope 19 {
+                                                    scope 20 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                                                    }
+                                                }
+                                            }
+                                        }
+                                        scope 17 (inlined Option::<u32>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
+                                            debug self => _13; // in scope 17 at $SRC_DIR/core/src/option.rs:LL:COL
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    bb0: {
+        StorageLive(_10);                // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
+        StorageLive(_11);                // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
+        StorageLive(_9);                 // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageLive(_4);                 // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageLive(_3);                 // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        _3 = const 31_u32;               // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        _4 = BitAnd(_2, move _3);        // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageDead(_3);                 // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageLive(_8);                 // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        StorageLive(_7);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        StorageLive(_5);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        _5 = Result::<u32, Infallible>::Ok(_4); // scope 11 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+        StorageLive(_6);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        _6 = move ((_5 as Ok).0: u32);   // scope 12 at $SRC_DIR/core/src/result.rs:LL:COL
+        _7 = Option::<u32>::Some(move _6); // scope 13 at $SRC_DIR/core/src/result.rs:LL:COL
+        StorageDead(_6);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        StorageDead(_5);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        StorageLive(_13);                // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        _8 = move ((_7 as Some).0: u32); // scope 14 at $SRC_DIR/core/src/option.rs:LL:COL
+        StorageDead(_13);                // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        StorageDead(_7);                 // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        _9 = unchecked_shl::<u32>(_1, move _8) -> [return: bb1, unwind unreachable]; // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+                                         // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32, u32) -> u32 {unchecked_shl::<u32>}, val: Value(<ZST>) }
+    }
+
+    bb1: {
+        StorageDead(_8);                 // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageDead(_4);                 // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        _10 = Ge(_2, const _);           // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        _11 = move _9;                   // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageDead(_9);                 // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageLive(_12);                // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+        _12 = unlikely(_10) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: $SRC_DIR/core/src/num/mod.rs:LL:COL
+                                         // + literal: Const { ty: extern "rust-intrinsic" fn(bool) -> bool {unlikely}, val: Value(<ZST>) }
+    }
+
+    bb2: {
+        switchInt(move _12) -> [0: bb3, otherwise: bb4]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+    }
+
+    bb3: {
+        _0 = Option::<u32>::Some(_11);   // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        goto -> bb5;                     // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+    }
+
+    bb4: {
+        _0 = Option::<u32>::None;        // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        goto -> bb5;                     // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+    }
+
+    bb5: {
+        StorageDead(_12);                // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageDead(_11);                // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
+        StorageDead(_10);                // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23
+        return;                          // scope 0 at $DIR/checked_ops.rs:+2:2: +2:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs
new file mode 100644
index 00000000000..dee43b0c6f8
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.rs
@@ -0,0 +1,17 @@
+// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
+// needs-unwind
+// ignore-debug
+// only-x86_64
+
+#![crate_type = "lib"]
+#![feature(step_trait)]
+
+// EMIT_MIR checked_ops.step_forward.PreCodegen.after.mir
+pub fn step_forward(x: u32, n: usize) -> u32 {
+    std::iter::Step::forward(x, n)
+}
+
+// EMIT_MIR checked_ops.checked_shl.PreCodegen.after.mir
+pub fn checked_shl(x: u32, rhs: u32) -> Option<u32> {
+    x.checked_shl(rhs)
+}
diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
new file mode 100644
index 00000000000..78f68e8ffe6
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
@@ -0,0 +1,64 @@
+// MIR for `step_forward` after PreCodegen
+
+fn step_forward(_1: u32, _2: usize) -> u32 {
+    debug x => _1;                       // in scope 0 at $DIR/checked_ops.rs:+0:21: +0:22
+    debug n => _2;                       // in scope 0 at $DIR/checked_ops.rs:+0:29: +0:30
+    let mut _0: u32;                     // return place in scope 0 at $DIR/checked_ops.rs:+0:42: +0:45
+    scope 1 (inlined <u32 as Step>::forward) { // at $DIR/checked_ops.rs:11:5: 11:35
+        debug start => _1;               // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        debug n => _2;                   // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        let _3: std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        let mut _4: &std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        let mut _7: bool;                // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        let mut _8: u32;                 // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        scope 2 {
+        }
+        scope 3 (inlined Option::<u32>::is_none) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL
+            debug self => _4;            // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+            let mut _6: bool;            // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+            scope 4 (inlined Option::<u32>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
+                debug self => _4;        // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
+                let mut _5: isize;       // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
+            }
+        }
+        scope 5 (inlined core::num::<impl u32>::wrapping_add) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL
+            debug self => _1;            // in scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+            debug rhs => _8;             // in scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        }
+    }
+
+    bb0: {
+        StorageLive(_7);                 // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_4);                 // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_3);                 // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _3 = <u32 as Step>::forward_checked(_1, _2) -> bb1; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // + literal: Const { ty: fn(u32, usize) -> Option<u32> {<u32 as Step>::forward_checked}, val: Value(<ZST>) }
+    }
+
+    bb1: {
+        _4 = &_3;                        // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_6);                 // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+        _5 = discriminant((*_4));        // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
+        _6 = Eq(_5, const 1_isize);      // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+        _7 = Not(move _6);               // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+        StorageDead(_6);                 // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+        StorageDead(_3);                 // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageDead(_4);                 // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        switchInt(move _7) -> [0: bb3, otherwise: bb2]; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+    }
+
+    bb2: {
+        assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> bb3; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+    }
+
+    bb3: {
+        StorageDead(_7);                 // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_8);                 // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _8 = _2 as u32 (IntToInt);       // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _0 = Add(_1, _8);                // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+        StorageDead(_8);                 // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        return;                          // scope 0 at $DIR/checked_ops.rs:+2:2: +2:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
new file mode 100644
index 00000000000..dce9feddfc5
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
@@ -0,0 +1,102 @@
+// MIR for `filter_mapped` after PreCodegen
+
+fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () {
+    debug iter => _1;                    // in scope 0 at $DIR/loops.rs:+0:28: +0:32
+    debug f => _2;                       // in scope 0 at $DIR/loops.rs:+0:59: +0:60
+    let mut _0: ();                      // return place in scope 0 at $DIR/loops.rs:+0:87: +0:87
+    let mut _3: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32
+    let mut _4: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32
+    let mut _5: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32
+    let mut _6: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32
+    let mut _9: std::option::Option<U>;  // in scope 0 at $DIR/loops.rs:+1:14: +1:32
+    let mut _10: isize;                  // in scope 0 at $DIR/loops.rs:+1:5: +3:6
+    let _12: ();                         // in scope 0 at $DIR/loops.rs:+1:14: +1:32
+    scope 1 {
+        debug iter => _5;                // in scope 1 at $DIR/loops.rs:+1:14: +1:32
+        let _11: U;                      // in scope 1 at $DIR/loops.rs:+1:9: +1:10
+        scope 2 {
+            debug x => _11;              // in scope 2 at $DIR/loops.rs:+1:9: +1:10
+        }
+        scope 4 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as Iterator>::next) { // at $DIR/loops.rs:20:14: 20:32
+            debug self => _6;            // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+            let mut _7: &mut impl Iterator<Item = T>; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+            let mut _8: &mut impl Fn(T) -> Option<U>; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+        }
+    }
+    scope 3 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as IntoIterator>::into_iter) { // at $DIR/loops.rs:20:14: 20:32
+        debug self => _3;                // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    }
+
+    bb0: {
+        StorageLive(_4);                 // scope 0 at $DIR/loops.rs:+1:14: +1:32
+        StorageLive(_3);                 // scope 0 at $DIR/loops.rs:+1:14: +1:32
+        _3 = <impl Iterator<Item = T> as Iterator>::filter_map::<U, impl Fn(T) -> Option<U>>(move _1, move _2) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:32
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:20:19: 20:29
+                                         // + literal: Const { ty: fn(impl Iterator<Item = T>, impl Fn(T) -> Option<U>) -> FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> {<impl Iterator<Item = T> as Iterator>::filter_map::<U, impl Fn(T) -> Option<U>>}, val: Value(<ZST>) }
+    }
+
+    bb1: {
+        _4 = move _3;                    // scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+        StorageDead(_3);                 // scope 0 at $DIR/loops.rs:+1:31: +1:32
+        StorageLive(_5);                 // scope 0 at $DIR/loops.rs:+1:14: +1:32
+        _5 = move _4;                    // scope 0 at $DIR/loops.rs:+1:14: +1:32
+        goto -> bb2;                     // scope 1 at $DIR/loops.rs:+1:5: +3:6
+    }
+
+    bb2: {
+        StorageLive(_9);                 // scope 1 at $DIR/loops.rs:+1:14: +1:32
+        _6 = &mut _5;                    // scope 1 at $DIR/loops.rs:+1:14: +1:32
+        StorageLive(_7);                 // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+        _7 = &mut ((*_6).0: impl Iterator<Item = T>); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+        StorageLive(_8);                 // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+        _8 = &mut ((*_6).1: impl Fn(T) -> Option<U>); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+        _9 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _7, move _8) -> [return: bb3, unwind: bb9]; // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+                                         // + literal: Const { ty: for<'a> fn(&'a mut impl Iterator<Item = T>, &mut impl Fn(T) -> Option<U>) -> Option<U> {<impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>}, val: Value(<ZST>) }
+    }
+
+    bb3: {
+        StorageDead(_8);                 // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+        StorageDead(_7);                 // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL
+        _10 = discriminant(_9);          // scope 1 at $DIR/loops.rs:+1:14: +1:32
+        switchInt(move _10) -> [0: bb4, 1: bb6, otherwise: bb8]; // scope 1 at $DIR/loops.rs:+1:14: +1:32
+    }
+
+    bb4: {
+        StorageDead(_9);                 // scope 1 at $DIR/loops.rs:+3:5: +3:6
+        drop(_5) -> bb5;                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+    }
+
+    bb5: {
+        StorageDead(_5);                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+        StorageDead(_4);                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+        return;                          // scope 0 at $DIR/loops.rs:+4:2: +4:2
+    }
+
+    bb6: {
+        _11 = move ((_9 as Some).0: U);  // scope 1 at $DIR/loops.rs:+1:9: +1:10
+        _12 = opaque::<U>(move _11) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:21:9: 21:15
+                                         // + literal: Const { ty: fn(U) {opaque::<U>}, val: Value(<ZST>) }
+    }
+
+    bb7: {
+        StorageDead(_9);                 // scope 1 at $DIR/loops.rs:+3:5: +3:6
+        goto -> bb2;                     // scope 1 at $DIR/loops.rs:+1:5: +3:6
+    }
+
+    bb8: {
+        unreachable;                     // scope 1 at $DIR/loops.rs:+1:14: +1:32
+    }
+
+    bb9 (cleanup): {
+        drop(_5) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/loops.rs:+3:5: +3:6
+    }
+
+    bb10 (cleanup): {
+        resume;                          // scope 0 at $DIR/loops.rs:+0:1: +4:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
new file mode 100644
index 00000000000..a5002cd6afa
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
@@ -0,0 +1,118 @@
+// MIR for `int_range` after PreCodegen
+
+fn int_range(_1: usize, _2: usize) -> () {
+    debug start => _1;                   // in scope 0 at $DIR/loops.rs:+0:18: +0:23
+    debug end => _2;                     // in scope 0 at $DIR/loops.rs:+0:32: +0:35
+    let mut _0: ();                      // return place in scope 0 at $DIR/loops.rs:+0:44: +0:44
+    let mut _3: std::ops::Range<usize>;  // in scope 0 at $DIR/loops.rs:+1:14: +1:24
+    let mut _4: std::ops::Range<usize>;  // in scope 0 at $DIR/loops.rs:+1:14: +1:24
+    let mut _5: &mut std::ops::Range<usize>; // in scope 0 at $DIR/loops.rs:+1:14: +1:24
+    let mut _9: std::option::Option<usize>; // in scope 0 at $DIR/loops.rs:+1:14: +1:24
+    let mut _12: isize;                  // in scope 0 at $DIR/loops.rs:+1:5: +3:6
+    let _14: ();                         // in scope 0 at $DIR/loops.rs:+1:14: +1:24
+    scope 1 {
+        debug iter => _4;                // in scope 1 at $DIR/loops.rs:+1:14: +1:24
+        let _13: usize;                  // in scope 1 at $DIR/loops.rs:+1:9: +1:10
+        scope 2 {
+            debug i => _13;              // in scope 2 at $DIR/loops.rs:+1:9: +1:10
+        }
+        scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { // at $DIR/loops.rs:8:14: 8:24
+            debug self => _5;            // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+            scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                debug self => _5;        // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let mut _6: &usize;      // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let mut _7: &usize;      // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let mut _8: bool;        // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let _10: usize;          // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let mut _11: usize;      // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                scope 6 {
+                    debug old => _10;    // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                    scope 7 {
+                    }
+                }
+            }
+        }
+    }
+    scope 3 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) { // at $DIR/loops.rs:8:14: 8:24
+        debug self => _3;                // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    }
+
+    bb0: {
+        _3 = std::ops::Range::<usize> { start: _1, end: _2 }; // scope 0 at $DIR/loops.rs:+1:14: +1:24
+        StorageLive(_4);                 // scope 0 at $DIR/loops.rs:+1:14: +1:24
+        _4 = move _3;                    // scope 0 at $DIR/loops.rs:+1:14: +1:24
+        goto -> bb1;                     // scope 1 at $DIR/loops.rs:+1:5: +3:6
+    }
+
+    bb1: {
+        StorageLive(_9);                 // scope 1 at $DIR/loops.rs:+1:14: +1:24
+        _5 = &mut _4;                    // scope 1 at $DIR/loops.rs:+1:14: +1:24
+        StorageLive(_10);                // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_8);                 // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_6);                 // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _6 = &((*_5).0: usize);          // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_7);                 // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _7 = &((*_5).1: usize);          // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _8 = <usize as PartialOrd>::lt(move _6, move _7) -> bb2; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // + literal: Const { ty: for<'a, 'b> fn(&'a usize, &'b usize) -> bool {<usize as PartialOrd>::lt}, val: Value(<ZST>) }
+    }
+
+    bb2: {
+        StorageDead(_7);                 // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageDead(_6);                 // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        switchInt(move _8) -> [0: bb3, otherwise: bb4]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+    }
+
+    bb3: {
+        _9 = Option::<usize>::None;      // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        goto -> bb6;                     // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+    }
+
+    bb4: {
+        _10 = ((*_5).0: usize);          // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_11);                // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> bb5; // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // + literal: Const { ty: unsafe fn(usize, usize) -> usize {<usize as Step>::forward_unchecked}, val: Value(<ZST>) }
+    }
+
+    bb5: {
+        ((*_5).0: usize) = move _11;     // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageDead(_11);                // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _9 = Option::<usize>::Some(_10); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        goto -> bb6;                     // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+    }
+
+    bb6: {
+        StorageDead(_8);                 // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageDead(_10);                // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _12 = discriminant(_9);          // scope 1 at $DIR/loops.rs:+1:14: +1:24
+        switchInt(move _12) -> [0: bb7, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/loops.rs:+1:14: +1:24
+    }
+
+    bb7: {
+        StorageDead(_9);                 // scope 1 at $DIR/loops.rs:+3:5: +3:6
+        StorageDead(_4);                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+        return;                          // scope 0 at $DIR/loops.rs:+4:2: +4:2
+    }
+
+    bb8: {
+        _13 = ((_9 as Some).0: usize);   // scope 1 at $DIR/loops.rs:+1:9: +1:10
+        _14 = opaque::<usize>(_13) -> bb9; // scope 2 at $DIR/loops.rs:+2:9: +2:18
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:9:9: 9:15
+                                         // + literal: Const { ty: fn(usize) {opaque::<usize>}, val: Value(<ZST>) }
+    }
+
+    bb9: {
+        StorageDead(_9);                 // scope 1 at $DIR/loops.rs:+3:5: +3:6
+        goto -> bb1;                     // scope 1 at $DIR/loops.rs:+1:5: +3:6
+    }
+
+    bb10: {
+        unreachable;                     // scope 1 at $DIR/loops.rs:+1:14: +1:24
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
new file mode 100644
index 00000000000..bf1380b30ff
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
@@ -0,0 +1,91 @@
+// MIR for `mapped` after PreCodegen
+
+fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
+    debug iter => _1;                    // in scope 0 at $DIR/loops.rs:+0:21: +0:25
+    debug f => _2;                       // in scope 0 at $DIR/loops.rs:+0:52: +0:53
+    let mut _0: ();                      // return place in scope 0 at $DIR/loops.rs:+0:72: +0:72
+    let mut _3: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25
+    let mut _4: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25
+    let mut _5: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25
+    let mut _6: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25
+    let mut _7: std::option::Option<U>;  // in scope 0 at $DIR/loops.rs:+1:14: +1:25
+    let mut _8: isize;                   // in scope 0 at $DIR/loops.rs:+1:5: +3:6
+    let _10: ();                         // in scope 0 at $DIR/loops.rs:+1:14: +1:25
+    scope 1 {
+        debug iter => _5;                // in scope 1 at $DIR/loops.rs:+1:14: +1:25
+        let _9: U;                       // in scope 1 at $DIR/loops.rs:+1:9: +1:10
+        scope 2 {
+            debug x => _9;               // in scope 2 at $DIR/loops.rs:+1:9: +1:10
+        }
+    }
+    scope 3 (inlined <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as IntoIterator>::into_iter) { // at $DIR/loops.rs:14:14: 14:25
+        debug self => _3;                // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    }
+
+    bb0: {
+        StorageLive(_4);                 // scope 0 at $DIR/loops.rs:+1:14: +1:25
+        StorageLive(_3);                 // scope 0 at $DIR/loops.rs:+1:14: +1:25
+        _3 = <impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>(move _1, move _2) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:25
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:14:19: 14:22
+                                         // + literal: Const { ty: fn(impl Iterator<Item = T>, impl Fn(T) -> U) -> Map<impl Iterator<Item = T>, impl Fn(T) -> U> {<impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>}, val: Value(<ZST>) }
+    }
+
+    bb1: {
+        _4 = move _3;                    // scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+        StorageDead(_3);                 // scope 0 at $DIR/loops.rs:+1:24: +1:25
+        StorageLive(_5);                 // scope 0 at $DIR/loops.rs:+1:14: +1:25
+        _5 = move _4;                    // scope 0 at $DIR/loops.rs:+1:14: +1:25
+        goto -> bb2;                     // scope 1 at $DIR/loops.rs:+1:5: +3:6
+    }
+
+    bb2: {
+        StorageLive(_7);                 // scope 1 at $DIR/loops.rs:+1:14: +1:25
+        _6 = &mut _5;                    // scope 1 at $DIR/loops.rs:+1:14: +1:25
+        _7 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(_6) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:25
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:14:14: 14:25
+                                         // + literal: Const { ty: for<'a> fn(&'a mut Map<impl Iterator<Item = T>, impl Fn(T) -> U>) -> Option<<Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::Item> {<Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next}, val: Value(<ZST>) }
+    }
+
+    bb3: {
+        _8 = discriminant(_7);           // scope 1 at $DIR/loops.rs:+1:14: +1:25
+        switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8]; // scope 1 at $DIR/loops.rs:+1:14: +1:25
+    }
+
+    bb4: {
+        StorageDead(_7);                 // scope 1 at $DIR/loops.rs:+3:5: +3:6
+        drop(_5) -> bb5;                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+    }
+
+    bb5: {
+        StorageDead(_5);                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+        StorageDead(_4);                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+        return;                          // scope 0 at $DIR/loops.rs:+4:2: +4:2
+    }
+
+    bb6: {
+        _9 = move ((_7 as Some).0: U);   // scope 1 at $DIR/loops.rs:+1:9: +1:10
+        _10 = opaque::<U>(move _9) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:15:9: 15:15
+                                         // + literal: Const { ty: fn(U) {opaque::<U>}, val: Value(<ZST>) }
+    }
+
+    bb7: {
+        StorageDead(_7);                 // scope 1 at $DIR/loops.rs:+3:5: +3:6
+        goto -> bb2;                     // scope 1 at $DIR/loops.rs:+1:5: +3:6
+    }
+
+    bb8: {
+        unreachable;                     // scope 1 at $DIR/loops.rs:+1:14: +1:25
+    }
+
+    bb9 (cleanup): {
+        drop(_5) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/loops.rs:+3:5: +3:6
+    }
+
+    bb10 (cleanup): {
+        resume;                          // scope 0 at $DIR/loops.rs:+0:1: +4:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs
new file mode 100644
index 00000000000..67f549a511c
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.rs
@@ -0,0 +1,37 @@
+// compile-flags: -O -Zmir-opt-level=2 -g
+// needs-unwind
+// ignore-debug
+
+#![crate_type = "lib"]
+
+pub fn int_range(start: usize, end: usize) {
+    for i in start..end {
+        opaque(i)
+    }
+}
+
+pub fn mapped<T, U>(iter: impl Iterator<Item = T>, f: impl Fn(T) -> U) {
+    for x in iter.map(f) {
+        opaque(x)
+    }
+}
+
+pub fn filter_mapped<T, U>(iter: impl Iterator<Item = T>, f: impl Fn(T) -> Option<U>) {
+    for x in iter.filter_map(f) {
+        opaque(x)
+    }
+}
+
+pub fn vec_move(mut v: Vec<impl Sized>) {
+    for x in v {
+        opaque(x)
+    }
+}
+
+#[inline(never)]
+fn opaque(_: impl Sized) {}
+
+// EMIT_MIR loops.int_range.PreCodegen.after.mir
+// EMIT_MIR loops.mapped.PreCodegen.after.mir
+// EMIT_MIR loops.filter_mapped.PreCodegen.after.mir
+// EMIT_MIR loops.vec_move.PreCodegen.after.mir
diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
new file mode 100644
index 00000000000..6cd5a66de00
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
@@ -0,0 +1,83 @@
+// MIR for `vec_move` after PreCodegen
+
+fn vec_move(_1: Vec<impl Sized>) -> () {
+    debug v => _1;                       // in scope 0 at $DIR/loops.rs:+0:17: +0:22
+    let mut _0: ();                      // return place in scope 0 at $DIR/loops.rs:+0:41: +0:41
+    let mut _2: std::vec::IntoIter<impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:15
+    let mut _3: std::vec::IntoIter<impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:15
+    let mut _4: &mut std::vec::IntoIter<impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:15
+    let mut _5: std::option::Option<impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:15
+    let mut _6: isize;                   // in scope 0 at $DIR/loops.rs:+1:5: +3:6
+    let _8: ();                          // in scope 0 at $DIR/loops.rs:+1:14: +1:15
+    scope 1 {
+        debug iter => _3;                // in scope 1 at $DIR/loops.rs:+1:14: +1:15
+        let _7: impl Sized;              // in scope 1 at $DIR/loops.rs:+1:9: +1:10
+        scope 2 {
+            debug x => _7;               // in scope 2 at $DIR/loops.rs:+1:9: +1:10
+        }
+    }
+
+    bb0: {
+        StorageLive(_2);                 // scope 0 at $DIR/loops.rs:+1:14: +1:15
+        _2 = <Vec<impl Sized> as IntoIterator>::into_iter(move _1) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:15
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:26:14: 26:15
+                                         // + literal: Const { ty: fn(Vec<impl Sized>) -> <Vec<impl Sized> as IntoIterator>::IntoIter {<Vec<impl Sized> as IntoIterator>::into_iter}, val: Value(<ZST>) }
+    }
+
+    bb1: {
+        StorageLive(_3);                 // scope 0 at $DIR/loops.rs:+1:14: +1:15
+        _3 = move _2;                    // scope 0 at $DIR/loops.rs:+1:14: +1:15
+        goto -> bb2;                     // scope 1 at $DIR/loops.rs:+1:5: +3:6
+    }
+
+    bb2: {
+        StorageLive(_5);                 // scope 1 at $DIR/loops.rs:+1:14: +1:15
+        _4 = &mut _3;                    // scope 1 at $DIR/loops.rs:+1:14: +1:15
+        _5 = <std::vec::IntoIter<impl Sized> as Iterator>::next(_4) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:15
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:26:14: 26:15
+                                         // + literal: Const { ty: for<'a> fn(&'a mut std::vec::IntoIter<impl Sized>) -> Option<<std::vec::IntoIter<impl Sized> as Iterator>::Item> {<std::vec::IntoIter<impl Sized> as Iterator>::next}, val: Value(<ZST>) }
+    }
+
+    bb3: {
+        _6 = discriminant(_5);           // scope 1 at $DIR/loops.rs:+1:14: +1:15
+        switchInt(move _6) -> [0: bb4, 1: bb6, otherwise: bb8]; // scope 1 at $DIR/loops.rs:+1:14: +1:15
+    }
+
+    bb4: {
+        StorageDead(_5);                 // scope 1 at $DIR/loops.rs:+3:5: +3:6
+        drop(_3) -> bb5;                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+    }
+
+    bb5: {
+        StorageDead(_3);                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+        StorageDead(_2);                 // scope 0 at $DIR/loops.rs:+3:5: +3:6
+        return;                          // scope 0 at $DIR/loops.rs:+4:2: +4:2
+    }
+
+    bb6: {
+        _7 = move ((_5 as Some).0: impl Sized); // scope 1 at $DIR/loops.rs:+1:9: +1:10
+        _8 = opaque::<impl Sized>(move _7) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18
+                                         // mir::Constant
+                                         // + span: $DIR/loops.rs:27:9: 27:15
+                                         // + literal: Const { ty: fn(impl Sized) {opaque::<impl Sized>}, val: Value(<ZST>) }
+    }
+
+    bb7: {
+        StorageDead(_5);                 // scope 1 at $DIR/loops.rs:+3:5: +3:6
+        goto -> bb2;                     // scope 1 at $DIR/loops.rs:+1:5: +3:6
+    }
+
+    bb8: {
+        unreachable;                     // scope 1 at $DIR/loops.rs:+1:14: +1:15
+    }
+
+    bb9 (cleanup): {
+        drop(_3) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/loops.rs:+3:5: +3:6
+    }
+
+    bb10 (cleanup): {
+        resume;                          // scope 0 at $DIR/loops.rs:+0:1: +4:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_filter.rs b/tests/mir-opt/pre-codegen/slice_filter.rs
new file mode 100644
index 00000000000..aba951acdd0
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_filter.rs
@@ -0,0 +1,15 @@
+// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
+// ignore-debug: standard library debug assertions add a panic that breaks this optimization
+
+#![crate_type = "lib"]
+
+pub fn variant_a(input: &[(usize, usize, usize, usize)]) -> usize {
+    input.iter().filter(|(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
+}
+
+pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize {
+    input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
+}
+
+// EMIT_MIR slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
+// EMIT_MIR slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
new file mode 100644
index 00000000000..91c8f299fdb
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
@@ -0,0 +1,228 @@
+// MIR for `variant_a::{closure#0}` after PreCodegen
+
+fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2: &&(usize, usize, usize, usize)) -> bool {
+    let mut _0: bool;                    // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
+    let mut _3: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+    let _4: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+    let mut _5: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+    let _6: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+    let mut _7: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+    let _8: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+    let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+    let _10: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+    let mut _11: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41
+    let _12: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
+    let mut _13: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
+    let mut _18: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
+    let mut _19: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51
+    let _20: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
+    let mut _21: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
+    let mut _26: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
+    let mut _27: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
+    let mut _28: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61
+    let _29: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
+    let mut _30: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
+    let mut _35: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
+    let mut _36: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
+    let mut _37: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71
+    let _38: &usize;                     // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+    let mut _39: &&usize;                // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+    let mut _44: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
+    scope 1 {
+        debug a => _4;                   // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
+        debug b => _6;                   // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
+        debug c => _8;                   // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
+        debug d => _10;                  // 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:7:40: 7:46
+            debug self => _11;           // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            debug other => _13;          // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            let mut _14: &usize;         // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            let mut _15: &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 => _14;       // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                debug other => _15;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                let mut _16: usize;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                let mut _17: 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:7:60: 7:66
+            debug self => _28;           // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            debug other => _30;          // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            let mut _31: &usize;         // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            let mut _32: &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 => _31;       // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                debug other => _32;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                let mut _33: usize;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                let mut _34: 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:7:50: 7:56
+            debug self => _19;           // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            debug other => _21;          // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            let mut _22: &usize;         // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            let mut _23: &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 => _22;       // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                debug other => _23;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                let mut _24: usize;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                let mut _25: 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:7:70: 7:76
+            debug self => _37;           // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            debug other => _39;          // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+            let mut _40: &usize;         // 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
+            scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
+                debug self => _40;       // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                debug other => _41;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+                let mut _42: usize;      // 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
+            }
+        }
+    }
+
+    bb0: {
+        StorageLive(_4);                 // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+        _3 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+        _4 = &((*_3).0: usize);          // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+        StorageLive(_6);                 // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+        _5 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+        _6 = &((*_5).1: usize);          // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+        StorageLive(_8);                 // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+        _7 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+        _8 = &((*_7).2: usize);          // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+        StorageLive(_10);                // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+        _9 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+        _10 = &((*_9).3: usize);         // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+        StorageLive(_27);                // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+        StorageLive(_18);                // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
+        StorageLive(_11);                // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
+        _11 = &_4;                       // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
+        StorageLive(_13);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+        StorageLive(_12);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+        _12 = _8;                        // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+        _13 = &_12;                      // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+        _14 = deref_copy (*_11);         // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _15 = deref_copy (*_13);         // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageLive(_16);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _16 = (*_14);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageLive(_17);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _17 = (*_15);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _18 = Le(move _16, move _17);    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_17);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_16);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+        StorageDead(_13);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+        StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+        switchInt(move _18) -> [0: bb1, otherwise: bb2]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+    }
+
+    bb1: {
+        StorageDead(_26);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        StorageDead(_18);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+    }
+
+    bb2: {
+        StorageLive(_26);                // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
+        StorageLive(_19);                // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
+        _19 = &_10;                      // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
+        StorageLive(_21);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        StorageLive(_20);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        _20 = _6;                        // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        _21 = &_20;                      // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        _22 = deref_copy (*_19);         // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _23 = deref_copy (*_21);         // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageLive(_24);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _24 = (*_22);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageLive(_25);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _25 = (*_23);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _26 = Le(move _24, move _25);    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_25);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_24);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_20);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        StorageDead(_21);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        StorageDead(_19);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        _27 = move _26;                  // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+        StorageDead(_26);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        StorageDead(_18);                // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+        switchInt(move _27) -> [0: bb3, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+    }
+
+    bb3: {
+        StorageLive(_36);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+        StorageLive(_35);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
+        StorageLive(_28);                // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
+        _28 = &_8;                       // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
+        StorageLive(_30);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+        StorageLive(_29);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+        _29 = _4;                        // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+        _30 = &_29;                      // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+        _31 = deref_copy (*_28);         // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _32 = deref_copy (*_30);         // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageLive(_33);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _33 = (*_31);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageLive(_34);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _34 = (*_32);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _35 = Le(move _33, move _34);    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_34);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_33);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_29);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+        StorageDead(_30);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+        StorageDead(_28);                // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+        switchInt(move _35) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+    }
+
+    bb4: {
+        _36 = const false;               // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+        goto -> bb6;                     // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+    }
+
+    bb5: {
+        StorageLive(_44);                // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
+        StorageLive(_37);                // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
+        _37 = &_6;                       // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
+        StorageLive(_39);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageLive(_38);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        _38 = _10;                       // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        _39 = &_38;                      // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        _40 = deref_copy (*_37);         // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _41 = deref_copy (*_39);         // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageLive(_42);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        _42 = (*_40);                    // scope 9 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
+        _44 = Le(move _42, move _43);    // 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(_42);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+        StorageDead(_38);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageDead(_39);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageDead(_37);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        _36 = move _44;                  // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+        goto -> bb6;                     // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+    }
+
+    bb6: {
+        StorageDead(_44);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageDead(_35);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        _0 = move _36;                   // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+        goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+    }
+
+    bb7: {
+        _0 = const true;                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+        goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+    }
+
+    bb8: {
+        StorageDead(_36);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageDead(_27);                // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageDead(_10);                // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageDead(_8);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageDead(_6);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+        StorageDead(_4);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+        return;                          // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
new file mode 100644
index 00000000000..9f5fe95a8b4
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
@@ -0,0 +1,92 @@
+// MIR for `variant_b::{closure#0}` after PreCodegen
+
+fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41], _2: &&(usize, usize, usize, usize)) -> bool {
+    let mut _0: bool;                    // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42
+    let mut _3: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
+    let _4: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
+    let mut _5: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
+    let _6: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
+    let mut _7: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
+    let _8: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
+    let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
+    let _10: usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
+    let mut _11: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48
+    let mut _12: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58
+    let mut _13: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58
+    let mut _14: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68
+    let mut _15: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78
+    let mut _16: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78
+    scope 1 {
+        debug a => _4;                   // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30
+        debug b => _6;                   // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33
+        debug c => _8;                   // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36
+        debug d => _10;                  // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39
+    }
+
+    bb0: {
+        _3 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
+        _4 = ((*_3).0: usize);           // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
+        _5 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
+        _6 = ((*_5).1: usize);           // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
+        _7 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
+        _8 = ((*_7).2: usize);           // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
+        _9 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
+        _10 = ((*_9).3: usize);          // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
+        StorageLive(_13);                // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+        StorageLive(_11);                // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
+        _11 = Le(_4, _8);                // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
+        switchInt(move _11) -> [0: bb1, otherwise: bb2]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+    }
+
+    bb1: {
+        StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
+        StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
+        goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+    }
+
+    bb2: {
+        StorageLive(_12);                // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
+        _12 = Le(_10, _6);               // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
+        _13 = move _12;                  // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+        StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
+        StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
+        switchInt(move _13) -> [0: bb3, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+    }
+
+    bb3: {
+        StorageLive(_15);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+        StorageLive(_14);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
+        _14 = Le(_8, _4);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
+        switchInt(move _14) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+    }
+
+    bb4: {
+        _15 = const false;               // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+        goto -> bb6;                     // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+    }
+
+    bb5: {
+        StorageLive(_16);                // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
+        _16 = Le(_6, _10);               // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
+        _15 = move _16;                  // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+        goto -> bb6;                     // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+    }
+
+    bb6: {
+        StorageDead(_16);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
+        StorageDead(_14);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
+        _0 = move _15;                   // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+        goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+    }
+
+    bb7: {
+        _0 = const true;                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+        goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+    }
+
+    bb8: {
+        StorageDead(_15);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
+        StorageDead(_13);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
+        return;                          // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir
new file mode 100644
index 00000000000..4dd11c1e529
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir
@@ -0,0 +1,213 @@
+// MIR for `enumerated_loop` after PreCodegen
+
+fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
+    debug slice => _1;                   // in scope 0 at $DIR/slice_iter.rs:+0:31: +0:36
+    debug f => _2;                       // in scope 0 at $DIR/slice_iter.rs:+0:47: +0:48
+    let mut _0: ();                      // return place in scope 0 at $DIR/slice_iter.rs:+0:70: +0:70
+    let mut _13: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:31
+    let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43
+    let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43
+    let mut _16: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43
+    let mut _17: std::option::Option<(usize, &T)>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43
+    let mut _18: isize;                  // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6
+    let mut _21: &impl Fn(usize, &T);    // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10
+    let mut _22: (usize, &T);            // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:16
+    let _23: ();                         // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43
+    scope 1 {
+        debug iter => _15;               // in scope 1 at $DIR/slice_iter.rs:+1:19: +1:43
+        let _19: usize;                  // in scope 1 at $DIR/slice_iter.rs:+1:10: +1:11
+        let _20: &T;                     // in scope 1 at $DIR/slice_iter.rs:+1:13: +1:14
+        scope 2 {
+            debug i => _19;              // in scope 2 at $DIR/slice_iter.rs:+1:10: +1:11
+            debug x => _20;              // in scope 2 at $DIR/slice_iter.rs:+1:13: +1:14
+        }
+    }
+    scope 3 (inlined core::slice::<impl [T]>::iter) { // at $DIR/slice_iter.rs:42:25: 42:31
+        debug self => _1;                // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+            debug slice => _1;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let _4: *const T;            // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _5: bool;            // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _6: usize;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _8: usize;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _9: *mut T;          // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _11: std::ptr::NonNull<T>; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _12: *const T;       // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            scope 5 {
+                debug ptr => _4;         // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                scope 6 {
+                    let _7: *const T;    // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                    scope 7 {
+                        debug end => _7; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        scope 13 (inlined NonNull::<T>::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                            debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                            let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                            scope 14 {
+                                scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                                    debug ptr => _9; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                                    scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                                        debug self => _9; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                        let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                        scope 17 {
+                                            scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                    debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                    scope 20 {
+                                                        scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                            debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    scope 9 (inlined invalid::<T>) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        debug addr => _8; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+                        scope 10 {
+                        }
+                    }
+                    scope 11 (inlined ptr::const_ptr::<impl *const T>::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+                        debug count => _6; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+                        scope 12 {
+                        }
+                    }
+                }
+            }
+            scope 8 (inlined core::slice::<impl [T]>::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                debug self => _1;        // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+                let mut _3: *const [T];  // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+            }
+        }
+    }
+    scope 22 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) { // at $DIR/slice_iter.rs:42:32: 42:43
+        debug self => _13;               // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+        scope 23 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+            debug iter => _13;           // in scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL
+        }
+    }
+    scope 24 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:42:19: 42:43
+        debug self => _14;               // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    }
+
+    bb0: {
+        StorageLive(_13);                // scope 0 at $DIR/slice_iter.rs:+1:19: +1:31
+        StorageLive(_4);                 // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_3);                 // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _3 = &raw const (*_1);           // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _4 = move _3 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageDead(_3);                 // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_7);                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_5);                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _5 = const _;                    // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+    }
+
+    bb1: {
+        StorageLive(_6);                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _6 = Len((*_1));                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _7 = Offset(_4, _6);             // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+        StorageDead(_6);                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        goto -> bb3;                     // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+    }
+
+    bb2: {
+        StorageLive(_8);                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _8 = Len((*_1));                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _7 = _8 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+        StorageDead(_8);                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        goto -> bb3;                     // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+    }
+
+    bb3: {
+        StorageDead(_5);                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_11);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_9);                 // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _9 = _4 as *mut T (PtrToPtr);    // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_10);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_24);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+        _11 = NonNull::<T> { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+        StorageDead(_24);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_10);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_9);                 // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_12);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _12 = _7;                        // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: no-location
+                                         // + literal: Const { ty: PhantomData<&T>, val: Value(<ZST>) }
+                                         // adt
+                                         // + user_ty: UserType(1)
+        StorageDead(_12);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_11);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_7);                 // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_4);                 // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _14 = Enumerate::<std::slice::Iter<'_, T>> { iter: move _13, count: const 0_usize }; // scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL
+        StorageDead(_13);                // scope 0 at $DIR/slice_iter.rs:+1:42: +1:43
+        StorageLive(_15);                // scope 0 at $DIR/slice_iter.rs:+1:19: +1:43
+        _15 = move _14;                  // scope 0 at $DIR/slice_iter.rs:+1:19: +1:43
+        goto -> bb4;                     // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
+    }
+
+    bb4: {
+        StorageLive(_17);                // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43
+        _16 = &mut _15;                  // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43
+        _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(_16) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43
+                                         // mir::Constant
+                                         // + span: $DIR/slice_iter.rs:42:19: 42:43
+                                         // + literal: Const { ty: for<'a> fn(&'a mut Enumerate<std::slice::Iter<'_, T>>) -> Option<<Enumerate<std::slice::Iter<'_, T>> as Iterator>::Item> {<Enumerate<std::slice::Iter<'_, T>> as Iterator>::next}, val: Value(<ZST>) }
+    }
+
+    bb5: {
+        _18 = discriminant(_17);         // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43
+        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43
+    }
+
+    bb6: {
+        StorageDead(_17);                // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
+        StorageDead(_15);                // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6
+        drop(_2) -> bb7;                 // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
+    }
+
+    bb7: {
+        return;                          // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2
+    }
+
+    bb8: {
+        _19 = (((_17 as Some).0: (usize, &T)).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:10: +1:11
+        _20 = (((_17 as Some).0: (usize, &T)).1: &T); // scope 1 at $DIR/slice_iter.rs:+1:13: +1:14
+        StorageLive(_21);                // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
+        _21 = &_2;                       // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
+        StorageLive(_22);                // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16
+        _22 = (_19, _20);                // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16
+        _23 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16
+                                         // mir::Constant
+                                         // + span: $DIR/slice_iter.rs:43:9: 43:10
+                                         // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> <impl Fn(usize, &T) as FnOnce<(usize, &T)>>::Output {<impl Fn(usize, &T) as Fn<(usize, &T)>>::call}, val: Value(<ZST>) }
+    }
+
+    bb9: {
+        StorageDead(_22);                // scope 2 at $DIR/slice_iter.rs:+2:15: +2:16
+        StorageDead(_21);                // scope 2 at $DIR/slice_iter.rs:+2:15: +2:16
+        StorageDead(_17);                // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
+        goto -> bb4;                     // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
+    }
+
+    bb10: {
+        unreachable;                     // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43
+    }
+
+    bb11 (cleanup): {
+        drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
+    }
+
+    bb12 (cleanup): {
+        resume;                          // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir
new file mode 100644
index 00000000000..ca7a4a64f45
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir
@@ -0,0 +1,155 @@
+// MIR for `range_loop` after PreCodegen
+
+fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
+    debug slice => _1;                   // in scope 0 at $DIR/slice_iter.rs:+0:26: +0:31
+    debug f => _2;                       // in scope 0 at $DIR/slice_iter.rs:+0:42: +0:43
+    let mut _0: ();                      // return place in scope 0 at $DIR/slice_iter.rs:+0:65: +0:65
+    let mut _3: usize;                   // in scope 0 at $DIR/slice_iter.rs:+1:17: +1:28
+    let mut _4: std::ops::Range<usize>;  // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28
+    let mut _5: std::ops::Range<usize>;  // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28
+    let mut _6: &mut std::ops::Range<usize>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28
+    let mut _10: std::option::Option<usize>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28
+    let mut _13: isize;                  // in scope 0 at $DIR/slice_iter.rs:+1:5: +4:6
+    let mut _15: usize;                  // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26
+    let mut _16: bool;                   // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26
+    let mut _18: &impl Fn(usize, &T);    // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:10
+    let mut _19: (usize, &T);            // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:16
+    let _20: ();                         // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28
+    scope 1 {
+        debug iter => _5;                // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:28
+        let _14: usize;                  // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
+        scope 2 {
+            debug i => _14;              // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10
+            let _17: &T;                 // in scope 2 at $DIR/slice_iter.rs:+2:13: +2:14
+            scope 3 {
+                debug x => _17;          // in scope 3 at $DIR/slice_iter.rs:+2:13: +2:14
+            }
+        }
+        scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { // at $DIR/slice_iter.rs:49:14: 49:28
+            debug self => _6;            // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+            scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                debug self => _6;        // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let mut _7: &usize;      // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let mut _8: &usize;      // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let mut _9: bool;        // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let _11: usize;          // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                let mut _12: usize;      // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                scope 7 {
+                    debug old => _11;    // in scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                    scope 8 {
+                    }
+                }
+            }
+        }
+    }
+    scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:49:14: 49:28
+        debug self => _4;                // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    }
+
+    bb0: {
+        StorageLive(_3);                 // scope 0 at $DIR/slice_iter.rs:+1:17: +1:28
+        _3 = Len((*_1));                 // scope 0 at $DIR/slice_iter.rs:+1:17: +1:28
+        _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 }; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28
+        StorageDead(_3);                 // scope 0 at $DIR/slice_iter.rs:+1:27: +1:28
+        StorageLive(_5);                 // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28
+        _5 = move _4;                    // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28
+        goto -> bb1;                     // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6
+    }
+
+    bb1: {
+        StorageLive(_10);                // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28
+        _6 = &mut _5;                    // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28
+        StorageLive(_11);                // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_9);                 // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_7);                 // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _7 = &((*_6).0: usize);          // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_8);                 // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _8 = &((*_6).1: usize);          // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _9 = <usize as PartialOrd>::lt(move _7, move _8) -> [return: bb2, unwind: bb13]; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // + literal: Const { ty: for<'a, 'b> fn(&'a usize, &'b usize) -> bool {<usize as PartialOrd>::lt}, val: Value(<ZST>) }
+    }
+
+    bb2: {
+        StorageDead(_8);                 // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageDead(_7);                 // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        switchInt(move _9) -> [0: bb3, otherwise: bb4]; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+    }
+
+    bb3: {
+        _10 = Option::<usize>::None;     // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        goto -> bb6;                     // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+    }
+
+    bb4: {
+        _11 = ((*_6).0: usize);          // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageLive(_12);                // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _12 = <usize as Step>::forward_unchecked(_11, const 1_usize) -> [return: bb5, unwind: bb13]; // scope 8 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+                                         // + literal: Const { ty: unsafe fn(usize, usize) -> usize {<usize as Step>::forward_unchecked}, val: Value(<ZST>) }
+    }
+
+    bb5: {
+        ((*_6).0: usize) = move _12;     // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageDead(_12);                // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _10 = Option::<usize>::Some(_11); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        goto -> bb6;                     // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+    }
+
+    bb6: {
+        StorageDead(_9);                 // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        StorageDead(_11);                // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+        _13 = discriminant(_10);         // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28
+        switchInt(move _13) -> [0: bb7, 1: bb9, otherwise: bb12]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28
+    }
+
+    bb7: {
+        StorageDead(_10);                // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6
+        StorageDead(_5);                 // scope 0 at $DIR/slice_iter.rs:+4:5: +4:6
+        drop(_2) -> bb8;                 // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2
+    }
+
+    bb8: {
+        return;                          // scope 0 at $DIR/slice_iter.rs:+5:2: +5:2
+    }
+
+    bb9: {
+        _14 = ((_10 as Some).0: usize);  // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
+        _15 = Len((*_1));                // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26
+        _16 = Lt(_14, _15);              // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26
+        assert(move _16, "index out of bounds: the length is {} but the index is {}", move _15, _14) -> [success: bb10, unwind: bb13]; // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26
+    }
+
+    bb10: {
+        _17 = &(*_1)[_14];               // scope 2 at $DIR/slice_iter.rs:+2:17: +2:26
+        StorageLive(_18);                // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10
+        _18 = &_2;                       // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10
+        StorageLive(_19);                // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16
+        _19 = (_14, _17);                // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16
+        _20 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _18, move _19) -> [return: bb11, unwind: bb13]; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16
+                                         // mir::Constant
+                                         // + span: $DIR/slice_iter.rs:51:9: 51:10
+                                         // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> <impl Fn(usize, &T) as FnOnce<(usize, &T)>>::Output {<impl Fn(usize, &T) as Fn<(usize, &T)>>::call}, val: Value(<ZST>) }
+    }
+
+    bb11: {
+        StorageDead(_19);                // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16
+        StorageDead(_18);                // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16
+        StorageDead(_10);                // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6
+        goto -> bb1;                     // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6
+    }
+
+    bb12: {
+        unreachable;                     // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28
+    }
+
+    bb13 (cleanup): {
+        drop(_2) -> [return: bb14, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2
+    }
+
+    bb14 (cleanup): {
+        resume;                          // scope 0 at $DIR/slice_iter.rs:+0:1: +5:2
+    }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs
index ca423ca55e6..a1cd85e753f 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.rs
+++ b/tests/mir-opt/pre-codegen/slice_iter.rs
@@ -36,3 +36,18 @@ pub fn reverse_loop<'a, T>(slice: &'a [T], f: impl Fn(&T)) {
         f(x)
     }
 }
+
+// EMIT_MIR slice_iter.enumerated_loop.PreCodegen.after.mir
+pub fn enumerated_loop<'a, T>(slice: &'a [T], f: impl Fn(usize, &T)) {
+    for (i, x) in slice.iter().enumerate() {
+        f(i, x)
+    }
+}
+
+// EMIT_MIR slice_iter.range_loop.PreCodegen.after.mir
+pub fn range_loop<'a, T>(slice: &'a [T], f: impl Fn(usize, &T)) {
+    for i in 0..slice.len() {
+        let x = &slice[i];
+        f(i, x)
+    }
+}
diff --git a/tests/mir-opt/slice_filter.rs b/tests/mir-opt/slice_filter.rs
deleted file mode 100644
index be32f40f132..00000000000
--- a/tests/mir-opt/slice_filter.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-fn main() {
-    let input = vec![];
-    let _variant_a_result = variant_a(&input);
-    let _variant_b_result = variant_b(&input);
-}
-
-pub fn variant_a(input: &[(usize, usize, usize, usize)]) -> usize {
-    input.iter().filter(|(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
-}
-
-pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize {
-    input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
-}
-
-// EMIT_MIR slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
-// EMIT_MIR slice_filter.variant_a-{closure#0}.CopyProp.diff
-// EMIT_MIR slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
-// EMIT_MIR slice_filter.variant_b-{closure#0}.CopyProp.diff
-// EMIT_MIR slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
-// EMIT_MIR slice_filter.variant_b-{closure#0}.DestinationPropagation.diff
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff
deleted file mode 100644
index 60e5056c7a9..00000000000
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff
+++ /dev/null
@@ -1,279 +0,0 @@
-- // MIR for `variant_a::{closure#0}` before CopyProp
-+ // MIR for `variant_a::{closure#0}` after CopyProp
-  
-  fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool {
-      let mut _0: bool;                    // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
-      let _3: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
-      let _4: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
-      let _5: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
-      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 mut _31: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _32: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _37: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _38: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _43: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _44: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _49: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _50: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      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
-          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
-              scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
--                 debug self => _31;       // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
--                 debug other => _32;      // in scope 3 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 _33: usize;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _34: 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 _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
--                 debug self => _37;       // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
--                 debug other => _38;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug self => _35;       // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug other => _36;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _39: usize;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _40: 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 _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
--                 debug self => _43;       // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
--                 debug other => _44;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug self => _41;       // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug other => _42;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _45: usize;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _46: 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 _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
--                 debug self => _49;       // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--                 debug other => _50;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug self => _47;       // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug other => _48;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _51: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _52: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              }
-          }
-      }
-  
-      bb0: {
-          StorageLive(_3);                 // 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
-          StorageLive(_4);                 // 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
-          StorageLive(_5);                 // 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
-          StorageLive(_6);                 // 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
-          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(_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
-          _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
--         StorageLive(_31);                // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _31 = _29;                       // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageLive(_32);                // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _32 = _30;                       // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_33);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _33 = (*_31);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _33 = (*_29);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_34);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _34 = (*_32);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _34 = (*_30);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _8 = Le(move _33, move _34);     // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          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(_32);                // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageDead(_31);                // scope 2 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
-          switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-      }
-  
-      bb1: {
-          _0 = const true;                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-      }
-  
-      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(_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
-          _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
--         StorageLive(_37);                // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _37 = _35;                       // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageLive(_38);                // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _38 = _36;                       // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_39);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _39 = (*_37);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _39 = (*_35);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_40);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _40 = (*_38);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _40 = (*_36);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _17 = Le(move _39, move _40);    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          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(_38);                // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageDead(_37);                // scope 4 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
-          switchInt(move _17) -> [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(_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
-          StorageDead(_4);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-          StorageDead(_3);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-          return;                          // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
-      }
-  
-      bb4: {
-          _7 = const false;                // 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
-          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(_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
-          _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
--         StorageLive(_43);                // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _43 = _41;                       // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageLive(_44);                // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _44 = _42;                       // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_45);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _45 = (*_43);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _45 = (*_41);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_46);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _46 = (*_44);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _46 = (*_42);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _12 = Le(move _45, move _46);    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          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(_44);                // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageDead(_43);                // scope 6 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
-          _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
-          switchInt(move _7) -> [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
-          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(_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
-          _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
--         StorageLive(_49);                // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _49 = _47;                       // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageLive(_50);                // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _50 = _48;                       // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_51);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _51 = (*_49);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _51 = (*_47);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_52);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _52 = (*_50);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _52 = (*_48);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _21 = Le(move _51, move _52);    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          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(_50);                // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         StorageDead(_49);                // scope 8 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
-          _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
-      }
-  
-      bb8: {
-          StorageDead(_21);                // 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
-          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}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
deleted file mode 100644
index afdcf57815f..00000000000
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
+++ /dev/null
@@ -1,165 +0,0 @@
-- // MIR for `variant_a::{closure#0}` before DestinationPropagation
-+ // MIR for `variant_a::{closure#0}` after DestinationPropagation
-  
-  fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool {
-      let mut _0: bool;                    // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
-      let mut _3: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
-      let mut _4: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
-      let mut _5: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
-      let mut _6: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
-      let mut _7: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
-      let mut _8: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
-      let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
-      let mut _10: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
-      let mut _11: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
-      let mut _12: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
-      scope 1 {
-          debug a => &((*_9).0: usize);    // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
-          debug b => &((*_10).1: usize);   // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
-          debug c => &((*_11).2: usize);   // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
-          debug d => &((*_12).3: usize);   // 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).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => &&((*_11).2: 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 => &((*_9).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug other => &((*_11).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _13: usize;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _14: 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 => &&((*_11).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => &&((*_9).0: 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 => &((*_11).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug other => &((*_9).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _15: usize;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _16: 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 => &&((*_12).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => &&((*_10).1: 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 => &((*_12).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug other => &((*_10).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _17: usize;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _18: 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 => &&((*_10).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              debug other => &&((*_12).3: 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 => &((*_10).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  debug other => &((*_12).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _19: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _20: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              }
-          }
-      }
-  
-      bb0: {
-          _9 = deref_copy (*_2);           // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
-          _10 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
-          _11 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
-          _12 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
--         StorageLive(_3);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-          StorageLive(_4);                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
-          StorageLive(_13);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _13 = ((*_9).0: usize);          // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_14);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _14 = ((*_11).2: usize);         // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _4 = Le(move _13, move _14);     // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_14);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_13);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          switchInt(move _4) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-      }
-  
-      bb1: {
-          _0 = const true;                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-      }
-  
-      bb2: {
--         StorageLive(_6);                 // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
-          StorageLive(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
-          StorageLive(_15);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _15 = ((*_11).2: usize);         // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_16);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _16 = ((*_9).0: usize);          // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _7 = Le(move _15, move _16);     // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_16);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_15);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          switchInt(move _7) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
-      }
-  
-      bb3: {
--         StorageDead(_6);                 // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
--         StorageDead(_3);                 // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-          return;                          // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
-      }
-  
-      bb4: {
--         StorageDead(_5);                 // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-          StorageDead(_4);                 // 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(_5);                 // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
-          StorageLive(_17);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _17 = ((*_12).3: usize);         // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_18);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _18 = ((*_10).1: usize);         // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _5 = Le(move _17, move _18);     // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_18);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_17);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _3 = move _5;                    // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
--         StorageDead(_5);                 // 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(_4);                 // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
--         switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-+         switchInt(move _5) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-      }
-  
-      bb6: {
--         _6 = 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(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
-          StorageLive(_19);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _19 = ((*_10).1: usize);         // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_20);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _20 = ((*_12).3: usize);         // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _8 = Le(move _19, move _20);     // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _0 = Le(move _19, move _20);     // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_20);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageDead(_19);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _6 = move _8;                    // 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(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-          StorageDead(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
--         _0 = move _6;                    // 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
deleted file mode 100644
index 2534eeef432..00000000000
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
+++ /dev/null
@@ -1,267 +0,0 @@
-- // MIR for `variant_a::{closure#0}` before ReferencePropagation
-+ // MIR for `variant_a::{closure#0}` after ReferencePropagation
-  
-  fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool {
-      let mut _0: bool;                    // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
-      let _3: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
-      let _4: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
-      let _5: &usize;                      // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
-      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 mut _31: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _32: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _37: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _38: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _43: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _44: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _49: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      let mut _50: &usize;                 // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
-      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 => &((*_25).0: usize);   // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
-+         debug b => &((*_26).1: usize);   // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
-+         debug c => &((*_27).2: usize);   // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
-+         debug d => &((*_28).3: usize);   // 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 => &&((*_25).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+             debug other => &&((*_27).2: usize); // 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
--                 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
-+                 debug self => &((*_25).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug other => &((*_27).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _33: usize;      // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _34: 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
-+             debug self => &&((*_27).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+             debug other => &&((*_25).0: usize); // 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
--                 debug self => _35;       // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
--                 debug other => _36;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug self => &((*_27).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug other => &((*_25).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _39: usize;      // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _40: 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
-+             debug self => &&((*_28).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+             debug other => &&((*_26).1: usize); // 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
--                 debug self => _41;       // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
--                 debug other => _42;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug self => &((*_28).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug other => &((*_26).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _45: usize;      // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _46: 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
-+             debug self => &&((*_26).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+             debug other => &&((*_28).3: usize); // 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
--                 debug self => _47;       // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--                 debug other => _48;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug self => &((*_26).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+                 debug other => &((*_28).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _51: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-                  let mut _52: usize;      // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-              }
-          }
-      }
-  
-      bb0: {
--         StorageLive(_3);                 // 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
--         StorageLive(_4);                 // 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
--         StorageLive(_5);                 // 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
--         StorageLive(_6);                 // 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
-          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(_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
--         _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
-          StorageLive(_33);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _33 = (*_29);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _33 = ((*_25).0: usize);         // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_34);                // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _34 = (*_30);                    // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _34 = ((*_27).2: usize);         // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _8 = Le(move _33, move _34);     // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          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
-          switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-      }
-  
-      bb1: {
-          _0 = const true;                 // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-      }
-  
-      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(_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
--         _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
-          StorageLive(_39);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _39 = (*_35);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _39 = ((*_27).2: usize);         // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_40);                // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _40 = (*_36);                    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _40 = ((*_25).0: usize);         // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _17 = Le(move _39, move _40);    // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          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
-          switchInt(move _17) -> [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(_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
--         StorageDead(_4);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
--         StorageDead(_3);                 // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-          return;                          // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
-      }
-  
-      bb4: {
-          _7 = const false;                // 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
-          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(_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
--         _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
-          StorageLive(_45);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _45 = (*_41);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _45 = ((*_28).3: usize);         // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_46);                // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _46 = (*_42);                    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _46 = ((*_26).1: usize);         // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _12 = Le(move _45, move _46);    // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          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
-          _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
-          switchInt(move _7) -> [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
-          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(_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
--         _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
-          StorageLive(_51);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _51 = (*_47);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _51 = ((*_26).1: usize);         // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          StorageLive(_52);                // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
--         _52 = (*_48);                    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+         _52 = ((*_28).3: usize);         // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          _21 = Le(move _51, move _52);    // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-          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
-          _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
-      }
-  
-      bb8: {
-          StorageDead(_21);                // 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
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-      }
-  }
-  
diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff
deleted file mode 100644
index 5e4bdbdfa2e..00000000000
--- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff
+++ /dev/null
@@ -1,139 +0,0 @@
-- // MIR for `variant_b::{closure#0}` before CopyProp
-+ // MIR for `variant_b::{closure#0}` after CopyProp
-  
-  fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool {
-      let mut _0: bool;                    // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42
-      let _3: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-      let _4: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-      let _5: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-      let _6: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-      let mut _7: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58
-      let mut _8: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48
-      let mut _9: usize;                   // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43
-      let mut _10: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48
-      let mut _11: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58
-      let mut _12: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53
-      let mut _13: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58
-      let mut _14: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78
-      let mut _15: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68
-      let mut _16: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63
-      let mut _17: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68
-      let mut _18: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78
-      let mut _19: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73
-      let mut _20: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
-      let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      scope 1 {
-          debug a => _3;                   // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30
-          debug b => _4;                   // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33
-          debug c => _5;                   // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36
-          debug d => _6;                   // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39
-      }
-  
-      bb0: {
--         StorageLive(_3);                 // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-          _21 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-          _3 = ((*_21).0: usize);          // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
--         StorageLive(_4);                 // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-          _22 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-          _4 = ((*_22).1: usize);          // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
--         StorageLive(_5);                 // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-          _23 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-          _5 = ((*_23).2: usize);          // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
--         StorageLive(_6);                 // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-          _24 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-          _6 = ((*_24).3: usize);          // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-          StorageLive(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-          StorageLive(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
--         StorageLive(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:43
--         _9 = _3;                         // scope 1 at $DIR/slice_filter.rs:+0:42: +0:43
--         StorageLive(_10);                // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48
--         _10 = _5;                        // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48
--         _8 = Le(move _9, move _10);      // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
--         StorageDead(_10);                // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48
--         StorageDead(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48
-+         _8 = Le(_3, _5);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
-          switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-      }
-  
-      bb1: {
-          _0 = const true;                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  
-      bb2: {
-          StorageLive(_14);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          StorageLive(_15);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
--         StorageLive(_16);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:63
--         _16 = _5;                        // scope 1 at $DIR/slice_filter.rs:+0:62: +0:63
--         StorageLive(_17);                // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68
--         _17 = _3;                        // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68
--         _15 = Le(move _16, move _17);    // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
--         StorageDead(_17);                // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68
--         StorageDead(_16);                // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68
-+         _15 = Le(_5, _3);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
-          switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb3: {
-          StorageDead(_14);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          StorageDead(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
--         StorageDead(_6);                 // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
--         StorageDead(_5);                 // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
--         StorageDead(_4);                 // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
--         StorageDead(_3);                 // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
-          return;                          // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78
-      }
-  
-      bb4: {
-          _7 = const false;                // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-          StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          goto -> bb2;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-      }
-  
-      bb5: {
-          StorageLive(_11);                // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
--         StorageLive(_12);                // scope 1 at $DIR/slice_filter.rs:+0:52: +0:53
--         _12 = _6;                        // scope 1 at $DIR/slice_filter.rs:+0:52: +0:53
--         StorageLive(_13);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
--         _13 = _4;                        // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
--         _11 = Le(move _12, move _13);    // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
--         StorageDead(_13);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
--         StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-+         _11 = Le(_6, _4);                // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-          _7 = move _11;                   // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-          StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  
-      bb6: {
-          _14 = const false;               // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb7: {
-          StorageLive(_18);                // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
--         StorageLive(_19);                // scope 1 at $DIR/slice_filter.rs:+0:72: +0:73
--         _19 = _4;                        // scope 1 at $DIR/slice_filter.rs:+0:72: +0:73
--         StorageLive(_20);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
--         _20 = _6;                        // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
--         _18 = Le(move _19, move _20);    // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
--         StorageDead(_20);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
--         StorageDead(_19);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-+         _18 = Le(_4, _6);                // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-          _14 = move _18;                  // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb8: {
-          StorageDead(_18);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          StorageDead(_15);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          _0 = move _14;                   // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  }
-  
diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff
deleted file mode 100644
index 45af6600cd4..00000000000
--- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff
+++ /dev/null
@@ -1,109 +0,0 @@
-- // MIR for `variant_b::{closure#0}` before DestinationPropagation
-+ // MIR for `variant_b::{closure#0}` after DestinationPropagation
-  
-  fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool {
-      let mut _0: bool;                    // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42
-      let _3: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-      let _4: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-      let _5: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-      let _6: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-      let mut _7: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58
-      let mut _8: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48
-      let mut _9: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58
-      let mut _10: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78
-      let mut _11: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68
-      let mut _12: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78
-      let mut _13: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _14: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _15: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _16: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      scope 1 {
-          debug a => _3;                   // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30
-          debug b => _4;                   // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33
-          debug c => _5;                   // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36
-          debug d => _6;                   // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39
-      }
-  
-      bb0: {
-          _13 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-          _3 = ((*_13).0: usize);          // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-          _14 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-          _4 = ((*_14).1: usize);          // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-          _15 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-          _5 = ((*_15).2: usize);          // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-          _16 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-          _6 = ((*_16).3: usize);          // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
--         StorageLive(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-          StorageLive(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
-          _8 = Le(_3, _5);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
-          switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-      }
-  
-      bb1: {
-          _0 = const true;                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  
-      bb2: {
--         StorageLive(_10);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          StorageLive(_11);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
-          _11 = Le(_5, _3);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
-          switchInt(move _11) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb3: {
--         StorageDead(_10);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
--         StorageDead(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          return;                          // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78
-      }
-  
-      bb4: {
--         StorageDead(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          goto -> bb2;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-      }
-  
-      bb5: {
--         StorageLive(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-          _9 = Le(_6, _4);                 // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
--         _7 = move _9;                    // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
--         StorageDead(_9);                 // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
--         switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-+         switchInt(move _9) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  
-      bb6: {
--         _10 = const false;               // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-+         _0 = const false;                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb7: {
--         StorageLive(_12);                // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
--         _12 = Le(_4, _6);                // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
--         _10 = move _12;                  // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-+         _0 = Le(_4, _6);                 // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb8: {
--         StorageDead(_12);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
--         _0 = move _10;                   // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-+         nop;                             // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  }
-  
diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
deleted file mode 100644
index d1241c6b024..00000000000
--- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
+++ /dev/null
@@ -1,103 +0,0 @@
-- // MIR for `variant_b::{closure#0}` before ReferencePropagation
-+ // MIR for `variant_b::{closure#0}` after ReferencePropagation
-  
-  fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool {
-      let mut _0: bool;                    // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42
-      let _3: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-      let _4: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-      let _5: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-      let _6: usize;                       // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-      let mut _7: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58
-      let mut _8: bool;                    // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48
-      let mut _9: usize;                   // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43
-      let mut _10: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48
-      let mut _11: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58
-      let mut _12: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53
-      let mut _13: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58
-      let mut _14: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78
-      let mut _15: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68
-      let mut _16: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63
-      let mut _17: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68
-      let mut _18: bool;                   // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78
-      let mut _19: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73
-      let mut _20: usize;                  // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
-      let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
-      scope 1 {
-          debug a => _3;                   // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30
-          debug b => _4;                   // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33
-          debug c => _5;                   // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36
-          debug d => _6;                   // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39
-      }
-  
-      bb0: {
-          _21 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-          _3 = ((*_21).0: usize);          // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-          _22 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-          _4 = ((*_22).1: usize);          // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-          _23 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-          _5 = ((*_23).2: usize);          // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-          _24 = deref_copy (*_2);          // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-          _6 = ((*_24).3: usize);          // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-          StorageLive(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-          StorageLive(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
-          _8 = Le(_3, _5);                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
-          switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-      }
-  
-      bb1: {
-          _0 = const true;                 // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  
-      bb2: {
-          StorageLive(_14);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          StorageLive(_15);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
-          _15 = Le(_5, _3);                // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
-          switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb3: {
-          StorageDead(_14);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          StorageDead(_7);                 // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          return;                          // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78
-      }
-  
-      bb4: {
-          _7 = const false;                // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-          StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          goto -> bb2;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-      }
-  
-      bb5: {
-          StorageLive(_11);                // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-          _11 = Le(_6, _4);                // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-          _7 = move _11;                   // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-          StorageDead(_11);                // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          StorageDead(_8);                 // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-          switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  
-      bb6: {
-          _14 = const false;               // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb7: {
-          StorageLive(_18);                // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-          _18 = Le(_4, _6);                // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-          _14 = move _18;                  // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-          goto -> bb8;                     // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-      }
-  
-      bb8: {
-          StorageDead(_18);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          StorageDead(_15);                // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-          _0 = move _14;                   // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-          goto -> bb3;                     // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-      }
-  }
-