Make MatchBranchSimplification clean up after itself

This commit is contained in:
Simon Vandel Sillesen 2020-10-04 18:12:20 +02:00
parent ccecc4f6bf
commit 1e865709a6
9 changed files with 232 additions and 247 deletions

View File

@ -2,6 +2,8 @@ use crate::transform::MirPass;
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;
use super::simplify::simplify_cfg;
pub struct MatchBranchSimplification;
/// If a source block is found that switches between two blocks that are exactly
@ -42,9 +44,11 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
return;
}
let param_env = tcx.param_env(body.source.def_id());
let def_id = body.source.def_id();
let param_env = tcx.param_env(def_id);
let (bbs, local_decls) = body.basic_blocks_and_local_decls_mut();
let mut should_cleanup = false;
'outer: for bb_idx in bbs.indices() {
if !tcx.consider_optimizing(|| format!("MatchBranchSimplification {:?} ", def_id)) {
continue;
@ -159,6 +163,11 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
from.statements
.push(Statement { source_info, kind: StatementKind::StorageDead(discr_local) });
from.terminator_mut().kind = first.terminator().kind.clone();
should_cleanup = true;
}
if should_cleanup {
simplify_cfg(body);
}
}
}

View File

@ -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
}
}

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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
}
}