about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-02-22 12:14:23 +0000
committerbors <bors@rust-lang.org>2021-02-22 12:14:23 +0000
commit15598a83db88ec7a32ea18a44dd6309f32edc07e (patch)
treec94dd4ec1eaf1dda253a132d8704e9b21624487c /src
parent8a9f7862bcfa5870a34bb54f77a03c73d1db5c37 (diff)
parent2d1e0adfe9fbe3e0ebdac3ba80b9781cb4f800f7 (diff)
downloadrust-15598a83db88ec7a32ea18a44dd6309f32edc07e.tar.gz
rust-15598a83db88ec7a32ea18a44dd6309f32edc07e.zip
Auto merge of #77551 - simonvandel:extend-simplify-branch-same, r=oli-obk
MIR-OPT: Pass to deduplicate blocks

This pass finds basic blocks that are completely equal,
and replaces all uses with just one of them.

```bash
$ RUSTC_LOG=rustc_mir::transform::deduplicate_blocks ./x.py build --stage 2 | grep "SUCCESS: Replacing: " > log
...
$ cat log | wc -l
23875
```
Diffstat (limited to 'src')
-rw-r--r--src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff101
-rw-r--r--src/test/mir-opt/deduplicate_blocks.rs13
-rw-r--r--src/test/mir-opt/inline/inline_diverging.h.Inline.diff2
-rw-r--r--src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir70
-rw-r--r--src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff39
-rw-r--r--src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff39
-rw-r--r--src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff36
-rw-r--r--src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff36
-rw-r--r--src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff113
-rw-r--r--src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff113
-rw-r--r--src/test/mir-opt/not_equal_false.opt.InstCombine.diff22
11 files changed, 337 insertions, 247 deletions
diff --git a/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff b/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff
new file mode 100644
index 00000000000..b6e4469e870
--- /dev/null
+++ b/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff
@@ -0,0 +1,101 @@
+- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks
++ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks
+  
+  fn is_line_doc_comment_2(_1: &str) -> bool {
+      debug s => _1;                       // in scope 0 at $DIR/deduplicate_blocks.rs:2:36: 2:37
+      let mut _0: bool;                    // return place in scope 0 at $DIR/deduplicate_blocks.rs:2:48: 2:52
+      let mut _2: &[u8];                   // in scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
+      let mut _3: usize;                   // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
+      let mut _4: bool;                    // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
+      let mut _5: usize;                   // in scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37
+      let mut _6: bool;                    // in scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37
+      scope 1 (inlined core::str::<impl str>::as_bytes) { // at $DIR/deduplicate_blocks.rs:3:11: 3:23
+          debug self => _7;                // in scope 1 at $DIR/deduplicate_blocks.rs:3:11: 3:23
+          let mut _7: &str;                // in scope 1 at $DIR/deduplicate_blocks.rs:3:11: 3:23
+          scope 2 {
+          }
+      }
+  
+      bb0: {
+          StorageLive(_2);                 // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23
+          _7 = _1;                         // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:12
+-         _2 = transmute::<&str, &[u8]>(move _7) -> bb14; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23
++         _2 = transmute::<&str, &[u8]>(move _7) -> bb12; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23
+                                           // mir::Constant
+                                           // + span: $DIR/deduplicate_blocks.rs:3:11: 3:23
+                                           // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&str) -> &[u8] {std::intrinsics::transmute::<&str, &[u8]>}, val: Value(Scalar(<ZST>)) }
+      }
+  
+      bb1: {
+          switchInt((*_2)[0 of 4]) -> [47_u8: bb2, otherwise: bb5]; // scope 0 at $DIR/deduplicate_blocks.rs:4:10: 4:14
+      }
+  
+      bb2: {
+          switchInt((*_2)[1 of 4]) -> [47_u8: bb3, otherwise: bb5]; // scope 0 at $DIR/deduplicate_blocks.rs:4:16: 4:20
+      }
+  
+      bb3: {
+          switchInt((*_2)[2 of 4]) -> [47_u8: bb4, otherwise: bb5]; // scope 0 at $DIR/deduplicate_blocks.rs:4:22: 4:26
+      }
+  
+      bb4: {
+-         switchInt((*_2)[3 of 4]) -> [47_u8: bb10, otherwise: bb5]; // scope 0 at $DIR/deduplicate_blocks.rs:4:28: 4:32
++         switchInt((*_2)[3 of 4]) -> [47_u8: bb9, otherwise: bb5]; // scope 0 at $DIR/deduplicate_blocks.rs:4:28: 4:32
+      }
+  
+      bb5: {
+          _3 = Len((*_2));                 // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
+          _4 = Ge(move _3, const 3_usize); // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
+          switchInt(move _4) -> [false: bb9, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31
+      }
+  
+      bb6: {
+          switchInt((*_2)[0 of 3]) -> [47_u8: bb7, otherwise: bb9]; // scope 0 at $DIR/deduplicate_blocks.rs:5:10: 5:14
+      }
+  
+      bb7: {
+          switchInt((*_2)[1 of 3]) -> [47_u8: bb8, otherwise: bb9]; // scope 0 at $DIR/deduplicate_blocks.rs:5:16: 5:20
+      }
+  
+      bb8: {
+-         switchInt((*_2)[2 of 3]) -> [47_u8: bb11, 33_u8: bb12, otherwise: bb9]; // scope 0 at $DIR/deduplicate_blocks.rs:5:22: 5:26
++         switchInt((*_2)[2 of 3]) -> [47_u8: bb10, 33_u8: bb10, otherwise: bb9]; // scope 0 at $DIR/deduplicate_blocks.rs:5:22: 5:26
+      }
+  
+      bb9: {
+-         _0 = const false;                // scope 0 at $DIR/deduplicate_blocks.rs:7:14: 7:19
+-         goto -> bb13;                    // scope 0 at $DIR/deduplicate_blocks.rs:3:5: 8:6
+-     }
+- 
+-     bb10: {
+          _0 = const false;                // scope 0 at $DIR/deduplicate_blocks.rs:4:41: 4:46
+-         goto -> bb13;                    // scope 0 at $DIR/deduplicate_blocks.rs:3:5: 8:6
++         goto -> bb11;                    // scope 0 at $DIR/deduplicate_blocks.rs:3:5: 8:6
+      }
+  
+-     bb11: {
+-         _0 = const true;                 // scope 0 at $DIR/deduplicate_blocks.rs:5:35: 5:39
+-         goto -> bb13;                    // scope 0 at $DIR/deduplicate_blocks.rs:3:5: 8:6
+-     }
+- 
+-     bb12: {
++     bb10: {
+          _0 = const true;                 // scope 0 at $DIR/deduplicate_blocks.rs:6:35: 6:39
+-         goto -> bb13;                    // scope 0 at $DIR/deduplicate_blocks.rs:3:5: 8:6
++         goto -> bb11;                    // scope 0 at $DIR/deduplicate_blocks.rs:3:5: 8:6
+      }
+  
+-     bb13: {
++     bb11: {
+          StorageDead(_2);                 // scope 0 at $DIR/deduplicate_blocks.rs:9:1: 9:2
+          return;                          // scope 0 at $DIR/deduplicate_blocks.rs:9:2: 9:2
+      }
+  
+-     bb14: {
++     bb12: {
+          _5 = Len((*_2));                 // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37
+          _6 = Ge(move _5, const 4_usize); // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37
+          switchInt(move _6) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37
+      }
+  }
+  
diff --git a/src/test/mir-opt/deduplicate_blocks.rs b/src/test/mir-opt/deduplicate_blocks.rs
new file mode 100644
index 00000000000..f8f7361dc0d
--- /dev/null
+++ b/src/test/mir-opt/deduplicate_blocks.rs
@@ -0,0 +1,13 @@
+// EMIT_MIR deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff
+pub const fn is_line_doc_comment_2(s: &str) -> bool {
+    match s.as_bytes() {
+        [b'/', b'/', b'/', b'/', ..] => false,
+        [b'/', b'/', b'/', ..] => true,
+        [b'/', b'/', b'!', ..] => true,
+        _ => false,
+    }
+}
+
+fn main() {
+    is_line_doc_comment_2("asd");
+}
diff --git a/src/test/mir-opt/inline/inline_diverging.h.Inline.diff b/src/test/mir-opt/inline/inline_diverging.h.Inline.diff
index 07994eb3c16..e945629b613 100644
--- a/src/test/mir-opt/inline/inline_diverging.h.Inline.diff
+++ b/src/test/mir-opt/inline/inline_diverging.h.Inline.diff
@@ -46,7 +46,7 @@
 +         _4 = &_2;                        // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22
 +         StorageLive(_7);                 // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22
 +         _7 = const ();                   // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22
-+         goto -> bb1;                     // scope 5 at $DIR/inline-diverging.rs:22:5: 22:22
++         goto -> bb1;                     // scope 4 at $DIR/inline-diverging.rs:22:5: 22:22
       }
   
       bb1: {
diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir
index 04a8c94e003..0f718a720f4 100644
--- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir
+++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir
@@ -3,47 +3,45 @@
 fn num_to_digit(_1: char) -> u32 {
     debug num => _1;                     // in scope 0 at $DIR/issue-59352.rs:12:21: 12:24
     let mut _0: u32;                     // return place in scope 0 at $DIR/issue-59352.rs:12:35: 12:38
-    let mut _2: bool;                    // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23
-    let mut _3: std::option::Option<u32>; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:41
-    let mut _4: char;                    // in scope 0 at $DIR/issue-59352.rs:14:26: 14:29
-    let mut _5: u32;                     // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23
-    let mut _10: isize;                  // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23
+    let mut _2: std::option::Option<u32>; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:41
+    let mut _3: char;                    // in scope 0 at $DIR/issue-59352.rs:14:26: 14:29
+    let mut _4: u32;                     // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23
+    let mut _9: isize;                   // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23
     scope 1 (inlined char::methods::<impl char>::is_digit) { // at $DIR/issue-59352.rs:14:8: 14:23
-        debug self => _8;                // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        debug radix => _5;               // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        let mut _6: &std::option::Option<u32>; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        let _7: std::option::Option<u32>; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        let mut _8: char;                // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
+        debug self => _7;                // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
+        debug radix => _4;               // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
+        let mut _5: &std::option::Option<u32>; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
+        let _6: std::option::Option<u32>; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
+        let mut _7: char;                // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23
         scope 2 (inlined Option::<u32>::is_some) { // at $DIR/issue-59352.rs:14:8: 14:23
-            debug self => _6;            // in scope 2 at $DIR/issue-59352.rs:14:8: 14:23
+            debug self => _5;            // in scope 2 at $DIR/issue-59352.rs:14:8: 14:23
         }
     }
     scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { // at $DIR/issue-59352.rs:14:26: 14:50
-        debug self => _3;                // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50
-        let mut _9: isize;               // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50
+        debug self => _2;                // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50
+        let mut _8: isize;               // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50
         scope 4 {
             debug val => _0;             // in scope 4 at $DIR/issue-59352.rs:14:26: 14:50
         }
     }
 
     bb0: {
-        StorageLive(_2);                 // scope 0 at $DIR/issue-59352.rs:14:8: 14:23
-        _8 = _1;                         // scope 0 at $DIR/issue-59352.rs:14:8: 14:11
-        StorageLive(_5);                 // scope 0 at $DIR/issue-59352.rs:14:8: 14:23
-        _5 = const 8_u32;                // scope 0 at $DIR/issue-59352.rs:14:8: 14:23
+        _7 = _1;                         // scope 0 at $DIR/issue-59352.rs:14:8: 14:11
+        StorageLive(_4);                 // scope 0 at $DIR/issue-59352.rs:14:8: 14:23
+        _4 = const 8_u32;                // scope 0 at $DIR/issue-59352.rs:14:8: 14:23
+        StorageLive(_5);                 // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
         StorageLive(_6);                 // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        StorageLive(_7);                 // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        _7 = char::methods::<impl char>::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
+        _6 = char::methods::<impl char>::to_digit(move _7, const 8_u32) -> bb5; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
                                          // mir::Constant
                                          // + span: $DIR/issue-59352.rs:14:8: 14:23
                                          // + literal: Const { ty: fn(char, u32) -> std::option::Option<u32> {std::char::methods::<impl char>::to_digit}, val: Value(Scalar(<ZST>)) }
     }
 
     bb1: {
-        StorageLive(_3);                 // scope 0 at $DIR/issue-59352.rs:14:26: 14:41
-        StorageLive(_4);                 // scope 0 at $DIR/issue-59352.rs:14:26: 14:29
-        _4 = _1;                         // scope 0 at $DIR/issue-59352.rs:14:26: 14:29
-        _3 = char::methods::<impl char>::to_digit(move _4, const 8_u32) -> bb3; // scope 0 at $DIR/issue-59352.rs:14:26: 14:41
+        StorageLive(_2);                 // scope 0 at $DIR/issue-59352.rs:14:26: 14:41
+        StorageLive(_3);                 // scope 0 at $DIR/issue-59352.rs:14:26: 14:29
+        _3 = _1;                         // scope 0 at $DIR/issue-59352.rs:14:26: 14:29
+        _2 = char::methods::<impl char>::to_digit(move _3, const 8_u32) -> bb3; // scope 0 at $DIR/issue-59352.rs:14:26: 14:41
                                          // mir::Constant
                                          // + span: $DIR/issue-59352.rs:14:30: 14:38
                                          // + literal: Const { ty: fn(char, u32) -> std::option::Option<u32> {std::char::methods::<impl char>::to_digit}, val: Value(Scalar(<ZST>)) }
@@ -55,25 +53,23 @@ fn num_to_digit(_1: char) -> u32 {
     }
 
     bb3: {
-        StorageDead(_4);                 // scope 0 at $DIR/issue-59352.rs:14:40: 14:41
-        StorageLive(_9);                 // scope 0 at $DIR/issue-59352.rs:14:26: 14:50
-        _9 = discriminant(_3);           // scope 3 at $DIR/issue-59352.rs:14:26: 14:50
-        switchInt(move _9) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50
+        StorageDead(_3);                 // scope 0 at $DIR/issue-59352.rs:14:40: 14:41
+        StorageLive(_8);                 // scope 0 at $DIR/issue-59352.rs:14:26: 14:50
+        _8 = discriminant(_2);           // scope 3 at $DIR/issue-59352.rs:14:26: 14:50
+        switchInt(move _8) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50
     }
 
     bb4: {
-        StorageDead(_2);                 // scope 0 at $DIR/issue-59352.rs:14:62: 14:63
         return;                          // scope 0 at $DIR/issue-59352.rs:15:2: 15:2
     }
 
     bb5: {
-        _6 = &_7;                        // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        _10 = discriminant((*_6));       // scope 2 at $DIR/issue-59352.rs:14:8: 14:23
-        _2 = Eq(_10, const 1_isize);     // scope 2 at $DIR/issue-59352.rs:14:8: 14:23
+        _5 = &_6;                        // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
+        _9 = discriminant((*_5));        // scope 2 at $DIR/issue-59352.rs:14:8: 14:23
+        StorageDead(_5);                 // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
         StorageDead(_6);                 // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        StorageDead(_7);                 // scope 1 at $DIR/issue-59352.rs:14:8: 14:23
-        StorageDead(_5);                 // scope 0 at $DIR/issue-59352.rs:14:8: 14:23
-        switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63
+        StorageDead(_4);                 // scope 0 at $DIR/issue-59352.rs:14:8: 14:23
+        switchInt(move _9) -> [1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63
     }
 
     bb6: {
@@ -94,9 +90,9 @@ fn num_to_digit(_1: char) -> u32 {
     }
 
     bb8: {
-        _0 = move ((_3 as Some).0: u32); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50
-        StorageDead(_9);                 // scope 0 at $DIR/issue-59352.rs:14:26: 14:50
-        StorageDead(_3);                 // scope 0 at $DIR/issue-59352.rs:14:49: 14:50
+        _0 = move ((_2 as Some).0: u32); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50
+        StorageDead(_8);                 // scope 0 at $DIR/issue-59352.rs:14:26: 14:50
+        StorageDead(_2);                 // scope 0 at $DIR/issue-59352.rs:14:49: 14:50
         goto -> bb4;                     // scope 0 at $DIR/issue-59352.rs:14:5: 14:63
     }
 }
diff --git a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff
index d3a29aa5d51..94a0b999863 100644
--- a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff
+++ b/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff
@@ -34,33 +34,30 @@
           StorageLive(_5);                 // scope 3 at $DIR/matches_reduce_branches.rs:16:9: 16:10
           StorageLive(_6);                 // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
 -         switchInt(_1) -> [7_i32: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
+-     }
+- 
+-     bb1: {
+-         _2 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:27:13: 27:21
+-         _3 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:28:13: 28:22
+-         _4 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:29:13: 29:22
+-         _5 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:30:13: 30:21
+-         goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
+-     }
+- 
+-     bb2: {
+-         _2 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:20:13: 20:22
+-         _3 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:21:13: 21:21
 +         StorageLive(_11);                // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
 +         _11 = _1;                        // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
 +         _2 = Ne(_11, const 7_i32);       // scope 4 at $DIR/matches_reduce_branches.rs:20:13: 20:22
 +         _3 = Eq(_11, const 7_i32);       // scope 4 at $DIR/matches_reduce_branches.rs:21:13: 21:21
-+         _4 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:22:13: 22:22
-+         _5 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:23:13: 23:21
-+         StorageDead(_11);                // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
-+         goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
-      }
-  
-      bb1: {
-          _2 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:27:13: 27:21
-          _3 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:28:13: 28:22
-          _4 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:29:13: 29:22
-          _5 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:30:13: 30:21
-          goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
-      }
-  
-      bb2: {
-          _2 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:20:13: 20:22
-          _3 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:21:13: 21:21
           _4 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:22:13: 22:22
           _5 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:23:13: 23:21
-          goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
-      }
-  
-      bb3: {
+-         goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
+-     }
+- 
+-     bb3: {
++         StorageDead(_11);                // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
           StorageDead(_6);                 // scope 4 at $DIR/matches_reduce_branches.rs:33:6: 33:7
           StorageLive(_7);                 // scope 4 at $DIR/matches_reduce_branches.rs:35:6: 35:7
           _7 = _2;                         // scope 4 at $DIR/matches_reduce_branches.rs:35:6: 35:7
diff --git a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff
index d3a29aa5d51..94a0b999863 100644
--- a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff
+++ b/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff
@@ -34,33 +34,30 @@
           StorageLive(_5);                 // scope 3 at $DIR/matches_reduce_branches.rs:16:9: 16:10
           StorageLive(_6);                 // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
 -         switchInt(_1) -> [7_i32: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
+-     }
+- 
+-     bb1: {
+-         _2 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:27:13: 27:21
+-         _3 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:28:13: 28:22
+-         _4 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:29:13: 29:22
+-         _5 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:30:13: 30:21
+-         goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
+-     }
+- 
+-     bb2: {
+-         _2 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:20:13: 20:22
+-         _3 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:21:13: 21:21
 +         StorageLive(_11);                // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
 +         _11 = _1;                        // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
 +         _2 = Ne(_11, const 7_i32);       // scope 4 at $DIR/matches_reduce_branches.rs:20:13: 20:22
 +         _3 = Eq(_11, const 7_i32);       // scope 4 at $DIR/matches_reduce_branches.rs:21:13: 21:21
-+         _4 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:22:13: 22:22
-+         _5 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:23:13: 23:21
-+         StorageDead(_11);                // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
-+         goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
-      }
-  
-      bb1: {
-          _2 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:27:13: 27:21
-          _3 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:28:13: 28:22
-          _4 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:29:13: 29:22
-          _5 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:30:13: 30:21
-          goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
-      }
-  
-      bb2: {
-          _2 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:20:13: 20:22
-          _3 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:21:13: 21:21
           _4 = const false;                // scope 4 at $DIR/matches_reduce_branches.rs:22:13: 22:22
           _5 = const true;                 // scope 4 at $DIR/matches_reduce_branches.rs:23:13: 23:21
-          goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
-      }
-  
-      bb3: {
+-         goto -> bb3;                     // scope 4 at $DIR/matches_reduce_branches.rs:18:5: 33:6
+-     }
+- 
+-     bb3: {
++         StorageDead(_11);                // scope 4 at $DIR/matches_reduce_branches.rs:19:9: 19:10
           StorageDead(_6);                 // scope 4 at $DIR/matches_reduce_branches.rs:33:6: 33:7
           StorageLive(_7);                 // scope 4 at $DIR/matches_reduce_branches.rs:35:6: 35:7
           _7 = _2;                         // scope 4 at $DIR/matches_reduce_branches.rs:35:6: 35:7
diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff
index 20240348230..e43ec3de58d 100644
--- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff
+++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff
@@ -16,29 +16,31 @@
 +         _4 = move _3;                    // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
 +         _2 = Eq(_4, const 0_isize);      // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
 +         StorageDead(_4);                 // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
-+         goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
++         switchInt(move _2) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
       }
   
       bb1: {
-          _2 = const false;                // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-          goto -> bb3;                     // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-      }
-  
-      bb2: {
-          _2 = const true;                 // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-          goto -> bb3;                     // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-      }
-  
-      bb3: {
-          switchInt(move _2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
-      }
-  
-      bb4: {
+-         _2 = const false;                // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+-         goto -> bb3;                     // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+-     }
+- 
+-     bb2: {
+-         _2 = const true;                 // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+-         goto -> bb3;                     // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+-     }
+- 
+-     bb3: {
+-         switchInt(move _2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
+-     }
+- 
+-     bb4: {
           _0 = const ();                   // scope 0 at $DIR/matches_reduce_branches.rs:9:6: 9:6
-          goto -> bb5;                     // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
+-         goto -> bb5;                     // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
++         goto -> bb2;                     // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
       }
   
-      bb5: {
+-     bb5: {
++     bb2: {
           StorageDead(_2);                 // scope 0 at $DIR/matches_reduce_branches.rs:9:5: 9:6
           return;                          // scope 0 at $DIR/matches_reduce_branches.rs:10:2: 10:2
       }
diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff
index 20240348230..e43ec3de58d 100644
--- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff
+++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff
@@ -16,29 +16,31 @@
 +         _4 = move _3;                    // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
 +         _2 = Eq(_4, const 0_isize);      // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
 +         StorageDead(_4);                 // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
-+         goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
++         switchInt(move _2) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
       }
   
       bb1: {
-          _2 = const false;                // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-          goto -> bb3;                     // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-      }
-  
-      bb2: {
-          _2 = const true;                 // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-          goto -> bb3;                     // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-      }
-  
-      bb3: {
-          switchInt(move _2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
-      }
-  
-      bb4: {
+-         _2 = const false;                // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+-         goto -> bb3;                     // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+-     }
+- 
+-     bb2: {
+-         _2 = const true;                 // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+-         goto -> bb3;                     // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+-     }
+- 
+-     bb3: {
+-         switchInt(move _2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
+-     }
+- 
+-     bb4: {
           _0 = const ();                   // scope 0 at $DIR/matches_reduce_branches.rs:9:6: 9:6
-          goto -> bb5;                     // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
+-         goto -> bb5;                     // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
++         goto -> bb2;                     // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
       }
   
-      bb5: {
+-     bb5: {
++     bb2: {
           StorageDead(_2);                 // scope 0 at $DIR/matches_reduce_branches.rs:9:5: 9:6
           return;                          // scope 0 at $DIR/matches_reduce_branches.rs:10:2: 10:2
       }
diff --git a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff
index 1d895852354..68c1161d784 100644
--- a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff
+++ b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff
@@ -26,87 +26,82 @@
           StorageLive(_6);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:24: 40:28
           _6 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:24: 40:28
 -         switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
+-     }
+- 
+-     bb1: {
+-         _5 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:30: 40:34
+-         goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
+-     }
+- 
+-     bb2: {
+-         _5 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:42: 40:47
+-         goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
+-     }
+- 
+-     bb3: {
 +         StorageLive(_7);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
 +         _7 = move _6;                    // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
 +         _5 = Ne(_7, const false);        // scope 0 at $DIR/matches_reduce_branches.rs:40:42: 40:47
 +         StorageDead(_7);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
-+         goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
-      }
-  
-      bb1: {
-          _5 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:30: 40:34
-          goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
-      }
-  
-      bb2: {
-          _5 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:42: 40:47
-          goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
-      }
-  
-      bb3: {
           StorageDead(_6);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:47: 40:48
 -         switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
+-     }
+- 
+-     bb4: {
+-         _4 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:50: 40:54
+-         goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
+-     }
+- 
+-     bb5: {
+-         _4 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:62: 40:67
+-         goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
+-     }
+- 
+-     bb6: {
 +         StorageLive(_8);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
 +         _8 = move _5;                    // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
 +         _4 = Ne(_8, const false);        // scope 0 at $DIR/matches_reduce_branches.rs:40:62: 40:67
 +         StorageDead(_8);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
-+         goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
-      }
-  
-      bb4: {
-          _4 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:50: 40:54
-          goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
-      }
-  
-      bb5: {
-          _4 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:62: 40:67
-          goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
-      }
-  
-      bb6: {
           StorageDead(_5);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:67: 40:68
 -         switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
+-     }
+- 
+-     bb7: {
+-         _3 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:70: 40:74
+-         goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
+-     }
+- 
+-     bb8: {
+-         _3 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:82: 40:87
+-         goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
+-     }
+- 
+-     bb9: {
 +         StorageLive(_9);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
 +         _9 = move _4;                    // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
 +         _3 = Ne(_9, const false);        // scope 0 at $DIR/matches_reduce_branches.rs:40:82: 40:87
 +         StorageDead(_9);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-+         goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-      }
-  
-      bb7: {
-          _3 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:70: 40:74
-          goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-      }
-  
-      bb8: {
-          _3 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:82: 40:87
-          goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-      }
-  
-      bb9: {
           StorageDead(_4);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:87: 40:88
 -         switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
+-     }
+- 
+-     bb10: {
 +         StorageLive(_10);                // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
 +         _10 = move _3;                   // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-+         StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
+          StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
+-         _1 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:92: 40:96
+-         goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:39:15: 42:6
+-     }
+- 
+-     bb11: {
+-         StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
+-         _1 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:41:14: 41:19
+-         goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:39:15: 42:6
+-     }
+- 
+-     bb12: {
 +         _1 = Ne(_10, const false);       // scope 0 at $DIR/matches_reduce_branches.rs:41:14: 41:19
 +         StorageDead(_10);                // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-+         goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-      }
-  
-      bb10: {
-          StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
-          _1 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:92: 40:96
-          goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:39:15: 42:6
-      }
-  
-      bb11: {
-          StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
-          _1 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:41:14: 41:19
-          goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:39:15: 42:6
-      }
-  
-      bb12: {
           StorageDead(_2);                 // scope 0 at $DIR/matches_reduce_branches.rs:42:6: 42:7
           _0 = _1;                         // scope 1 at $DIR/matches_reduce_branches.rs:43:5: 43:8
           StorageDead(_1);                 // scope 0 at $DIR/matches_reduce_branches.rs:44:1: 44:2
diff --git a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff
index 1d895852354..68c1161d784 100644
--- a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff
+++ b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff
@@ -26,87 +26,82 @@
           StorageLive(_6);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:24: 40:28
           _6 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:24: 40:28
 -         switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
+-     }
+- 
+-     bb1: {
+-         _5 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:30: 40:34
+-         goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
+-     }
+- 
+-     bb2: {
+-         _5 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:42: 40:47
+-         goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
+-     }
+- 
+-     bb3: {
 +         StorageLive(_7);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
 +         _7 = move _6;                    // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
 +         _5 = Ne(_7, const false);        // scope 0 at $DIR/matches_reduce_branches.rs:40:42: 40:47
 +         StorageDead(_7);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
-+         goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
-      }
-  
-      bb1: {
-          _5 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:30: 40:34
-          goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
-      }
-  
-      bb2: {
-          _5 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:42: 40:47
-          goto -> bb3;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:48
-      }
-  
-      bb3: {
           StorageDead(_6);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:47: 40:48
 -         switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
+-     }
+- 
+-     bb4: {
+-         _4 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:50: 40:54
+-         goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
+-     }
+- 
+-     bb5: {
+-         _4 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:62: 40:67
+-         goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
+-     }
+- 
+-     bb6: {
 +         StorageLive(_8);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
 +         _8 = move _5;                    // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
 +         _4 = Ne(_8, const false);        // scope 0 at $DIR/matches_reduce_branches.rs:40:62: 40:67
 +         StorageDead(_8);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
-+         goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
-      }
-  
-      bb4: {
-          _4 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:50: 40:54
-          goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
-      }
-  
-      bb5: {
-          _4 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:62: 40:67
-          goto -> bb6;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:18: 40:68
-      }
-  
-      bb6: {
           StorageDead(_5);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:67: 40:68
 -         switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
+-     }
+- 
+-     bb7: {
+-         _3 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:70: 40:74
+-         goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
+-     }
+- 
+-     bb8: {
+-         _3 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:82: 40:87
+-         goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
+-     }
+- 
+-     bb9: {
 +         StorageLive(_9);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
 +         _9 = move _4;                    // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
 +         _3 = Ne(_9, const false);        // scope 0 at $DIR/matches_reduce_branches.rs:40:82: 40:87
 +         StorageDead(_9);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-+         goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-      }
-  
-      bb7: {
-          _3 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:70: 40:74
-          goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-      }
-  
-      bb8: {
-          _3 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:40:82: 40:87
-          goto -> bb9;                     // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-      }
-  
-      bb9: {
           StorageDead(_4);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:87: 40:88
 -         switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
+-     }
+- 
+-     bb10: {
 +         StorageLive(_10);                // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
 +         _10 = move _3;                   // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-+         StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
+          StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
+-         _1 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:92: 40:96
+-         goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:39:15: 42:6
+-     }
+- 
+-     bb11: {
+-         StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
+-         _1 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:41:14: 41:19
+-         goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:39:15: 42:6
+-     }
+- 
+-     bb12: {
 +         _1 = Ne(_10, const false);       // scope 0 at $DIR/matches_reduce_branches.rs:41:14: 41:19
 +         StorageDead(_10);                // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-+         goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:40:15: 40:88
-      }
-  
-      bb10: {
-          StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
-          _1 = const true;                 // scope 0 at $DIR/matches_reduce_branches.rs:40:92: 40:96
-          goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:39:15: 42:6
-      }
-  
-      bb11: {
-          StorageDead(_3);                 // scope 0 at $DIR/matches_reduce_branches.rs:40:95: 40:96
-          _1 = const false;                // scope 0 at $DIR/matches_reduce_branches.rs:41:14: 41:19
-          goto -> bb12;                    // scope 0 at $DIR/matches_reduce_branches.rs:39:15: 42:6
-      }
-  
-      bb12: {
           StorageDead(_2);                 // scope 0 at $DIR/matches_reduce_branches.rs:42:6: 42:7
           _0 = _1;                         // scope 1 at $DIR/matches_reduce_branches.rs:43:5: 43:8
           StorageDead(_1);                 // scope 0 at $DIR/matches_reduce_branches.rs:44:1: 44:2
diff --git a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff
index dc3a6a36d9e..db9313e7822 100644
--- a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff
+++ b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff
@@ -19,7 +19,7 @@
           _6 = move _3;                    // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
           _2 = Eq(_6, const 0_isize);      // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageDead(_6);                 // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
-          goto -> bb4;                     // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
+          switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
       }
   
       bb1: {
@@ -34,20 +34,6 @@
           _7 = move _5;                    // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
           _4 = Eq(_7, const 1_isize);      // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageDead(_7);                 // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
-          goto -> bb5;                     // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
-      }
-  
-      bb3: {
-          StorageDead(_4);                 // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46
-          StorageDead(_2);                 // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46
-          return;                          // scope 0 at $DIR/not_equal_false.rs:5:2: 5:2
-      }
-  
-      bb4: {
-          switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
-      }
-  
-      bb5: {
           StorageLive(_8);                 // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
           _8 = move _4;                    // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
 -         _0 = Ne(_8, const false);        // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
@@ -55,5 +41,11 @@
           StorageDead(_8);                 // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
           goto -> bb3;                     // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
       }
+  
+      bb3: {
+          StorageDead(_4);                 // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46
+          StorageDead(_2);                 // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46
+          return;                          // scope 0 at $DIR/not_equal_false.rs:5:2: 5:2
+      }
   }