From 5fb32c2e33fd102adb14d943355542d1a1d2e68e Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sun, 2 Aug 2020 01:47:52 +0200 Subject: [PATCH 1/9] New MIR optimization pass to reduce branches on match of tuples of enums --- .../src/transform/early_otherwise_branch.rs | 313 ++++++++++++++++++ compiler/rustc_mir/src/transform/mod.rs | 2 + ...wise_branch.opt1.EarlyOtherwiseBranch.diff | 88 +++++ ...ranch.opt1.EarlyOtherwiseBranch.diff.32bit | 88 +++++ ...ranch.opt1.EarlyOtherwiseBranch.diff.64bit | 88 +++++ ...wise_branch.opt2.EarlyOtherwiseBranch.diff | 105 ++++++ ...ranch.opt2.EarlyOtherwiseBranch.diff.32bit | 105 ++++++ ...ranch.opt2.EarlyOtherwiseBranch.diff.64bit | 105 ++++++ src/test/mir-opt/early_otherwise_branch.rs | 23 ++ ...ement_tuple.opt1.EarlyOtherwiseBranch.diff | 117 +++++++ ...tuple.opt1.EarlyOtherwiseBranch.diff.32bit | 117 +++++++ ...tuple.opt1.EarlyOtherwiseBranch.diff.64bit | 117 +++++++ .../early_otherwise_branch_3_element_tuple.rs | 14 + .../mir-opt/early_otherwise_branch_68867.rs | 31 ++ ...ch_68867.try_sum.EarlyOtherwiseBranch.diff | 219 ++++++++++++ ...nch_noopt.noopt1.EarlyOtherwiseBranch.diff | 114 +++++++ ...opt.noopt1.EarlyOtherwiseBranch.diff.32bit | 114 +++++++ ...opt.noopt1.EarlyOtherwiseBranch.diff.64bit | 114 +++++++ ...nch_noopt.noopt2.EarlyOtherwiseBranch.diff | 72 ++++ ...opt.noopt2.EarlyOtherwiseBranch.diff.32bit | 72 ++++ ...opt.noopt2.EarlyOtherwiseBranch.diff.64bit | 72 ++++ .../mir-opt/early_otherwise_branch_noopt.rs | 29 ++ 22 files changed, 2119 insertions(+) create mode 100644 compiler/rustc_mir/src/transform/early_otherwise_branch.rs create mode 100644 src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff create mode 100644 src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.32bit create mode 100644 src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.64bit create mode 100644 src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff create mode 100644 src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.32bit create mode 100644 src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.64bit create mode 100644 src/test/mir-opt/early_otherwise_branch.rs create mode 100644 src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff create mode 100644 src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.32bit create mode 100644 src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.64bit create mode 100644 src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs create mode 100644 src/test/mir-opt/early_otherwise_branch_68867.rs create mode 100644 src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff create mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff create mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.32bit create mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.64bit create mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff create mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.32bit create mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.64bit create mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.rs diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs new file mode 100644 index 0000000000000..0dc311ebb8c1f --- /dev/null +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -0,0 +1,313 @@ +use crate::{ + transform::{MirPass, MirSource}, + util::patch::MirPatch, +}; +use rustc_middle::mir::*; +use rustc_middle::ty::{Ty, TyCtxt}; +use std::{borrow::Cow, fmt::Debug}; + +/// This pass optimizes something like +/// ```text +/// let x: Option<()>; +/// let y: Option<()>; +/// match (x,y) { +/// (Some(_), Some(_)) => {0}, +/// _ => {1} +/// } +/// ``` +/// into something like +/// ```text +/// let x: Option<()>; +/// let y: Option<()>; +/// let discriminant_x = // get discriminant of x +/// let discriminant_y = // get discriminant of x +/// if discriminant_x != discriminant_y {1} else {0} +/// ``` +pub struct EarlyOtherwiseBranch; + +impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { + fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { + if tcx.sess.opts.debugging_opts.mir_opt_level < 3 { + return; + } + trace!("running EarlyOtherwiseBranch on {:?}", source); + // we are only interested in this bb if the terminator is a switchInt + let bbs_with_switch = + body.basic_blocks().iter_enumerated().filter(|(_, bb)| is_switch(bb.terminator())); + + let opts_to_apply: Vec> = bbs_with_switch + .flat_map(|(bb_idx, bb)| { + let switch = bb.terminator(); + let helper = Helper { body, tcx }; + let infos = helper.go(bb, switch)?; + Some(OptimizationToApply { infos, basic_block_first_switch: bb_idx }) + }) + .collect(); + + for opt_to_apply in opts_to_apply { + trace!("SUCCESS: found optimization possibility to apply: {:?}", &opt_to_apply); + // create the patch using MirPatch + let mut patch = MirPatch::new(body); + + // create temp to store second discriminant in + let discr_type = opt_to_apply.infos[0].second_switch_info.discr_ty; + let discr_span = opt_to_apply.infos[0].second_switch_info.discr_source_info.span; + let temp = patch.new_temp(discr_type, discr_span); + let statements_before = + body.basic_blocks()[opt_to_apply.basic_block_first_switch].statements.len(); + let end_of_block_location = Location { + block: opt_to_apply.basic_block_first_switch, + statement_index: statements_before, + }; + patch.add_statement(end_of_block_location, StatementKind::StorageLive(temp)); + + // create assignment of discriminant + let place_of_adt_to_get_discriminant_of = + opt_to_apply.infos[0].second_switch_info.place_of_adt_discr_read; + patch.add_assign( + end_of_block_location, + Place::from(temp), + Rvalue::Discriminant(place_of_adt_to_get_discriminant_of), + ); + + // create temp to store NotEqual comparison between the two discriminants + let not_equal = BinOp::Ne; + let not_equal_res_type = not_equal.ty(tcx, discr_type, discr_type); + let not_equal_temp = patch.new_temp(not_equal_res_type, discr_span); + patch.add_statement(end_of_block_location, StatementKind::StorageLive(not_equal_temp)); + + // create NotEqual comparison between the two discriminants + let first_descriminant_place = + opt_to_apply.infos[0].first_switch_info.discr_used_in_switch; + let not_equal_rvalue = Rvalue::BinaryOp( + not_equal, + Operand::Copy(Place::from(temp)), + Operand::Copy(Place::from(first_descriminant_place)), + ); + patch.add_statement( + end_of_block_location, + StatementKind::Assign(box (Place::from(not_equal_temp), not_equal_rvalue)), + ); + + let (mut targets_to_jump_to, values_to_jump_to): (Vec<_>, Vec<_>) = opt_to_apply + .infos + .iter() + .flat_map(|x| x.second_switch_info.targets_with_values.iter()) + .cloned() + .unzip(); + + // add otherwise case in the end + targets_to_jump_to.push(opt_to_apply.infos[0].first_switch_info.otherwise_bb); + // new block that jumps to the correct discriminant case. This block is switched to if the discriminants are equal + let new_switch_data = BasicBlockData::new(Some(Terminator { + source_info: opt_to_apply.infos[0].second_switch_info.discr_source_info, + kind: TerminatorKind::SwitchInt { + // the first and second discriminants are equal, so just pick one + discr: Operand::Copy(first_descriminant_place), + switch_ty: discr_type, + values: Cow::from(values_to_jump_to), + targets: targets_to_jump_to, + }, + })); + + let new_switch_bb = patch.new_block(new_switch_data); + + // switch on the NotEqual. If true, then jump to the `otherwise` case. + // If false, then jump to a basic block that then jumps to the correct disciminant case + let true_case = opt_to_apply.infos[0].first_switch_info.otherwise_bb; + let false_case = new_switch_bb; + patch.patch_terminator( + opt_to_apply.basic_block_first_switch, + TerminatorKind::if_( + tcx, + Operand::Move(Place::from(not_equal_temp)), + true_case, + false_case, + ), + ); + + // generate StorageDead for the temp not in use anymore. We use the not_equal_temp in the switch, so we can't mark that dead + patch.add_statement(end_of_block_location, StatementKind::StorageDead(temp)); + + patch.apply(body); + } + } +} + +fn is_switch<'tcx>(terminator: &Terminator<'tcx>) -> bool { + match terminator.kind { + TerminatorKind::SwitchInt { .. } => true, + _ => false, + } +} + +struct Helper<'a, 'tcx> { + body: &'a Body<'tcx>, + tcx: TyCtxt<'tcx>, +} + +#[derive(Debug, Clone)] +struct SwitchDiscriminantInfo<'tcx> { + /// Type of the discriminant being switched on + discr_ty: Ty<'tcx>, + /// The basic block that the otherwise branch points to + otherwise_bb: BasicBlock, + /// Target along with the value being branched from. Otherwise is not included + targets_with_values: Vec<(BasicBlock, u128)>, + discr_source_info: SourceInfo, + /// The place of the discriminant used in the switch + discr_used_in_switch: Place<'tcx>, + /// The place of the adt that has its discriminant read + place_of_adt_discr_read: Place<'tcx>, + /// The type of the adt that has its discriminant read + type_adt_matched_on: Ty<'tcx>, +} + +#[derive(Debug)] +struct OptimizationToApply<'tcx> { + infos: Vec>, + /// Basic block of the original first switch + basic_block_first_switch: BasicBlock, +} + +#[derive(Debug)] +struct OptimizationInfo<'tcx> { + /// Info about the first switch and discriminant + first_switch_info: SwitchDiscriminantInfo<'tcx>, + /// Info about the second switch and discriminant + second_switch_info: SwitchDiscriminantInfo<'tcx>, +} + +impl<'a, 'tcx> Helper<'a, 'tcx> { + pub fn go( + &self, + bb: &BasicBlockData<'tcx>, + switch: &Terminator<'tcx>, + ) -> Option>> { + // try to find the statement that defines the discriminant that is used for the switch + let discr = self.find_switch_discriminant_info(bb, switch)?; + + // go through each target, finding a discriminant read, and a switch + let results = discr.targets_with_values.iter().map(|(target, value)| { + self.find_discriminant_switch_pairing(&discr, target.clone(), value.clone()) + }); + + // if the optimization did not apply for one of the targets, then abort + if results.clone().any(|x| x.is_none()) || results.len() == 0 { + trace!("NO: not all of the targets matched the pattern for optimization"); + return None; + } + + Some(results.flatten().collect()) + } + + fn find_discriminant_switch_pairing( + &self, + discr_info: &SwitchDiscriminantInfo<'tcx>, + target: BasicBlock, + value: u128, + ) -> Option> { + let bb = &self.body.basic_blocks()[target]; + // find switch + let terminator = bb.terminator(); + if is_switch(terminator) { + let this_bb_discr_info = self.find_switch_discriminant_info(bb, terminator)?; + + // the types of the two adts matched on have to be equalfor this optimization to apply + if discr_info.type_adt_matched_on != this_bb_discr_info.type_adt_matched_on { + trace!( + "NO: types do not match. LHS: {:?}, RHS: {:?}", + discr_info.type_adt_matched_on, + this_bb_discr_info.type_adt_matched_on + ); + return None; + } + + // the otherwise branch of the two switches have to point to the same bb + if discr_info.otherwise_bb != this_bb_discr_info.otherwise_bb { + trace!("NO: otherwise target is not the same"); + return None; + } + + // check that the value being matched on is the same. The + if this_bb_discr_info.targets_with_values.iter().find(|x| x.1 == value).is_none() { + trace!("NO: values being matched on are not the same"); + return None; + } + + // only allow optimization if the left and right of the tuple being matched are the same variants. + // so the following should not optimize + // ```rust + // let x: Option<()>; + // let y: Option<()>; + // match (x,y) { + // (Some(_), None) => {}, + // _ => {} + // } + // ``` + // We check this by seeing that the value of the first discriminant is the only other discriminant value being used as a target in the second switch + if !(this_bb_discr_info.targets_with_values.len() == 1 + && this_bb_discr_info.targets_with_values[0].1 == value) + { + trace!( + "NO: The second switch did not have only 1 target (besides otherwise) that had the same value as the value from the first switch that got us here" + ); + return None; + } + + // if we reach this point, the optimization applies, and we should be able to optimize this case + // store the info that is needed to apply the optimization + + Some(OptimizationInfo { + first_switch_info: discr_info.clone(), + second_switch_info: this_bb_discr_info, + }) + } else { + None + } + } + + fn find_switch_discriminant_info( + &self, + bb: &BasicBlockData<'tcx>, + switch: &Terminator<'tcx>, + ) -> Option> { + match &switch.kind { + TerminatorKind::SwitchInt { discr, targets, values, .. } => { + let discr_local = discr.place()?.as_local()?; + // the declaration of the discriminant read. Place of this read is being used in the switch + let discr_decl = &self.body.local_decls()[discr_local]; + let discr_ty = discr_decl.ty; + // the otherwise target lies as the last element + let otherwise_bb = targets.get(values.len())?.clone(); + let targets_with_values = targets + .iter() + .zip(values.iter()) + .map(|(t, v)| (t.clone(), v.clone())) + .collect(); + + // find the place of the adt where the discriminant is being read from + // assume this is the last statement of the block + let place_of_adt_discr_read = match bb.statements.last()?.kind { + StatementKind::Assign(box (_, Rvalue::Discriminant(adt_place))) => { + Some(adt_place) + } + _ => None, + }?; + + let type_adt_matched_on = place_of_adt_discr_read.ty(self.body, self.tcx).ty; + + Some(SwitchDiscriminantInfo { + discr_used_in_switch: discr.place()?, + discr_ty, + otherwise_bb, + targets_with_values, + discr_source_info: discr_decl.source_info, + place_of_adt_discr_read, + type_adt_matched_on, + }) + } + _ => unreachable!("must only be passed terminator that is a switch"), + } + } +} diff --git a/compiler/rustc_mir/src/transform/mod.rs b/compiler/rustc_mir/src/transform/mod.rs index fc9854ba499f8..abe2dc496a630 100644 --- a/compiler/rustc_mir/src/transform/mod.rs +++ b/compiler/rustc_mir/src/transform/mod.rs @@ -26,6 +26,7 @@ pub mod copy_prop; pub mod deaggregator; pub mod dest_prop; pub mod dump_mir; +pub mod early_otherwise_branch; pub mod elaborate_drops; pub mod generator; pub mod inline; @@ -465,6 +466,7 @@ fn run_optimization_passes<'tcx>( &instcombine::InstCombine, &const_prop::ConstProp, &simplify_branches::SimplifyBranches::new("after-const-prop"), + &early_otherwise_branch::EarlyOtherwiseBranch, &simplify_comparison_integral::SimplifyComparisonIntegral, &simplify_try::SimplifyArmIdentity, &simplify_try::SimplifyBranchSame, diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff new file mode 100644 index 0000000000000..28c9d422a9f4f --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff @@ -0,0 +1,88 @@ +- // MIR for `opt1` before EarlyOtherwiseBranch ++ // MIR for `opt1` after EarlyOtherwiseBranch + + fn opt1(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:5:9: 5:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:5:27: 5:28 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:5:47: 5:52 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:6:11: 6:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:6:12: 6:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 + let _8: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:15: 7:16 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:24: 7:25 ++ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 ++ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 + scope 1 { + debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:7:15: 7:16 + debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:7:24: 7:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:6:11: 6:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:6:12: 6:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:6:12: 6:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:6:11: 6:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:6:11: 6:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 +- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 ++ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 ++ _10 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 ++ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 ++ _11 = Ne(_10, _7); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 ++ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 ++ switchInt(move _11) -> [false: bb6, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:8:14: 8:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:8:14: 8:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:6:5: 9:6 + } + + bb2: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 + switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 + } + + bb3: { + StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:7:15: 7:16 + _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:7:15: 7:16 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:7:24: 7:25 + _9 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:7:24: 7:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:7:31: 7:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:7:31: 7:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:7:31: 7:32 + StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:7:31: 7:32 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:6:5: 9:6 + } + + bb4: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:10:1: 10:2 + return; // scope 0 at $DIR/early_otherwise_branch.rs:10:2: 10:2 ++ } ++ ++ bb5 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch.rs:5:1: 10:2 ++ } ++ ++ bb6: { ++ switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.32bit new file mode 100644 index 0000000000000..dbeb09bf2bbc8 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.32bit @@ -0,0 +1,88 @@ +- // MIR for `opt1` before EarlyOtherwiseBranch ++ // MIR for `opt1` after EarlyOtherwiseBranch + + fn opt1(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:4:9: 4:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:4:27: 4:28 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:4:47: 4:52 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 + let _8: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 ++ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 ++ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + scope 1 { + debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:6:24: 6:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 + _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 +- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ _10 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ _11 = Ne(_10, _7); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ switchInt(move _11) -> [false: bb6, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:7:14: 7:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:7:14: 7:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:5:5: 8:6 + } + + bb2: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + } + + bb3: { + StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 + _9 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:6:31: 6:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:6:31: 6:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:6:31: 6:32 + StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:6:31: 6:32 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:5:5: 8:6 + } + + bb4: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:9:1: 9:2 + return; // scope 0 at $DIR/early_otherwise_branch.rs:9:2: 9:2 ++ } ++ ++ bb5 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch.rs:4:1: 9:2 ++ } ++ ++ bb6: { ++ switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.64bit new file mode 100644 index 0000000000000..62a40a440db16 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.64bit @@ -0,0 +1,88 @@ +- // MIR for `opt1` before EarlyOtherwiseBranch ++ // MIR for `opt1` after EarlyOtherwiseBranch + + fn opt1(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:4:9: 4:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:4:27: 4:28 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:4:47: 4:52 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 + let _8: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 ++ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 ++ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + scope 1 { + debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:6:24: 6:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 + _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 +- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ _10 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ _11 = Ne(_10, _7); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 ++ switchInt(move _11) -> [false: bb6, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:7:14: 7:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:7:14: 7:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:5:5: 8:6 + } + + bb2: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + } + + bb3: { + StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 + _9 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:6:31: 6:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:6:31: 6:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:6:31: 6:32 + StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:6:31: 6:32 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:5:5: 8:6 + } + + bb4: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:9:1: 9:2 + return; // scope 0 at $DIR/early_otherwise_branch.rs:9:2: 9:2 ++ } ++ ++ bb5 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch.rs:4:1: 9:2 ++ } ++ ++ bb6: { ++ switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff new file mode 100644 index 0000000000000..1868f4f5be1b6 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff @@ -0,0 +1,105 @@ +- // MIR for `opt2` before EarlyOtherwiseBranch ++ // MIR for `opt2` after EarlyOtherwiseBranch + + fn opt2(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:13:9: 13:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:13:27: 13:28 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:13:47: 13:52 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:14:11: 14:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:14:12: 14:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:14:14: 14:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:19: 15:26 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:15: 15:16 + let _10: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:24: 15:25 ++ let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 ++ let mut _12: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 + scope 1 { + debug a => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:15:15: 15:16 + debug b => _10; // in scope 1 at $DIR/early_otherwise_branch.rs:15:24: 15:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:14:11: 14:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:14:12: 14:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:14:12: 14:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:14:14: 14:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:14:14: 14:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:14:11: 14:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:14:11: 14:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 +- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 ++ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 ++ _11 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 ++ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 ++ _12 = Ne(_11, _8); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 ++ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 ++ switchInt(move _12) -> [false: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 + } + + bb1: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 + switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 + } + + bb2: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:17:14: 17:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:17:14: 17:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:14:5: 18:6 + } + + bb3: { + _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:19: 15:26 + switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:19: 15:26 + } + + bb4: { + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:15:15: 15:16 + _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:15:15: 15:16 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:15:24: 15:25 + _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:15:24: 15:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:15:31: 15:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:15:31: 15:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:15:31: 15:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:15:31: 15:32 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:14:5: 18:6 + } + + bb5: { + _0 = const 0_usize; // scope 0 at $DIR/early_otherwise_branch.rs:16:25: 16:26 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:16:25: 16:26 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:14:5: 18:6 + } + + bb6: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:19:1: 19:2 + return; // scope 0 at $DIR/early_otherwise_branch.rs:19:2: 19:2 ++ } ++ ++ bb7 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch.rs:13:1: 19:2 ++ } ++ ++ bb8: { ++ switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.32bit new file mode 100644 index 0000000000000..38c303dc81413 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.32bit @@ -0,0 +1,105 @@ +- // MIR for `opt2` before EarlyOtherwiseBranch ++ // MIR for `opt2` after EarlyOtherwiseBranch + + fn opt2(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:12:9: 12:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:12:27: 12:28 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:12:47: 12:52 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + let _10: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 ++ let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 ++ let mut _12: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + scope 1 { + debug a => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + debug b => _10; // in scope 1 at $DIR/early_otherwise_branch.rs:14:24: 14:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 + _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 +- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ _11 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ _12 = Ne(_11, _8); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ switchInt(move _12) -> [false: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 + } + + bb1: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + } + + bb2: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:16:14: 16:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:16:14: 16:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 + } + + bb3: { + _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 + switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 + } + + bb4: { + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 + _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:14:31: 14:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:14:31: 14:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:14:31: 14:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:14:31: 14:32 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 + } + + bb5: { + _0 = const 0_usize; // scope 0 at $DIR/early_otherwise_branch.rs:15:25: 15:26 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:15:25: 15:26 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 + } + + bb6: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:18:1: 18:2 + return; // scope 0 at $DIR/early_otherwise_branch.rs:18:2: 18:2 ++ } ++ ++ bb7 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch.rs:12:1: 18:2 ++ } ++ ++ bb8: { ++ switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.64bit new file mode 100644 index 0000000000000..5449158bff0e1 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.64bit @@ -0,0 +1,105 @@ +- // MIR for `opt2` before EarlyOtherwiseBranch ++ // MIR for `opt2` after EarlyOtherwiseBranch + + fn opt2(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:12:9: 12:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:12:27: 12:28 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:12:47: 12:52 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + let _10: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 ++ let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 ++ let mut _12: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + scope 1 { + debug a => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + debug b => _10; // in scope 1 at $DIR/early_otherwise_branch.rs:14:24: 14:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 + _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 +- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ _11 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ _12 = Ne(_11, _8); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 ++ switchInt(move _12) -> [false: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 + } + + bb1: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + } + + bb2: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:16:14: 16:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:16:14: 16:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 + } + + bb3: { + _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 + switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 + } + + bb4: { + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 + _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:14:31: 14:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:14:31: 14:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:14:31: 14:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:14:31: 14:32 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 + } + + bb5: { + _0 = const 0_usize; // scope 0 at $DIR/early_otherwise_branch.rs:15:25: 15:26 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch.rs:15:25: 15:26 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 + } + + bb6: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:18:1: 18:2 + return; // scope 0 at $DIR/early_otherwise_branch.rs:18:2: 18:2 ++ } ++ ++ bb7 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch.rs:12:1: 18:2 ++ } ++ ++ bb8: { ++ switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch.rs b/src/test/mir-opt/early_otherwise_branch.rs new file mode 100644 index 0000000000000..a1ffcda746712 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch.rs @@ -0,0 +1,23 @@ +// compile-flags: -Z mir-opt-level=3 +// EMIT_MIR_FOR_EACH_BIT_WIDTH +// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff +fn opt1(x: Option, y:Option) -> usize { + match (x,y) { + (Some(a), Some(b)) => 0, + _ => 1 + } +} + +// EMIT_MIR early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff +fn opt2(x: Option, y:Option) -> usize { + match (x,y) { + (Some(a), Some(b)) => 0, + (None, None) => 0, + _ => 1 + } +} + +fn main() { + opt1(None, Some(0)); + opt2(None, Some(0)); +} diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff new file mode 100644 index 0000000000000..9c326895d296b --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff @@ -0,0 +1,117 @@ +- // MIR for `opt1` before EarlyOtherwiseBranch ++ // MIR for `opt1` after EarlyOtherwiseBranch + + fn opt1(_1: std::option::Option, _2: std::option::Option, _3: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:9: 5:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:27: 5:28 + debug z => _3; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:44: 5:45 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:64: 5:69 + let mut _4: (std::option::Option, std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + let mut _6: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + let mut _7: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 + let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 + let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + let _13: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 ++ let mut _14: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ let mut _15: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ let mut _16: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 ++ let mut _17: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + scope 1 { + debug a => _11; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + debug b => _12; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + debug c => _13; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + _5 = _1; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + _6 = _2; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + StorageLive(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + _7 = _3; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + (_4.0: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + (_4.1: std::option::Option) = move _6; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + (_4.2: std::option::Option) = move _7; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + StorageDead(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + _10 = discriminant((_4.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 +- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ _14 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ _15 = Ne(_14, _10); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ switchInt(move _15) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 + } + + bb2: { + _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 +- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageLive(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ _16 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ _17 = Ne(_16, _9); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageDead(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ switchInt(move _17) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 + } + + bb3: { + _8 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + } + + bb4: { + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + _11 = (((_4.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + _12 = (((_4.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + _13 = (((_4.2: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 + } + + bb5: { + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:1: 10:2 + return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:2: 10:2 ++ } ++ ++ bb6 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:1: 10:2 ++ } ++ ++ bb7: { ++ switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ } ++ ++ bb8: { ++ switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.32bit new file mode 100644 index 0000000000000..9a3f7614ad088 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.32bit @@ -0,0 +1,117 @@ +- // MIR for `opt1` before EarlyOtherwiseBranch ++ // MIR for `opt1` after EarlyOtherwiseBranch + + fn opt1(_1: std::option::Option, _2: std::option::Option, _3: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:9: 5:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:27: 5:28 + debug z => _3; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:44: 5:45 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:64: 5:69 + let mut _4: (std::option::Option, std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + let mut _6: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + let mut _7: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 + let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 + let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + let _13: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 ++ let mut _14: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ let mut _15: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ let mut _16: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 ++ let mut _17: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + scope 1 { + debug a => _11; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + debug b => _12; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + debug c => _13; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + _5 = _1; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + _6 = _2; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + StorageLive(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + _7 = _3; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + (_4.0: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + (_4.1: std::option::Option) = move _6; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + (_4.2: std::option::Option) = move _7; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + StorageDead(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + _10 = discriminant((_4.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 +- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ _14 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ _15 = Ne(_14, _10); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ switchInt(move _15) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } + goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 + } + + bb2: { + _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 +- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageLive(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ _16 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ _17 = Ne(_16, _9); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageDead(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ switchInt(move _17) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 + } + + bb3: { + _8 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + } + + bb4: { + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + _11 = (((_4.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + _12 = (((_4.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + _13 = (((_4.2: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } + StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 + } + + bb5: { + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:1: 10:2 + return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:2: 10:2 ++ } ++ ++ bb6 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:1: 10:2 ++ } ++ ++ bb7: { ++ switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ } ++ ++ bb8: { ++ switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.64bit new file mode 100644 index 0000000000000..9c326895d296b --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.64bit @@ -0,0 +1,117 @@ +- // MIR for `opt1` before EarlyOtherwiseBranch ++ // MIR for `opt1` after EarlyOtherwiseBranch + + fn opt1(_1: std::option::Option, _2: std::option::Option, _3: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:9: 5:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:27: 5:28 + debug z => _3; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:44: 5:45 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:64: 5:69 + let mut _4: (std::option::Option, std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + let mut _6: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + let mut _7: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 + let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 + let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + let _13: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 ++ let mut _14: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ let mut _15: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ let mut _16: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 ++ let mut _17: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + scope 1 { + debug a => _11; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + debug b => _12; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + debug c => _13; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + _5 = _1; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 + StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + _6 = _2; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 + StorageLive(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + _7 = _3; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 + (_4.0: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + (_4.1: std::option::Option) = move _6; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + (_4.2: std::option::Option) = move _7; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 + StorageDead(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 + _10 = discriminant((_4.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 +- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ _14 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ _15 = Ne(_14, _10); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 ++ switchInt(move _15) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 + } + + bb2: { + _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 +- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageLive(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ _16 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ _17 = Ne(_16, _9); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ StorageDead(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ switchInt(move _17) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 + } + + bb3: { + _8 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + } + + bb4: { + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + _11 = (((_4.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + _12 = (((_4.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 + StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + _13 = (((_4.2: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 + goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 + } + + bb5: { + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:1: 10:2 + return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:2: 10:2 ++ } ++ ++ bb6 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:1: 10:2 ++ } ++ ++ bb7: { ++ switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ } ++ ++ bb8: { ++ switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs new file mode 100644 index 0000000000000..ffb5de096c35d --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs @@ -0,0 +1,14 @@ +// compile-flags: -Z mir-opt-level=3 + +// EMIT_MIR_FOR_EACH_BIT_WIDTH +// EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff +fn opt1(x: Option, y:Option, z:Option) -> usize { + match (x,y,z) { + (Some(a), Some(b), Some(c)) => 0, + _ => 1 + } +} + +fn main() { + opt1(None, Some(0), None); +} diff --git a/src/test/mir-opt/early_otherwise_branch_68867.rs b/src/test/mir-opt/early_otherwise_branch_68867.rs new file mode 100644 index 0000000000000..abe666f9ca4f9 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_68867.rs @@ -0,0 +1,31 @@ +// compile-flags: -Z mir-opt-level=3 + +// example from #68867 +type CSSFloat = f32; + +pub enum ViewportPercentageLength { + Vw(CSSFloat), + Vh(CSSFloat), + Vmin(CSSFloat), + Vmax(CSSFloat), +} + +// EMIT_MIR early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +#[no_mangle] +pub extern "C" fn try_sum(x: &ViewportPercentageLength, + other: &ViewportPercentageLength) + -> Result { + use self::ViewportPercentageLength::*; + Ok(match (x, other) { + (&Vw(one), &Vw(other)) => Vw(one + other), + (&Vh(one), &Vh(other)) => Vh(one + other), + (&Vmin(one), &Vmin(other)) => Vmin(one + other), + (&Vmax(one), &Vmax(other)) => Vmax(one + other), + _ => return Err(()), + }) +} + + +fn main() { + try_sum(&ViewportPercentageLength::Vw(1.0), &ViewportPercentageLength::Vw(2.0)); +} diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff new file mode 100644 index 0000000000000..7a02a1c347069 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -0,0 +1,219 @@ +- // MIR for `try_sum` before EarlyOtherwiseBranch ++ // MIR for `try_sum` after EarlyOtherwiseBranch + + fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> std::result::Result { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:15:27: 15:28 + debug other => _2; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:16:27: 16:32 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/early_otherwise_branch_68867.rs:17:28: 17:64 + let mut _3: ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + let mut _4: (&ViewportPercentageLength, &ViewportPercentageLength); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:14: 19:24 + let mut _5: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:15: 19:16 + let mut _6: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:18: 19:23 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 + let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 + let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 + let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 + let _12: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 + let _13: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 + let mut _14: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:49 + let mut _15: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:41 + let mut _16: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:44: 20:49 + let _17: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 + let _18: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 + let mut _19: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:49 + let mut _20: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:41 + let mut _21: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:44: 21:49 + let _22: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 + let _23: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 + let mut _24: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:55 + let mut _25: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:47 + let mut _26: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:50: 22:55 + let _27: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 + let _28: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 + let mut _29: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:55 + let mut _30: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:47 + let mut _31: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:50: 23:55 + let mut _32: !; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:28 + let mut _33: (); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 ++ let mut _34: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 ++ let mut _35: bool; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 + scope 1 { + debug one => _12; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 + debug other => _13; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 + } + scope 2 { + debug one => _17; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 + debug other => _18; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 + } + scope 3 { + debug one => _22; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 + debug other => _23; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 + } + scope 4 { + debug one => _27; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 + debug other => _28; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:14: 19:24 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:15: 19:16 + _5 = _1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:15: 19:16 + StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:18: 19:23 + _6 = _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:18: 19:23 + (_4.0: &ViewportPercentageLength) = move _5; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:14: 19:24 + (_4.1: &ViewportPercentageLength) = move _6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:14: 19:24 + StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:23: 19:24 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:23: 19:24 + _11 = discriminant((*(_4.0: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 +- switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 ++ StorageLive(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 ++ _34 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 ++ StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 ++ _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 ++ StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 ++ switchInt(move _35) -> [false: bb13, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 + } + + bb1: { + _7 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 + switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 + } + + bb2: { + StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 + ((_0 as Err).0: ()) = const (); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 + // + literal: Const { ty: (), val: Value(Scalar()) } + discriminant(_0) = 1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 + StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:27: 24:28 + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:6: 25:7 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:1: 26:2 + goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:28 + } + + bb3: { + _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 + switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 + } + + bb4: { + _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 + switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 + } + + bb5: { + _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 + switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 + } + + bb6: { + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 + _12 = (((*(_4.0: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 + StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 + _13 = (((*(_4.1: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 + StorageLive(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:49 + StorageLive(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:41 + _15 = _12; // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:41 + StorageLive(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:44: 20:49 + _16 = _13; // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:44: 20:49 + _14 = Add(move _15, move _16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:49 + StorageDead(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:48: 20:49 + StorageDead(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:48: 20:49 + ((_3 as Vw).0: f32) = move _14; // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:35: 20:50 + discriminant(_3) = 0; // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:35: 20:50 + StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 + StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 + goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + } + + bb7: { + StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 + _17 = (((*(_4.0: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 + StorageLive(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 + _18 = (((*(_4.1: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 + StorageLive(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:49 + StorageLive(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:41 + _20 = _17; // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:41 + StorageLive(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:44: 21:49 + _21 = _18; // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:44: 21:49 + _19 = Add(move _20, move _21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:49 + StorageDead(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:48: 21:49 + StorageDead(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:48: 21:49 + ((_3 as Vh).0: f32) = move _19; // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:35: 21:50 + discriminant(_3) = 1; // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:35: 21:50 + StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 + StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 + StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 + goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + } + + bb8: { + StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 + _22 = (((*(_4.0: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 + StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 + _23 = (((*(_4.1: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 + StorageLive(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:55 + StorageLive(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:47 + _25 = _22; // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:47 + StorageLive(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:50: 22:55 + _26 = _23; // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:50: 22:55 + _24 = Add(move _25, move _26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:55 + StorageDead(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:54: 22:55 + StorageDead(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:54: 22:55 + ((_3 as Vmin).0: f32) = move _24; // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:39: 22:56 + discriminant(_3) = 2; // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:39: 22:56 + StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 + StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 + StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 + goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + } + + bb9: { + StorageLive(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 + _27 = (((*(_4.0: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 + StorageLive(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 + _28 = (((*(_4.1: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 + StorageLive(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:55 + StorageLive(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:47 + _30 = _27; // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:47 + StorageLive(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:50: 23:55 + _31 = _28; // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:50: 23:55 + _29 = Add(move _30, move _31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:55 + StorageDead(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:54: 23:55 + StorageDead(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:54: 23:55 + ((_3 as Vmax).0: f32) = move _29; // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:39: 23:56 + discriminant(_3) = 3; // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:39: 23:56 + StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 + StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 + StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 + goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + } + + bb10: { + return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 + } + + bb11: { + ((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 25:7 + discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 25:7 + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:6: 25:7 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:1: 26:2 + goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 ++ } ++ ++ bb12 (cleanup): { ++ resume; // scope 0 at $DIR/early_otherwise_branch_68867.rs:15:1: 26:2 ++ } ++ ++ bb13: { ++ switchInt(_11) -> [0_isize: bb6, 1_isize: bb7, 2_isize: bb8, 3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff new file mode 100644 index 0000000000000..9908843a2d864 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff @@ -0,0 +1,114 @@ +- // MIR for `noopt1` before EarlyOtherwiseBranch ++ // MIR for `noopt1` after EarlyOtherwiseBranch + + fn noopt1(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:12 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:29: 8:30 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:49: 8:54 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + let _10: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + scope 1 { + debug a => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + debug b => _10; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + } + scope 2 { + debug a => _11; // in scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + } + scope 3 { + debug b => _12; // in scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + switchInt(move _8) -> [0_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + } + + bb1: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + switchInt(move _6) -> [0_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + } + + bb2: { + _0 = const 3_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000003)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) } + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb3: { + _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + switchInt(move _7) -> [0_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + } + + bb4: { + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb5: { + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + _11 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + _0 = const 1_usize; // scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb6: { + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + _12 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + _0 = const 2_usize; // scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000002)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb7: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:1: 15:2 + return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:2: 15:2 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.32bit new file mode 100644 index 0000000000000..26842c74e6fd2 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.32bit @@ -0,0 +1,114 @@ +- // MIR for `noopt1` before EarlyOtherwiseBranch ++ // MIR for `noopt1` after EarlyOtherwiseBranch + + fn noopt1(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:12 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:29: 8:30 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:49: 8:54 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + let _10: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + scope 1 { + debug a => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + debug b => _10; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + } + scope 2 { + debug a => _11; // in scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + } + scope 3 { + debug b => _12; // in scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + switchInt(move _8) -> [0_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + } + + bb1: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + switchInt(move _6) -> [0_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + } + + bb2: { + _0 = const 3_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000003)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) } + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb3: { + _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + switchInt(move _7) -> [0_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + } + + bb4: { + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb5: { + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + _11 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + _0 = const 1_usize; // scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb6: { + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + _12 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + _0 = const 2_usize; // scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000002)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) } + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb7: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:1: 15:2 + return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:2: 15:2 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.64bit new file mode 100644 index 0000000000000..9908843a2d864 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.64bit @@ -0,0 +1,114 @@ +- // MIR for `noopt1` before EarlyOtherwiseBranch ++ // MIR for `noopt1` after EarlyOtherwiseBranch + + fn noopt1(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:12 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:29: 8:30 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:49: 8:54 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + let _9: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + let _10: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + scope 1 { + debug a => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + debug b => _10; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + } + scope 2 { + debug a => _11; // in scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + } + scope 3 { + debug b => _12; // in scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + switchInt(move _8) -> [0_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + } + + bb1: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + switchInt(move _6) -> [0_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + } + + bb2: { + _0 = const 3_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000003)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) } + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb3: { + _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + switchInt(move _7) -> [0_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + } + + bb4: { + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb5: { + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + _11 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + _0 = const 1_usize; // scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb6: { + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + _12 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + _0 = const 2_usize; // scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000002)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + } + + bb7: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:1: 15:2 + return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:2: 15:2 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff new file mode 100644 index 0000000000000..25391ab792013 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff @@ -0,0 +1,72 @@ +- // MIR for `noopt2` before EarlyOtherwiseBranch ++ // MIR for `noopt2` after EarlyOtherwiseBranch + + fn noopt2(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:12 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:29: 19:30 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:48: 19:53 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + let _8: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + let _9: bool; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + scope 1 { + debug a => _8; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + debug b => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 + } + + bb2: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + } + + bb3: { + StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + _9 = (((_3.1: std::option::Option) as Some).0: bool); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 + } + + bb4: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:1: 24:2 + return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:2: 24:2 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.32bit new file mode 100644 index 0000000000000..49dad4a02a404 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.32bit @@ -0,0 +1,72 @@ +- // MIR for `noopt2` before EarlyOtherwiseBranch ++ // MIR for `noopt2` after EarlyOtherwiseBranch + + fn noopt2(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:12 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:29: 19:30 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:48: 19:53 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + let _8: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + let _9: bool; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + scope 1 { + debug a => _8; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + debug b => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 + } + + bb2: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + } + + bb3: { + StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + _9 = (((_3.1: std::option::Option) as Some).0: bool); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 + } + + bb4: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:1: 24:2 + return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:2: 24:2 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.64bit new file mode 100644 index 0000000000000..25391ab792013 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.64bit @@ -0,0 +1,72 @@ +- // MIR for `noopt2` before EarlyOtherwiseBranch ++ // MIR for `noopt2` after EarlyOtherwiseBranch + + fn noopt2(_1: std::option::Option, _2: std::option::Option) -> usize { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:12 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:29: 19:30 + let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:48: 19:53 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + let _8: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + let _9: bool; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + scope 1 { + debug a => _8; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + debug b => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + } + + bb1: { + _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000001)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 + } + + bb2: { + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + } + + bb3: { + StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + _9 = (((_3.1: std::option::Option) as Some).0: bool); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + // ty::Const + // + ty: usize + // + val: Value(Scalar(0x0000000000000000)) + // mir::Constant + // + span: $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 + } + + bb4: { + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:1: 24:2 + return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:2: 24:2 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.rs b/src/test/mir-opt/early_otherwise_branch_noopt.rs new file mode 100644 index 0000000000000..8c4b37ac7a81f --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_noopt.rs @@ -0,0 +1,29 @@ +// compile-flags: -Z mir-opt-level=3 + +// must not optimize as it does not follow the pattern of +// left and right hand side being the same variant + +// EMIT_MIR_FOR_EACH_BIT_WIDTH +// EMIT_MIR early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff +fn noopt1(x: Option, y:Option) -> usize { + match (x,y) { + (Some(a), Some(b)) => 0, + (Some(a), None) => 1, + (None, Some(b)) => 2, + (None, None) => 3 + } +} + +// must not optimize as the types being matched on are not identical +// EMIT_MIR early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff +fn noopt2(x: Option, y:Option) -> usize { + match (x,y) { + (Some(a), Some(b)) => 0, + _ => 1 + } +} + +fn main() { + noopt1(None, Some(0)); + noopt2(None, Some(true)); +} From 5cc93950acb18c5b0978583ea518940336e847af Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sat, 19 Sep 2020 23:27:20 +0200 Subject: [PATCH 2/9] Update src/librustc_mir/transform/early_otherwise_branch.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Laurențiu Nicola --- compiler/rustc_mir/src/transform/early_otherwise_branch.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs index 0dc311ebb8c1f..e60cc8c1348d1 100644 --- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -20,7 +20,7 @@ use std::{borrow::Cow, fmt::Debug}; /// let x: Option<()>; /// let y: Option<()>; /// let discriminant_x = // get discriminant of x -/// let discriminant_y = // get discriminant of x +/// let discriminant_y = // get discriminant of y /// if discriminant_x != discriminant_y {1} else {0} /// ``` pub struct EarlyOtherwiseBranch; From 04834139c43761efd2b14e37e819774033241ba2 Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sat, 19 Sep 2020 23:38:54 +0200 Subject: [PATCH 3/9] replace usize with u32 to make it easier to bless --- src/test/mir-opt/early_otherwise_branch.rs | 13 ++++++------- .../early_otherwise_branch_3_element_tuple.rs | 7 +++---- src/test/mir-opt/early_otherwise_branch_noopt.rs | 13 ++++++------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/test/mir-opt/early_otherwise_branch.rs b/src/test/mir-opt/early_otherwise_branch.rs index a1ffcda746712..77003442080f4 100644 --- a/src/test/mir-opt/early_otherwise_branch.rs +++ b/src/test/mir-opt/early_otherwise_branch.rs @@ -1,19 +1,18 @@ // compile-flags: -Z mir-opt-level=3 -// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff -fn opt1(x: Option, y:Option) -> usize { - match (x,y) { +fn opt1(x: Option, y: Option) -> u32 { + match (x, y) { (Some(a), Some(b)) => 0, - _ => 1 + _ => 1, } } // EMIT_MIR early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff -fn opt2(x: Option, y:Option) -> usize { - match (x,y) { +fn opt2(x: Option, y: Option) -> u32 { + match (x, y) { (Some(a), Some(b)) => 0, (None, None) => 0, - _ => 1 + _ => 1, } } diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs index ffb5de096c35d..1d6877d67df82 100644 --- a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs @@ -1,11 +1,10 @@ // compile-flags: -Z mir-opt-level=3 -// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff -fn opt1(x: Option, y:Option, z:Option) -> usize { - match (x,y,z) { +fn opt1(x: Option, y: Option, z: Option) -> u32 { + match (x, y, z) { (Some(a), Some(b), Some(c)) => 0, - _ => 1 + _ => 1, } } diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.rs b/src/test/mir-opt/early_otherwise_branch_noopt.rs index 8c4b37ac7a81f..bd15f520dfcd4 100644 --- a/src/test/mir-opt/early_otherwise_branch_noopt.rs +++ b/src/test/mir-opt/early_otherwise_branch_noopt.rs @@ -3,23 +3,22 @@ // must not optimize as it does not follow the pattern of // left and right hand side being the same variant -// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff -fn noopt1(x: Option, y:Option) -> usize { - match (x,y) { +fn noopt1(x: Option, y: Option) -> u32 { + match (x, y) { (Some(a), Some(b)) => 0, (Some(a), None) => 1, (None, Some(b)) => 2, - (None, None) => 3 + (None, None) => 3, } } // must not optimize as the types being matched on are not identical // EMIT_MIR early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff -fn noopt2(x: Option, y:Option) -> usize { - match (x,y) { +fn noopt2(x: Option, y: Option) -> u32 { + match (x, y) { (Some(a), Some(b)) => 0, - _ => 1 + _ => 1, } } From 0e06456ecbe244291f1feef7c24b7165f028e0d0 Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sat, 19 Sep 2020 23:50:51 +0200 Subject: [PATCH 4/9] bless --- ...wise_branch.opt1.EarlyOtherwiseBranch.diff | 108 ++++++------ ...wise_branch.opt2.EarlyOtherwiseBranch.diff | 124 ++++++-------- ...ement_tuple.opt1.EarlyOtherwiseBranch.diff | 154 ++++++++---------- ...ch_68867.try_sum.EarlyOtherwiseBranch.diff | 6 - ...nch_noopt.noopt1.EarlyOtherwiseBranch.diff | 134 +++++++-------- ...nch_noopt.noopt2.EarlyOtherwiseBranch.diff | 88 +++++----- 6 files changed, 265 insertions(+), 349 deletions(-) diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff index 28c9d422a9f4f..9f9c28723f07b 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff @@ -1,88 +1,76 @@ - // MIR for `opt1` before EarlyOtherwiseBranch + // MIR for `opt1` after EarlyOtherwiseBranch - fn opt1(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:5:9: 5:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:5:27: 5:28 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:5:47: 5:52 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:6:11: 6:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:6:12: 6:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 - let _8: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:15: 7:16 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:24: 7:25 -+ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 -+ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 + fn opt1(_1: Option, _2: Option) -> u32 { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:3:9: 3:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:3:25: 3:26 + let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch.rs:3:44: 3:47 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:4:11: 4:17 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:4:12: 4:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:4:15: 4:16 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 + let _8: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 + let _9: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:5:24: 5:25 ++ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 ++ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 scope 1 { - debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:7:15: 7:16 - debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:7:24: 7:25 + debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:5:15: 5:16 + debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:5:24: 5:25 } bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:6:11: 6:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:6:12: 6:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:6:12: 6:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:6:11: 6:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:6:11: 6:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 -- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 -+ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 -+ _10 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 -+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 -+ _11 = Ne(_10, _7); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 -+ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 -+ switchInt(move _11) -> [false: bb6, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:7:10: 7:17 + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:4:11: 4:17 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:4:12: 4:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:4:12: 4:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:4:15: 4:16 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:4:15: 4:16 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:4:11: 4:17 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:4:11: 4:17 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:4:16: 4:17 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:4:16: 4:17 + _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 +- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 ++ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 ++ _10 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 ++ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 ++ _11 = Ne(_10, _7); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 ++ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 ++ switchInt(move _11) -> [false: bb6, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 } bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:8:14: 8:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:8:14: 8:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:6:5: 9:6 + _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 } bb2: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 - switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 + switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 } bb3: { - StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:7:15: 7:16 - _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:7:15: 7:16 - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:7:24: 7:25 - _9 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:7:24: 7:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:7:31: 7:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:7:31: 7:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:7:31: 7:32 - StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:7:31: 7:32 - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:6:5: 9:6 + StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 + _8 = (((_3.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:5:24: 5:25 + _9 = (((_3.1: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:5:24: 5:25 + _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch.rs:5:31: 5:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:5:31: 5:32 + StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:5:31: 5:32 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 } bb4: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:10:1: 10:2 - return; // scope 0 at $DIR/early_otherwise_branch.rs:10:2: 10:2 + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:8:1: 8:2 + return; // scope 0 at $DIR/early_otherwise_branch.rs:8:2: 8:2 + } + + bb5 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch.rs:5:1: 10:2 ++ resume; // scope 0 at $DIR/early_otherwise_branch.rs:3:1: 8:2 + } + + bb6: { -+ switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:7:19: 7:26 ++ switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 } } diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff index 1868f4f5be1b6..569dc6c5db61e 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff @@ -1,105 +1,87 @@ - // MIR for `opt2` before EarlyOtherwiseBranch + // MIR for `opt2` after EarlyOtherwiseBranch - fn opt2(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:13:9: 13:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:13:27: 13:28 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:13:47: 13:52 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:14:11: 14:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:14:12: 14:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:14:14: 14:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:19: 15:26 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:15: 15:16 - let _10: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:24: 15:25 -+ let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 -+ let mut _12: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 + fn opt2(_1: Option, _2: Option) -> u32 { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:11:9: 11:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:11:25: 11:26 + let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch.rs:11:44: 11:47 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:12:11: 12:17 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:12:12: 12:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:12:15: 12:16 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:13:19: 13:26 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 + let _9: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 + let _10: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:13:24: 13:25 ++ let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 ++ let mut _12: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 scope 1 { - debug a => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:15:15: 15:16 - debug b => _10; // in scope 1 at $DIR/early_otherwise_branch.rs:15:24: 15:25 + debug a => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:13:15: 13:16 + debug b => _10; // in scope 1 at $DIR/early_otherwise_branch.rs:13:24: 13:25 } bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:14:11: 14:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:14:12: 14:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:14:12: 14:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:14:14: 14:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:14:14: 14:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:14:11: 14:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:14:11: 14:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 -- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 -+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 -+ _11 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 -+ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 -+ _12 = Ne(_11, _8); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 -+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 -+ switchInt(move _12) -> [false: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:10: 15:17 + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:12:11: 12:17 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:12:12: 12:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:12:12: 12:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:12:15: 12:16 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:12:15: 12:16 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:12:11: 12:17 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:12:11: 12:17 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:12:16: 12:17 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:12:16: 12:17 + _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 +- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 ++ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 ++ _11 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 ++ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 ++ _12 = Ne(_11, _8); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 ++ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 ++ switchInt(move _12) -> [false: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 } bb1: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 - switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 + switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 } bb2: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:17:14: 17:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:17:14: 17:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:14:5: 18:6 + _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:15:14: 15:15 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 } bb3: { - _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:19: 15:26 - switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:19: 15:26 + _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:13:19: 13:26 + switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:13:19: 13:26 } bb4: { - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:15:15: 15:16 - _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:15:15: 15:16 - StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:15:24: 15:25 - _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:15:24: 15:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:15:31: 15:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:15:31: 15:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:15:31: 15:32 - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:15:31: 15:32 - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:14:5: 18:6 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 + _9 = (((_3.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:13:24: 13:25 + _10 = (((_3.1: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:13:24: 13:25 + _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch.rs:13:31: 13:32 + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:13:31: 13:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:13:31: 13:32 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 } bb5: { - _0 = const 0_usize; // scope 0 at $DIR/early_otherwise_branch.rs:16:25: 16:26 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:16:25: 16:26 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:14:5: 18:6 + _0 = const 0_u32; // scope 0 at $DIR/early_otherwise_branch.rs:14:25: 14:26 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 } bb6: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:19:1: 19:2 - return; // scope 0 at $DIR/early_otherwise_branch.rs:19:2: 19:2 + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:17:1: 17:2 + return; // scope 0 at $DIR/early_otherwise_branch.rs:17:2: 17:2 + } + + bb7 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch.rs:13:1: 19:2 ++ resume; // scope 0 at $DIR/early_otherwise_branch.rs:11:1: 17:2 + } + + bb8: { -+ switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:16:16: 16:20 ++ switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 } } diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff index 9c326895d296b..9d45aa69f6336 100644 --- a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff @@ -1,117 +1,105 @@ - // MIR for `opt1` before EarlyOtherwiseBranch + // MIR for `opt1` after EarlyOtherwiseBranch - fn opt1(_1: std::option::Option, _2: std::option::Option, _3: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:9: 5:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:27: 5:28 - debug z => _3; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:44: 5:45 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:64: 5:69 - let mut _4: (std::option::Option, std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - let mut _6: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - let mut _7: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 - let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 - let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - let _13: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 -+ let mut _14: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ let mut _15: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ let mut _16: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 -+ let mut _17: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + fn opt1(_1: Option, _2: Option, _3: Option) -> u32 { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:4:9: 4:10 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:4:25: 4:26 + debug z => _3; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:4:41: 4:42 + let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:4:60: 4:63 + let mut _4: (std::option::Option, std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:11: 5:20 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:12: 5:13 + let mut _6: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:15: 5:16 + let mut _7: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:18: 5:19 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 + let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 + let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 + let _11: u32; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:15: 6:16 + let _12: u32; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:24: 6:25 + let _13: u32; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:33: 6:34 ++ let mut _14: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 ++ let mut _15: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 ++ let mut _16: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 ++ let mut _17: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 scope 1 { - debug a => _11; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - debug b => _12; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - debug c => _13; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 + debug a => _11; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:15: 6:16 + debug b => _12; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:24: 6:25 + debug c => _13; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:33: 6:34 } bb0: { - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - _5 = _1; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - _6 = _2; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - StorageLive(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - _7 = _3; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - (_4.0: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - (_4.1: std::option::Option) = move _6; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - (_4.2: std::option::Option) = move _7; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - StorageDead(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - _10 = discriminant((_4.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ _14 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ _15 = Ne(_14, _10); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ switchInt(move _15) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:11: 5:20 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:12: 5:13 + _5 = _1; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:12: 5:13 + StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:15: 5:16 + _6 = _2; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:15: 5:16 + StorageLive(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:18: 5:19 + _7 = _3; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:18: 5:19 + (_4.0: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:11: 5:20 + (_4.1: std::option::Option) = move _6; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:11: 5:20 + (_4.2: std::option::Option) = move _7; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:11: 5:20 + StorageDead(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:19: 5:20 + StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:19: 5:20 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:19: 5:20 + _10 = discriminant((_4.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 +- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 ++ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 ++ _14 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 ++ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 ++ _15 = Ne(_14, _10); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 ++ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 ++ switchInt(move _15) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 } bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 + _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:14: 7:15 + goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 } bb2: { - _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageLive(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ _16 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ _17 = Ne(_16, _9); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageDead(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ switchInt(move _17) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 + _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 +- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 ++ StorageLive(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 ++ _16 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 ++ StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 ++ _17 = Ne(_16, _9); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 ++ StorageDead(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 ++ switchInt(move _17) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 } bb3: { - _8 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 + _8 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 + switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 } bb4: { - StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - _11 = (((_4.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - _12 = (((_4.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 - _13 = (((_4.2: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:15: 6:16 + _11 = (((_4.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:15: 6:16 + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:24: 6:25 + _12 = (((_4.1: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:24: 6:25 + StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:33: 6:34 + _13 = (((_4.2: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:33: 6:34 + _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:40: 6:41 + StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:40: 6:41 + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:40: 6:41 + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:40: 6:41 + goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 } bb5: { - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:1: 10:2 - return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:2: 10:2 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:9:1: 9:2 + return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:9:2: 9:2 + } + + bb6 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:1: 10:2 ++ resume; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:4:1: 9:2 + } + + bb7: { -+ switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 ++ switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 + } + + bb8: { -+ switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 ++ switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 } } diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff index 7a02a1c347069..f08920ef06de3 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -84,12 +84,6 @@ bb2: { StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 ((_0 as Err).0: ()) = const (); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 - // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant - // + span: $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 - // + literal: Const { ty: (), val: Value(Scalar()) } discriminant(_0) = 1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:27: 24:28 StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:6: 25:7 diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff index 9908843a2d864..9a6094f12dfb1 100644 --- a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff @@ -1,114 +1,90 @@ - // MIR for `noopt1` before EarlyOtherwiseBranch + // MIR for `noopt1` after EarlyOtherwiseBranch - fn noopt1(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:12 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:29: 8:30 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:49: 8:54 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - let _10: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + fn noopt1(_1: Option, _2: Option) -> u32 { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:7:11: 7:12 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:7:27: 7:28 + let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:7:46: 7:49 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:17 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:12: 8:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:15: 8:16 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:16: 11:23 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:19: 9:26 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:10: 9:17 + let _9: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + let _10: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:24: 9:25 + let _11: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + let _12: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:21: 11:22 scope 1 { - debug a => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - debug b => _10; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 + debug a => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + debug b => _10; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:9:24: 9:25 } scope 2 { - debug a => _11; // in scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 + debug a => _11; // in scope 2 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 } scope 3 { - debug b => _12; // in scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 + debug b => _12; // in scope 3 at $DIR/early_otherwise_branch_noopt.rs:11:21: 11:22 } bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 - _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 - switchInt(move _8) -> [0_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:17 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:12: 8:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:12: 8:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:15: 8:16 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:15: 8:16 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:17 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:17 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:16: 8:17 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:16: 8:17 + _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:10: 9:17 + switchInt(move _8) -> [0_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:10: 9:17 } bb1: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 - switchInt(move _6) -> [0_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:16: 11:23 + switchInt(move _6) -> [0_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:16: 11:23 } bb2: { - _0 = const 3_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000003)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) } - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + _0 = const 3_u32; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:25: 12:26 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:5: 13:6 } bb3: { - _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 - switchInt(move _7) -> [0_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 + _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:19: 9:26 + switchInt(move _7) -> [0_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:19: 9:26 } bb4: { - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + _9 = (((_3.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:24: 9:25 + _10 = (((_3.1: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:24: 9:25 + _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:9:31: 9:32 + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:31: 9:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:31: 9:32 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:5: 13:6 } bb5: { - StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - _11 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - _0 = const 1_usize; // scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + _11 = (((_3.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 + _0 = const 1_u32; // scope 2 at $DIR/early_otherwise_branch_noopt.rs:10:28: 10:29 + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:28: 10:29 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:5: 13:6 } bb6: { - StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - _12 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - _0 = const 2_usize; // scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000002)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:21: 11:22 + _12 = (((_3.1: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:21: 11:22 + _0 = const 2_u32; // scope 3 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 + goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:5: 13:6 } bb7: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:1: 15:2 - return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:2: 15:2 + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:14:1: 14:2 + return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:14:2: 14:2 } } diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff index 25391ab792013..c3aecb4529351 100644 --- a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff @@ -1,72 +1,60 @@ - // MIR for `noopt2` before EarlyOtherwiseBranch + // MIR for `noopt2` after EarlyOtherwiseBranch - fn noopt2(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:12 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:29: 19:30 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:48: 19:53 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 - let _8: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - let _9: bool; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + fn noopt2(_1: Option, _2: Option) -> u32 { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:18:11: 18:12 + debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:18:27: 18:28 + let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:18:47: 18:50 + let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:17 + let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:12: 19:13 + let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:15: 19:16 + let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:19: 20:26 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:10: 20:17 + let _8: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + let _9: bool; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:24: 20:25 scope 1 { - debug a => _8; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - debug b => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 + debug a => _8; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + debug b => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:20:24: 20:25 } bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 - _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 - switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:17 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:12: 19:13 + _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:12: 19:13 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:15: 19:16 + _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:15: 19:16 + (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:17 + (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:17 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:16: 19:17 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:16: 19:17 + _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:10: 20:17 + switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:10: 20:17 } bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 + _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:14: 21:15 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:5: 22:6 } bb2: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 - switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 + _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:19: 20:26 + switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:19: 20:26 } bb3: { - StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - _9 = (((_3.1: std::option::Option) as Some).0: bool); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 + StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + _8 = (((_3.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 + StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:24: 20:25 + _9 = (((_3.1: std::option::Option) as Some).0: bool); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:24: 20:25 + _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:20:31: 20:32 + StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:31: 20:32 + StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:31: 20:32 + goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:5: 22:6 } bb4: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:1: 24:2 - return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:2: 24:2 + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:23:1: 23:2 + return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:23:2: 23:2 } } From 25302740231152bccebc391e893d48ef9f3ca50a Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sat, 19 Sep 2020 23:53:18 +0200 Subject: [PATCH 5/9] correct comment --- .../src/transform/early_otherwise_branch.rs | 2 +- ...ranch.opt1.EarlyOtherwiseBranch.diff.32bit | 88 ------------- ...ranch.opt1.EarlyOtherwiseBranch.diff.64bit | 88 ------------- ...ranch.opt2.EarlyOtherwiseBranch.diff.32bit | 105 ---------------- ...ranch.opt2.EarlyOtherwiseBranch.diff.64bit | 105 ---------------- ...tuple.opt1.EarlyOtherwiseBranch.diff.32bit | 117 ------------------ ...tuple.opt1.EarlyOtherwiseBranch.diff.64bit | 117 ------------------ ...opt.noopt1.EarlyOtherwiseBranch.diff.32bit | 114 ----------------- ...opt.noopt1.EarlyOtherwiseBranch.diff.64bit | 114 ----------------- ...opt.noopt2.EarlyOtherwiseBranch.diff.32bit | 72 ----------- ...opt.noopt2.EarlyOtherwiseBranch.diff.64bit | 72 ----------- 11 files changed, 1 insertion(+), 993 deletions(-) delete mode 100644 src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.32bit delete mode 100644 src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.64bit delete mode 100644 src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.32bit delete mode 100644 src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.64bit delete mode 100644 src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.32bit delete mode 100644 src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.64bit delete mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.32bit delete mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.64bit delete mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.32bit delete mode 100644 src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.64bit diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs index e60cc8c1348d1..d44bd1e3495a3 100644 --- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -21,7 +21,7 @@ use std::{borrow::Cow, fmt::Debug}; /// let y: Option<()>; /// let discriminant_x = // get discriminant of x /// let discriminant_y = // get discriminant of y -/// if discriminant_x != discriminant_y {1} else {0} +/// if discriminant_x != discriminant_y || discriminant_x == None {1} else {0} /// ``` pub struct EarlyOtherwiseBranch; diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.32bit deleted file mode 100644 index dbeb09bf2bbc8..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.32bit +++ /dev/null @@ -1,88 +0,0 @@ -- // MIR for `opt1` before EarlyOtherwiseBranch -+ // MIR for `opt1` after EarlyOtherwiseBranch - - fn opt1(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:4:9: 4:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:4:27: 4:28 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:4:47: 4:52 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 - let _8: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 -+ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 -+ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - scope 1 { - debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:6:24: 6:25 - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 - _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ _10 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ _11 = Ne(_10, _7); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ switchInt(move _11) -> [false: bb6, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 - } - - bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:7:14: 7:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:7:14: 7:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:5:5: 8:6 - } - - bb2: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - } - - bb3: { - StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 - _9 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:6:31: 6:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:6:31: 6:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:6:31: 6:32 - StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:6:31: 6:32 - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:5:5: 8:6 - } - - bb4: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:9:1: 9:2 - return; // scope 0 at $DIR/early_otherwise_branch.rs:9:2: 9:2 -+ } -+ -+ bb5 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch.rs:4:1: 9:2 -+ } -+ -+ bb6: { -+ switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.64bit deleted file mode 100644 index 62a40a440db16..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff.64bit +++ /dev/null @@ -1,88 +0,0 @@ -- // MIR for `opt1` before EarlyOtherwiseBranch -+ // MIR for `opt1` after EarlyOtherwiseBranch - - fn opt1(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:4:9: 4:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:4:27: 4:28 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:4:47: 4:52 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 - let _8: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 -+ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 -+ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - scope 1 { - debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:6:24: 6:25 - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:5:12: 5:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:5:14: 5:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:5:11: 5:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 - _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ _10 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ _11 = Ne(_10, _7); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 -+ switchInt(move _11) -> [false: bb6, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:10: 6:17 - } - - bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:7:14: 7:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:7:14: 7:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:5:5: 8:6 - } - - bb2: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - } - - bb3: { - StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:6:15: 6:16 - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 - _9 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:6:24: 6:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:6:31: 6:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:6:31: 6:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:6:31: 6:32 - StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:6:31: 6:32 - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:5:5: 8:6 - } - - bb4: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:9:1: 9:2 - return; // scope 0 at $DIR/early_otherwise_branch.rs:9:2: 9:2 -+ } -+ -+ bb5 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch.rs:4:1: 9:2 -+ } -+ -+ bb6: { -+ switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:6:19: 6:26 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.32bit deleted file mode 100644 index 38c303dc81413..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.32bit +++ /dev/null @@ -1,105 +0,0 @@ -- // MIR for `opt2` before EarlyOtherwiseBranch -+ // MIR for `opt2` after EarlyOtherwiseBranch - - fn opt2(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:12:9: 12:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:12:27: 12:28 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:12:47: 12:52 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - let _10: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 -+ let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 -+ let mut _12: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - scope 1 { - debug a => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - debug b => _10; // in scope 1 at $DIR/early_otherwise_branch.rs:14:24: 14:25 - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 - _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ _11 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ _12 = Ne(_11, _8); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ switchInt(move _12) -> [false: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 - } - - bb1: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - } - - bb2: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:16:14: 16:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:16:14: 16:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 - } - - bb3: { - _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 - switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 - } - - bb4: { - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 - _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:14:31: 14:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:14:31: 14:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } - StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:14:31: 14:32 - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:14:31: 14:32 - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 - } - - bb5: { - _0 = const 0_usize; // scope 0 at $DIR/early_otherwise_branch.rs:15:25: 15:26 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:15:25: 15:26 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 - } - - bb6: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:18:1: 18:2 - return; // scope 0 at $DIR/early_otherwise_branch.rs:18:2: 18:2 -+ } -+ -+ bb7 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch.rs:12:1: 18:2 -+ } -+ -+ bb8: { -+ switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.64bit deleted file mode 100644 index 5449158bff0e1..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff.64bit +++ /dev/null @@ -1,105 +0,0 @@ -- // MIR for `opt2` before EarlyOtherwiseBranch -+ // MIR for `opt2` after EarlyOtherwiseBranch - - fn opt2(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:12:9: 12:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:12:27: 12:28 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch.rs:12:47: 12:52 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - let _10: usize; // in scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 -+ let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 -+ let mut _12: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - scope 1 { - debug a => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - debug b => _10; // in scope 1 at $DIR/early_otherwise_branch.rs:14:24: 14:25 - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:13:12: 13:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:13:14: 13:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch.rs:13:11: 13:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 - _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ _11 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ _12 = Ne(_11, _8); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 -+ switchInt(move _12) -> [false: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:10: 14:17 - } - - bb1: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - } - - bb2: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch.rs:16:14: 16:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:16:14: 16:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 - } - - bb3: { - _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 - switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:19: 14:26 - } - - bb4: { - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:14:15: 14:16 - StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 - _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch.rs:14:24: 14:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch.rs:14:31: 14:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:14:31: 14:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:14:31: 14:32 - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:14:31: 14:32 - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 - } - - bb5: { - _0 = const 0_usize; // scope 0 at $DIR/early_otherwise_branch.rs:15:25: 15:26 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch.rs:15:25: 15:26 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:13:5: 17:6 - } - - bb6: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:18:1: 18:2 - return; // scope 0 at $DIR/early_otherwise_branch.rs:18:2: 18:2 -+ } -+ -+ bb7 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch.rs:12:1: 18:2 -+ } -+ -+ bb8: { -+ switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:15:16: 15:20 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.32bit deleted file mode 100644 index 9a3f7614ad088..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.32bit +++ /dev/null @@ -1,117 +0,0 @@ -- // MIR for `opt1` before EarlyOtherwiseBranch -+ // MIR for `opt1` after EarlyOtherwiseBranch - - fn opt1(_1: std::option::Option, _2: std::option::Option, _3: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:9: 5:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:27: 5:28 - debug z => _3; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:44: 5:45 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:64: 5:69 - let mut _4: (std::option::Option, std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - let mut _6: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - let mut _7: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 - let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 - let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - let _13: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 -+ let mut _14: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ let mut _15: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ let mut _16: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 -+ let mut _17: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - scope 1 { - debug a => _11; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - debug b => _12; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - debug c => _13; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 - } - - bb0: { - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - _5 = _1; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - _6 = _2; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - StorageLive(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - _7 = _3; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - (_4.0: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - (_4.1: std::option::Option) = move _6; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - (_4.2: std::option::Option) = move _7; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - StorageDead(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - _10 = discriminant((_4.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ _14 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ _15 = Ne(_14, _10); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ switchInt(move _15) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 - } - - bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } - goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 - } - - bb2: { - _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageLive(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ _16 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ _17 = Ne(_16, _9); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageDead(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ switchInt(move _17) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 - } - - bb3: { - _8 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - } - - bb4: { - StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - _11 = (((_4.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - _12 = (((_4.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 - _13 = (((_4.2: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } - StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 - } - - bb5: { - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:1: 10:2 - return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:2: 10:2 -+ } -+ -+ bb6 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:1: 10:2 -+ } -+ -+ bb7: { -+ switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ } -+ -+ bb8: { -+ switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.64bit deleted file mode 100644 index 9c326895d296b..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff.64bit +++ /dev/null @@ -1,117 +0,0 @@ -- // MIR for `opt1` before EarlyOtherwiseBranch -+ // MIR for `opt1` after EarlyOtherwiseBranch - - fn opt1(_1: std::option::Option, _2: std::option::Option, _3: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:9: 5:10 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:27: 5:28 - debug z => _3; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:44: 5:45 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:64: 5:69 - let mut _4: (std::option::Option, std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - let mut _6: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - let mut _7: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 - let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 - let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - let _13: usize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 -+ let mut _14: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ let mut _15: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ let mut _16: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 -+ let mut _17: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - scope 1 { - debug a => _11; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - debug b => _12; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - debug c => _13; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 - } - - bb0: { - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - _5 = _1; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:12: 6:13 - StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - _6 = _2; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:14: 6:15 - StorageLive(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - _7 = _3; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:16: 6:17 - (_4.0: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - (_4.1: std::option::Option) = move _6; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - (_4.2: std::option::Option) = move _7; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:11: 6:18 - StorageDead(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:17: 6:18 - _10 = discriminant((_4.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ _14 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ _15 = Ne(_14, _10); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 -+ switchInt(move _15) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:10: 7:17 - } - - bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:8:14: 8:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 - } - - bb2: { - _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageLive(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ _16 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ _17 = Ne(_16, _9); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ StorageDead(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ switchInt(move _17) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 - } - - bb3: { - _8 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - } - - bb4: { - StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - _11 = (((_4.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:15: 7:16 - StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - _12 = (((_4.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:24: 7:25 - StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 - _13 = (((_4.2: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:33: 7:34 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:40: 7:41 - goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:5: 9:6 - } - - bb5: { - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:1: 10:2 - return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:10:2: 10:2 -+ } -+ -+ bb6 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:1: 10:2 -+ } -+ -+ bb7: { -+ switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:19: 7:26 -+ } -+ -+ bb8: { -+ switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:28: 7:35 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.32bit deleted file mode 100644 index 26842c74e6fd2..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.32bit +++ /dev/null @@ -1,114 +0,0 @@ -- // MIR for `noopt1` before EarlyOtherwiseBranch -+ // MIR for `noopt1` after EarlyOtherwiseBranch - - fn noopt1(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:12 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:29: 8:30 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:49: 8:54 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - let _10: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - scope 1 { - debug a => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - debug b => _10; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - } - scope 2 { - debug a => _11; // in scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - } - scope 3 { - debug b => _12; // in scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 - _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 - switchInt(move _8) -> [0_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 - } - - bb1: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 - switchInt(move _6) -> [0_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 - } - - bb2: { - _0 = const 3_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000003)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) } - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 - } - - bb3: { - _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 - switchInt(move _7) -> [0_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 - } - - bb4: { - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } - StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 - } - - bb5: { - StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - _11 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - _0 = const 1_usize; // scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } - StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 - } - - bb6: { - StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - _12 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - _0 = const 2_usize; // scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000002)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) } - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 - } - - bb7: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:1: 15:2 - return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:2: 15:2 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.64bit deleted file mode 100644 index 9908843a2d864..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff.64bit +++ /dev/null @@ -1,114 +0,0 @@ -- // MIR for `noopt1` before EarlyOtherwiseBranch -+ // MIR for `noopt1` after EarlyOtherwiseBranch - - fn noopt1(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:11: 8:12 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:29: 8:30 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:8:49: 8:54 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 - let _9: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - let _10: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - let _11: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - let _12: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - scope 1 { - debug a => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - debug b => _10; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - } - scope 2 { - debug a => _11; // in scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - } - scope 3 { - debug b => _12; // in scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:12: 9:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:14: 9:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:11: 9:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:15: 9:16 - _8 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 - switchInt(move _8) -> [0_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:10: 10:17 - } - - bb1: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 - switchInt(move _6) -> [0_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:16: 12:23 - } - - bb2: { - _0 = const 3_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000003)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:13:25: 13:26 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) } - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 - } - - bb3: { - _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 - switchInt(move _7) -> [0_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:19: 10:26 - } - - bb4: { - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - _9 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:15: 10:16 - StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - _10 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:24: 10:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:10:31: 10:32 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 - } - - bb5: { - StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - _11 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:15: 11:16 - _0 = const 1_usize; // scope 2 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:11:28: 11:29 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 - } - - bb6: { - StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - _12 = (((_3.1: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:21: 12:22 - _0 = const 2_usize; // scope 3 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000002)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) } - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:12:28: 12:29 - goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:9:5: 14:6 - } - - bb7: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:1: 15:2 - return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:15:2: 15:2 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.32bit b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.32bit deleted file mode 100644 index 49dad4a02a404..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.32bit +++ /dev/null @@ -1,72 +0,0 @@ -- // MIR for `noopt2` before EarlyOtherwiseBranch -+ // MIR for `noopt2` after EarlyOtherwiseBranch - - fn noopt2(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:12 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:29: 19:30 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:48: 19:53 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 - let _8: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - let _9: bool; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - scope 1 { - debug a => _8; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - debug b => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 - _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 - switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 - } - - bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) } - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 - } - - bb2: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 - switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 - } - - bb3: { - StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - _9 = (((_3.1: std::option::Option) as Some).0: bool); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x00000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) } - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 - } - - bb4: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:1: 24:2 - return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:2: 24:2 - } - } - diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.64bit b/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.64bit deleted file mode 100644 index 25391ab792013..0000000000000 --- a/src/test/mir-opt/early_otherwise_branch_noopt.noopt2.EarlyOtherwiseBranch.diff.64bit +++ /dev/null @@ -1,72 +0,0 @@ -- // MIR for `noopt2` before EarlyOtherwiseBranch -+ // MIR for `noopt2` after EarlyOtherwiseBranch - - fn noopt2(_1: std::option::Option, _2: std::option::Option) -> usize { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:11: 19:12 - debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:29: 19:30 - let mut _0: usize; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:19:48: 19:53 - let mut _3: (std::option::Option, std::option::Option); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - let mut _4: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - let mut _5: std::option::Option; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 - let _8: usize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - let _9: bool; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - scope 1 { - debug a => _8; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - debug b => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:12: 20:13 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:14: 20:15 - (_3.0: std::option::Option) = move _4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - (_3.1: std::option::Option) = move _5; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:11: 20:16 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:15: 20:16 - _7 = discriminant((_3.0: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 - switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:10: 21:17 - } - - bb1: { - _0 = const 1_usize; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000001)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:22:14: 22:15 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 - } - - bb2: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 - switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:19: 21:26 - } - - bb3: { - StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - _8 = (((_3.0: std::option::Option) as Some).0: usize); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:15: 21:16 - StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - _9 = (((_3.1: std::option::Option) as Some).0: bool); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:24: 21:25 - _0 = const 0_usize; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - // ty::Const - // + ty: usize - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) } - StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:21:31: 21:32 - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:20:5: 23:6 - } - - bb4: { - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:1: 24:2 - return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:24:2: 24:2 - } - } - From 118aae2af1a8dfa9500b26f2542825291c9ae1f8 Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sun, 20 Sep 2020 01:09:18 +0200 Subject: [PATCH 6/9] insert storageDead for not equal temp --- .../src/transform/early_otherwise_branch.rs | 38 +++++++++++++------ ...wise_branch.opt1.EarlyOtherwiseBranch.diff | 2 + ...wise_branch.opt2.EarlyOtherwiseBranch.diff | 2 + ...ement_tuple.opt1.EarlyOtherwiseBranch.diff | 4 ++ ...ch_68867.try_sum.EarlyOtherwiseBranch.diff | 2 + 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs index d44bd1e3495a3..b0b9d5a889561 100644 --- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -46,27 +46,32 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { for opt_to_apply in opts_to_apply { trace!("SUCCESS: found optimization possibility to apply: {:?}", &opt_to_apply); - // create the patch using MirPatch - let mut patch = MirPatch::new(body); - // create temp to store second discriminant in - let discr_type = opt_to_apply.infos[0].second_switch_info.discr_ty; - let discr_span = opt_to_apply.infos[0].second_switch_info.discr_source_info.span; - let temp = patch.new_temp(discr_type, discr_span); let statements_before = body.basic_blocks()[opt_to_apply.basic_block_first_switch].statements.len(); let end_of_block_location = Location { block: opt_to_apply.basic_block_first_switch, statement_index: statements_before, }; - patch.add_statement(end_of_block_location, StatementKind::StorageLive(temp)); + + let mut patch = MirPatch::new(body); + + // create temp to store second discriminant in + let discr_type = opt_to_apply.infos[0].second_switch_info.discr_ty; + let discr_span = opt_to_apply.infos[0].second_switch_info.discr_source_info.span; + let second_discriminant_temp = patch.new_temp(discr_type, discr_span); + + patch.add_statement( + end_of_block_location, + StatementKind::StorageLive(second_discriminant_temp), + ); // create assignment of discriminant let place_of_adt_to_get_discriminant_of = opt_to_apply.infos[0].second_switch_info.place_of_adt_discr_read; patch.add_assign( end_of_block_location, - Place::from(temp), + Place::from(second_discriminant_temp), Rvalue::Discriminant(place_of_adt_to_get_discriminant_of), ); @@ -81,7 +86,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { opt_to_apply.infos[0].first_switch_info.discr_used_in_switch; let not_equal_rvalue = Rvalue::BinaryOp( not_equal, - Operand::Copy(Place::from(temp)), + Operand::Copy(Place::from(second_discriminant_temp)), Operand::Copy(Place::from(first_descriminant_place)), ); patch.add_statement( @@ -126,8 +131,19 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { ), ); - // generate StorageDead for the temp not in use anymore. We use the not_equal_temp in the switch, so we can't mark that dead - patch.add_statement(end_of_block_location, StatementKind::StorageDead(temp)); + // generate StorageDead for the second_discriminant_temp not in use anymore + patch.add_statement( + end_of_block_location, + StatementKind::StorageDead(second_discriminant_temp), + ); + + // Generate a StorageDead for not_equal_temp in each of the targets, since we moved it into the switch + for bb in [false_case, true_case].iter() { + patch.add_statement( + Location { block: *bb, statement_index: 0 }, + StatementKind::StorageDead(not_equal_temp), + ); + } patch.apply(body); } diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff index 9f9c28723f07b..ce0f0cf0a30ef 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff @@ -40,6 +40,7 @@ } bb1: { ++ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 } @@ -70,6 +71,7 @@ + } + + bb6: { ++ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 + switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 } } diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff index 569dc6c5db61e..e9361f895bf22 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff @@ -46,6 +46,7 @@ } bb2: { ++ StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch.rs:15:14: 15:15 _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:15:14: 15:15 goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 } @@ -81,6 +82,7 @@ + } + + bb8: { ++ StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 + switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 } } diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff index 9d45aa69f6336..80bbc30124d9f 100644 --- a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff @@ -51,6 +51,8 @@ } bb1: { ++ StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:14: 7:15 ++ StorageDead(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:14: 7:15 _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:14: 7:15 goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 } @@ -95,10 +97,12 @@ + } + + bb7: { ++ StorageDead(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 + switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 + } + + bb8: { ++ StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 + switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 } } diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff index f08920ef06de3..9abbe767cae2b 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -82,6 +82,7 @@ } bb2: { ++ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 ((_0 as Err).0: ()) = const (); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 discriminant(_0) = 1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 @@ -207,6 +208,7 @@ + } + + bb13: { ++ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 + switchInt(_11) -> [0_isize: bb6, 1_isize: bb7, 2_isize: bb8, 3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 } } From 27068cbfdc15445cefc6a650355ff5c6bfe992c3 Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sun, 20 Sep 2020 01:18:05 +0200 Subject: [PATCH 7/9] add cleanup of cfg --- .../src/transform/early_otherwise_branch.rs | 10 +++ ...wise_branch.opt1.EarlyOtherwiseBranch.diff | 29 +++---- ...wise_branch.opt2.EarlyOtherwiseBranch.diff | 48 ++++++----- ...ement_tuple.opt1.EarlyOtherwiseBranch.diff | 44 ++++------ ...ch_68867.try_sum.EarlyOtherwiseBranch.diff | 86 ++++++++++--------- 5 files changed, 113 insertions(+), 104 deletions(-) diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs index b0b9d5a889561..bb77dd38f22fb 100644 --- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -6,6 +6,8 @@ use rustc_middle::mir::*; use rustc_middle::ty::{Ty, TyCtxt}; use std::{borrow::Cow, fmt::Debug}; +use super::simplify::simplify_cfg; + /// This pass optimizes something like /// ```text /// let x: Option<()>; @@ -44,6 +46,8 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { }) .collect(); + let should_cleanup = !opts_to_apply.is_empty(); + for opt_to_apply in opts_to_apply { trace!("SUCCESS: found optimization possibility to apply: {:?}", &opt_to_apply); @@ -147,6 +151,12 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { patch.apply(body); } + + // Since this optimization adds new basic blocks and invalidates others, + // clean up the cfg to make it nicer for other passes + if should_cleanup { + simplify_cfg(body); + } } } diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff index ce0f0cf0a30ef..386726bfddc74 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff @@ -36,21 +36,22 @@ + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 + _11 = Ne(_10, _7); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 -+ switchInt(move _11) -> [false: bb6, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 ++ switchInt(move _11) -> [false: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:10: 5:17 } bb1: { + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:6:14: 6:15 - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 +- goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 ++ goto -> bb3; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 } bb2: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 - switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 - } - - bb3: { +- _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 +- switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 +- } +- +- bb3: { StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 _8 = (((_3.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:5:15: 5:16 StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:5:24: 5:25 @@ -58,21 +59,19 @@ _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch.rs:5:31: 5:32 StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:5:31: 5:32 StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:5:31: 5:32 - goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 +- goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 ++ goto -> bb3; // scope 0 at $DIR/early_otherwise_branch.rs:4:5: 7:6 } - bb4: { +- bb4: { ++ bb3: { StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:8:1: 8:2 return; // scope 0 at $DIR/early_otherwise_branch.rs:8:2: 8:2 + } + -+ bb5 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch.rs:3:1: 8:2 -+ } -+ -+ bb6: { ++ bb4: { + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 -+ switchInt(_7) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 ++ switchInt(_7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:5:19: 5:26 } } diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff index e9361f895bf22..bc5934dec84e4 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff @@ -37,26 +37,28 @@ + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 + _12 = Ne(_11, _8); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 -+ switchInt(move _12) -> [false: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 ++ switchInt(move _12) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:13:10: 13:17 } bb1: { - _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 - switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 - } - - bb2: { +- _6 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 +- switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 +- } +- +- bb2: { + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch.rs:15:14: 15:15 _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:15:14: 15:15 - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 - } - - bb3: { - _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:13:19: 13:26 - switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:13:19: 13:26 +- goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 ++ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 } - bb4: { +- bb3: { +- _7 = discriminant((_3.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch.rs:13:19: 13:26 +- switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:13:19: 13:26 +- } +- +- bb4: { ++ bb2: { StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 _9 = (((_3.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:13:15: 13:16 StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:13:24: 13:25 @@ -64,26 +66,26 @@ _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch.rs:13:31: 13:32 StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:13:31: 13:32 StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:13:31: 13:32 - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 +- goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 ++ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 } - bb5: { +- bb5: { ++ bb3: { _0 = const 0_u32; // scope 0 at $DIR/early_otherwise_branch.rs:14:25: 14:26 - goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 +- goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 ++ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:12:5: 16:6 } - bb6: { +- bb6: { ++ bb4: { StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:17:1: 17:2 return; // scope 0 at $DIR/early_otherwise_branch.rs:17:2: 17:2 + } + -+ bb7 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch.rs:11:1: 17:2 -+ } -+ -+ bb8: { ++ bb5: { + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 -+ switchInt(_8) -> [0_isize: bb5, 1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 ++ switchInt(_8) -> [0_isize: bb3, 1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:14:16: 14:20 } } diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff index 80bbc30124d9f..b0357f1aecd61 100644 --- a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff @@ -47,33 +47,30 @@ + StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 + _15 = Ne(_14, _10); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 + StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 -+ switchInt(move _15) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 ++ switchInt(move _15) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:10: 6:17 } bb1: { + StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:14: 7:15 + StorageDead(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:14: 7:15 _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:7:14: 7:15 - goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 +- goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 ++ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 } bb2: { - _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 +- _9 = discriminant((_4.1: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 - switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 -+ StorageLive(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 -+ _16 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 -+ StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 -+ _17 = Ne(_16, _9); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 -+ StorageDead(_16); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 -+ switchInt(move _17) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 - } - - bb3: { +- } +- +- bb3: { _8 = discriminant((_4.2: std::option::Option)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 - switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 +- switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 ++ switchInt(move _8) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 } - bb4: { +- bb4: { ++ bb3: { StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:15: 6:16 _11 = (((_4.0: std::option::Option) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:15: 6:16 StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:24: 6:25 @@ -84,26 +81,19 @@ StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:40: 6:41 StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:40: 6:41 StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:40: 6:41 - goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 +- goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 ++ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:5:5: 8:6 } - bb5: { +- bb5: { ++ bb4: { StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:9:1: 9:2 return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:9:2: 9:2 + } + -+ bb6 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:4:1: 9:2 -+ } -+ -+ bb7: { ++ bb5: { + StorageDead(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 -+ switchInt(_10) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 -+ } -+ -+ bb8: { -+ StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 -+ switchInt(_9) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:28: 6:35 ++ switchInt(_10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:6:19: 6:26 } } diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff index 9abbe767cae2b..57f9b1dd3ca98 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -73,15 +73,15 @@ + StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 + _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 + StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 -+ switchInt(move _35) -> [false: bb13, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 ++ switchInt(move _35) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 } bb1: { - _7 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 - switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 - } - - bb2: { +- _7 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 +- switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 +- } +- +- bb2: { + StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 ((_0 as Err).0: ()) = const (); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 @@ -89,25 +89,27 @@ StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:27: 24:28 StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:6: 25:7 StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:1: 26:2 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:28 - } - - bb3: { - _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 - switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 - } - - bb4: { - _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 - switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 - } - - bb5: { - _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 - switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 +- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:28 ++ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:28 } - bb6: { +- bb3: { +- _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 +- switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 +- } +- +- bb4: { +- _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 +- switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 +- } +- +- bb5: { +- _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 +- switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 +- } +- +- bb6: { ++ bb2: { StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 _12 = (((*(_4.0: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 @@ -125,10 +127,12 @@ StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 - goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 } - bb7: { +- bb7: { ++ bb3: { StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 _17 = (((*(_4.0: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 StorageLive(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 @@ -146,10 +150,12 @@ StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 - goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 } - bb8: { +- bb8: { ++ bb4: { StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 _22 = (((*(_4.0: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 @@ -167,10 +173,12 @@ StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 - goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 } - bb9: { +- bb9: { ++ bb5: { StorageLive(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 _27 = (((*(_4.0: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 StorageLive(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 @@ -188,28 +196,28 @@ StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 - goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 } - bb10: { +- bb10: { ++ bb6: { return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 } - bb11: { +- bb11: { ++ bb7: { ((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 25:7 discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 25:7 StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:6: 25:7 StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:1: 26:2 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 -+ } -+ -+ bb12 (cleanup): { -+ resume; // scope 0 at $DIR/early_otherwise_branch_68867.rs:15:1: 26:2 +- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 ++ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 + } + -+ bb13: { ++ bb8: { + StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 -+ switchInt(_11) -> [0_isize: bb6, 1_isize: bb7, 2_isize: bb8, 3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 ++ switchInt(_11) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 } } From e25738f529b431d5b824eb8b7510fbe86cf0c9fa Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sun, 20 Sep 2020 01:40:58 +0200 Subject: [PATCH 8/9] enable on mir-opt-level=1 to test perf --- compiler/rustc_mir/src/transform/early_otherwise_branch.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs index bb77dd38f22fb..67e679a8b08d0 100644 --- a/compiler/rustc_mir/src/transform/early_otherwise_branch.rs +++ b/compiler/rustc_mir/src/transform/early_otherwise_branch.rs @@ -29,7 +29,7 @@ pub struct EarlyOtherwiseBranch; impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { - if tcx.sess.opts.debugging_opts.mir_opt_level < 3 { + if tcx.sess.opts.debugging_opts.mir_opt_level < 1 { return; } trace!("running EarlyOtherwiseBranch on {:?}", source); From 0363694c7ff72d0a4b1c52ebf2320930c3b60da8 Mon Sep 17 00:00:00 2001 From: Simon Vandel Sillesen Date: Sun, 20 Sep 2020 14:45:08 +0200 Subject: [PATCH 9/9] emit diff after SimplifyBranches-after-copy-prop --- .../mir-opt/early_otherwise_branch_68867.rs | 10 +- ...implifyBranches-after-copy-prop.after.diff | 310 +++++++++++++++++ ...ch_68867.try_sum.EarlyOtherwiseBranch.diff | 328 +++++++++--------- 3 files changed, 480 insertions(+), 168 deletions(-) create mode 100644 src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-after-copy-prop.after.diff diff --git a/src/test/mir-opt/early_otherwise_branch_68867.rs b/src/test/mir-opt/early_otherwise_branch_68867.rs index abe666f9ca4f9..5922e73e5d205 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.rs +++ b/src/test/mir-opt/early_otherwise_branch_68867.rs @@ -1,3 +1,4 @@ +// ignore-tidy-linelength // compile-flags: -Z mir-opt-level=3 // example from #68867 @@ -11,10 +12,12 @@ pub enum ViewportPercentageLength { } // EMIT_MIR early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +// EMIT_MIR early_otherwise_branch_68867.try_sum EarlyOtherwiseBranch.before SimplifyBranches-after-copy-prop.after #[no_mangle] -pub extern "C" fn try_sum(x: &ViewportPercentageLength, - other: &ViewportPercentageLength) - -> Result { +pub extern "C" fn try_sum( + x: &ViewportPercentageLength, + other: &ViewportPercentageLength, +) -> Result { use self::ViewportPercentageLength::*; Ok(match (x, other) { (&Vw(one), &Vw(other)) => Vw(one + other), @@ -25,7 +28,6 @@ pub extern "C" fn try_sum(x: &ViewportPercentageLength, }) } - fn main() { try_sum(&ViewportPercentageLength::Vw(1.0), &ViewportPercentageLength::Vw(2.0)); } diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-after-copy-prop.after.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-after-copy-prop.after.diff new file mode 100644 index 0000000000000..fbc46c9d196c1 --- /dev/null +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-after-copy-prop.after.diff @@ -0,0 +1,310 @@ +- // MIR for `try_sum` before EarlyOtherwiseBranch ++ // MIR for `try_sum` after SimplifyBranches-after-copy-prop + + fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> std::result::Result { + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:18:5: 18:6 + debug other => _2; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 19:10 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:6: 20:42 + let mut _3: ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + let mut _4: (&ViewportPercentageLength, &ViewportPercentageLength); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 + let mut _5: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 + let mut _6: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:30 + let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:23: 25:34 + let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:23: 26:34 + let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + let _12: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 + let _13: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 + let mut _14: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:49 + let mut _15: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:41 + let mut _16: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:49 + let _17: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 + let _18: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 + let mut _19: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:49 + let mut _20: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:41 + let mut _21: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:44: 24:49 + let _22: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 + let _23: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 + let mut _24: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:55 + let mut _25: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:47 + let mut _26: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:50: 25:55 + let _27: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 + let _28: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 + let mut _29: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:55 + let mut _30: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:47 + let mut _31: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:50: 26:55 + let mut _32: !; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28 + let mut _33: (); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:27:25: 27:27 ++ let mut _34: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 ++ let mut _35: bool; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 + scope 1 { +- debug one => _12; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 +- debug other => _13; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 ++ debug one => _15; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 ++ debug other => _16; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 + } + scope 2 { +- debug one => _17; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 +- debug other => _18; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 ++ debug one => _20; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 ++ debug other => _21; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 + } + scope 3 { +- debug one => _22; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 +- debug other => _23; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 ++ debug one => _25; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 ++ debug other => _26; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 + } + scope 4 { +- debug one => _27; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 +- debug other => _28; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 ++ debug one => _30; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 ++ debug other => _31; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 +- StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 +- StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 +- _5 = _1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 +- StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 +- _6 = _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 +- (_4.0: &ViewportPercentageLength) = move _5; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 +- (_4.1: &ViewportPercentageLength) = move _6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 +- StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 +- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 ++ (_4.0: &ViewportPercentageLength) = _1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 ++ (_4.1: &ViewportPercentageLength) = move _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 + _11 = discriminant((*(_4.0: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 +- switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ StorageLive(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ _34 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ switchInt(move _35) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + } + + bb1: { +- _7 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 +- switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 +- } +- +- bb2: { ++ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:25: 27:27 + StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:25: 27:27 + ((_0 as Err).0: ()) = const (); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:21: 27:28 + discriminant(_0) = 1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:21: 27:28 + StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:27: 27:28 +- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 +- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 +- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 ++ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28 + } + ++ bb2: { ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 ++ _15 = (((*(_4.0: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 ++ _16 = (((*(_4.1: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:49 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:41 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:41 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:49 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:49 ++ ((((_0 as Ok).0: ViewportPercentageLength) as Vw).0: f32) = Add(move _15, move _16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:49 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:48: 23:49 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:48: 23:49 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:35: 23:50 ++ discriminant(((_0 as Ok).0: ViewportPercentageLength)) = 0; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:35: 23:50 ++ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 ++ } ++ + bb3: { +- _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:30 +- switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:30 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 ++ _20 = (((*(_4.0: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 ++ _21 = (((*(_4.1: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:49 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:41 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:41 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:44: 24:49 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:44: 24:49 ++ ((((_0 as Ok).0: ViewportPercentageLength) as Vh).0: f32) = Add(move _20, move _21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:49 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:48: 24:49 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:48: 24:49 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:35: 24:50 ++ discriminant(((_0 as Ok).0: ViewportPercentageLength)) = 1; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:35: 24:50 ++ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + } + + bb4: { +- _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:23: 25:34 +- switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:23: 25:34 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 ++ _25 = (((*(_4.0: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 ++ _26 = (((*(_4.1: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:55 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:47 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:47 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:50: 25:55 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:50: 25:55 ++ ((((_0 as Ok).0: ViewportPercentageLength) as Vmin).0: f32) = Add(move _25, move _26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:55 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:54: 25:55 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:54: 25:55 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:39: 25:56 ++ discriminant(((_0 as Ok).0: ViewportPercentageLength)) = 2; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:39: 25:56 ++ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + } + + bb5: { +- _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:23: 26:34 +- switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:23: 26:34 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 ++ _30 = (((*(_4.0: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 ++ _31 = (((*(_4.1: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:55 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:47 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:47 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:50: 26:55 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:50: 26:55 ++ ((((_0 as Ok).0: ViewportPercentageLength) as Vmax).0: f32) = Add(move _30, move _31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:55 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:54: 26:55 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:54: 26:55 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:39: 26:56 ++ discriminant(((_0 as Ok).0: ViewportPercentageLength)) = 3; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:39: 26:56 ++ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + } + + bb6: { +- StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 +- _12 = (((*(_4.0: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 +- StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 +- _13 = (((*(_4.1: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 +- StorageLive(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:49 +- StorageLive(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:41 +- _15 = _12; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:41 +- StorageLive(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:49 +- _16 = _13; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:49 +- _14 = Add(move _15, move _16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:49 +- StorageDead(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:48: 23:49 +- StorageDead(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:48: 23:49 +- ((_3 as Vw).0: f32) = move _14; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:35: 23:50 +- discriminant(_3) = 0; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:35: 23:50 +- StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 +- StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 +- StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 ++ return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 + } + + bb7: { +- StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 +- _17 = (((*(_4.0: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 +- StorageLive(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 +- _18 = (((*(_4.1: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 +- StorageLive(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:49 +- StorageLive(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:41 +- _20 = _17; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:41 +- StorageLive(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:44: 24:49 +- _21 = _18; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:44: 24:49 +- _19 = Add(move _20, move _21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:49 +- StorageDead(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:48: 24:49 +- StorageDead(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:48: 24:49 +- ((_3 as Vh).0: f32) = move _19; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:35: 24:50 +- discriminant(_3) = 1; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:35: 24:50 +- StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 +- StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 +- StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 ++ discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 ++ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 ++ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 + } + + bb8: { +- StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 +- _22 = (((*(_4.0: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 +- StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 +- _23 = (((*(_4.1: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 +- StorageLive(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:55 +- StorageLive(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:47 +- _25 = _22; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:47 +- StorageLive(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:50: 25:55 +- _26 = _23; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:50: 25:55 +- _24 = Add(move _25, move _26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:55 +- StorageDead(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:54: 25:55 +- StorageDead(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:54: 25:55 +- ((_3 as Vmin).0: f32) = move _24; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:39: 25:56 +- discriminant(_3) = 2; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:39: 25:56 +- StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 +- StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 +- StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 +- } +- +- bb9: { +- StorageLive(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 +- _27 = (((*(_4.0: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 +- StorageLive(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 +- _28 = (((*(_4.1: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 +- StorageLive(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:55 +- StorageLive(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:47 +- _30 = _27; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:47 +- StorageLive(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:50: 26:55 +- _31 = _28; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:50: 26:55 +- _29 = Add(move _30, move _31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:55 +- StorageDead(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:54: 26:55 +- StorageDead(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:54: 26:55 +- ((_3 as Vmax).0: f32) = move _29; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:39: 26:56 +- discriminant(_3) = 3; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:39: 26:56 +- StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 +- StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 +- StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 +- } +- +- bb10: { +- return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 +- } +- +- bb11: { +- ((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 +- discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 +- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 +- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 +- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 ++ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 ++ switchInt(_11) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 + } + } + diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff index 57f9b1dd3ca98..54e4b08262616 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -2,222 +2,222 @@ + // MIR for `try_sum` after EarlyOtherwiseBranch fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:15:27: 15:28 - debug other => _2; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:16:27: 16:32 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/early_otherwise_branch_68867.rs:17:28: 17:64 - let mut _3: ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 - let mut _4: (&ViewportPercentageLength, &ViewportPercentageLength); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:14: 19:24 - let mut _5: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:15: 19:16 - let mut _6: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:18: 19:23 - let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 - let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 - let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 - let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 - let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 - let _12: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 - let _13: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 - let mut _14: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:49 - let mut _15: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:41 - let mut _16: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:44: 20:49 - let _17: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 - let _18: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 - let mut _19: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:49 - let mut _20: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:41 - let mut _21: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:21:44: 21:49 - let _22: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 - let _23: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 - let mut _24: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:55 - let mut _25: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:47 - let mut _26: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:50: 22:55 - let _27: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 - let _28: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 - let mut _29: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:55 - let mut _30: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:47 - let mut _31: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:50: 23:55 - let mut _32: !; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:28 - let mut _33: (); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 -+ let mut _34: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 -+ let mut _35: bool; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 + debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:18:5: 18:6 + debug other => _2; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 19:10 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:6: 20:42 + let mut _3: ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + let mut _4: (&ViewportPercentageLength, &ViewportPercentageLength); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 + let mut _5: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 + let mut _6: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 + let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 + let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:30 + let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:23: 25:34 + let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:23: 26:34 + let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + let _12: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 + let _13: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 + let mut _14: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:49 + let mut _15: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:41 + let mut _16: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:49 + let _17: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 + let _18: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 + let mut _19: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:49 + let mut _20: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:41 + let mut _21: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:24:44: 24:49 + let _22: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 + let _23: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 + let mut _24: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:55 + let mut _25: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:47 + let mut _26: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:25:50: 25:55 + let _27: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 + let _28: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 + let mut _29: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:55 + let mut _30: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:47 + let mut _31: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:26:50: 26:55 + let mut _32: !; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28 + let mut _33: (); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:27:25: 27:27 ++ let mut _34: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 ++ let mut _35: bool; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 scope 1 { - debug one => _12; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 - debug other => _13; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 + debug one => _12; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 + debug other => _13; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 } scope 2 { - debug one => _17; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 - debug other => _18; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 + debug one => _17; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 + debug other => _18; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 } scope 3 { - debug one => _22; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 - debug other => _23; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 + debug one => _22; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 + debug other => _23; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 } scope 4 { - debug one => _27; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 - debug other => _28; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 + debug one => _27; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 + debug other => _28; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 } bb0: { - StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:14: 19:24 - StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:15: 19:16 - _5 = _1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:15: 19:16 - StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:18: 19:23 - _6 = _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:18: 19:23 - (_4.0: &ViewportPercentageLength) = move _5; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:14: 19:24 - (_4.1: &ViewportPercentageLength) = move _6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:14: 19:24 - StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:23: 19:24 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:23: 19:24 - _11 = discriminant((*(_4.0: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 -- switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 -+ StorageLive(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 -+ _34 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 -+ StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 -+ _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 -+ StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 -+ switchInt(move _35) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:11: 20:18 + StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 + StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 + _5 = _1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:15: 22:16 + StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 + _6 = _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:18: 22:23 + (_4.0: &ViewportPercentageLength) = move _5; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 + (_4.1: &ViewportPercentageLength) = move _6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:14: 22:24 + StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 + StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:24 + _11 = discriminant((*(_4.0: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 +- switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ StorageLive(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ _34 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 ++ switchInt(move _35) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 } bb1: { -- _7 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 -- switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 +- _7 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 +- switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 - } - - bb2: { -+ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 - StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:25: 24:27 - ((_0 as Err).0: ()) = const (); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 - discriminant(_0) = 1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:28 - StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:27: 24:28 - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:6: 25:7 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:1: 26:2 -- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:28 -+ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:28 ++ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:25: 27:27 + StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:25: 27:27 + ((_0 as Err).0: ()) = const (); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:21: 27:28 + discriminant(_0) = 1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:21: 27:28 + StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:27: 27:28 + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 +- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28 ++ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28 } - bb3: { -- _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 -- switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:21: 21:30 +- _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:30 +- switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:21: 24:30 - } - - bb4: { -- _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 -- switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:23: 22:34 +- _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:23: 25:34 +- switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:23: 25:34 - } - - bb5: { -- _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 -- switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:23: 23:34 +- _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:23: 26:34 +- switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:23: 26:34 - } - - bb6: { + bb2: { - StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 - _12 = (((*(_4.0: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:14: 20:17 - StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 - _13 = (((*(_4.1: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:24: 20:29 - StorageLive(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:49 - StorageLive(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:41 - _15 = _12; // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:41 - StorageLive(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:44: 20:49 - _16 = _13; // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:44: 20:49 - _14 = Add(move _15, move _16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:38: 20:49 - StorageDead(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:48: 20:49 - StorageDead(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:48: 20:49 - ((_3 as Vw).0: f32) = move _14; // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:35: 20:50 - discriminant(_3) = 0; // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:35: 20:50 - StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 - StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:49: 20:50 -- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 -+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 + _12 = (((*(_4.0: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:14: 23:17 + StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 + _13 = (((*(_4.1: &ViewportPercentageLength)) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:24: 23:29 + StorageLive(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:49 + StorageLive(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:41 + _15 = _12; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:41 + StorageLive(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:49 + _16 = _13; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:49 + _14 = Add(move _15, move _16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:38: 23:49 + StorageDead(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:48: 23:49 + StorageDead(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:48: 23:49 + ((_3 as Vw).0: f32) = move _14; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:35: 23:50 + discriminant(_3) = 0; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:35: 23:50 + StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 + StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 } - bb7: { + bb3: { - StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 - _17 = (((*(_4.0: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:14: 21:17 - StorageLive(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 - _18 = (((*(_4.1: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:24: 21:29 - StorageLive(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:49 - StorageLive(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:41 - _20 = _17; // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:41 - StorageLive(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:44: 21:49 - _21 = _18; // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:44: 21:49 - _19 = Add(move _20, move _21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:38: 21:49 - StorageDead(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:48: 21:49 - StorageDead(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:48: 21:49 - ((_3 as Vh).0: f32) = move _19; // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:35: 21:50 - discriminant(_3) = 1; // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:35: 21:50 - StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 - StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 - StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:21:49: 21:50 -- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 -+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 + _17 = (((*(_4.0: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:14: 24:17 + StorageLive(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 + _18 = (((*(_4.1: &ViewportPercentageLength)) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:24: 24:29 + StorageLive(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:49 + StorageLive(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:41 + _20 = _17; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:41 + StorageLive(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:44: 24:49 + _21 = _18; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:44: 24:49 + _19 = Add(move _20, move _21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:38: 24:49 + StorageDead(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:48: 24:49 + StorageDead(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:48: 24:49 + ((_3 as Vh).0: f32) = move _19; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:35: 24:50 + discriminant(_3) = 1; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:35: 24:50 + StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 + StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 + StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 } - bb8: { + bb4: { - StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 - _22 = (((*(_4.0: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:16: 22:19 - StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 - _23 = (((*(_4.1: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:28: 22:33 - StorageLive(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:55 - StorageLive(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:47 - _25 = _22; // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:47 - StorageLive(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:50: 22:55 - _26 = _23; // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:50: 22:55 - _24 = Add(move _25, move _26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:44: 22:55 - StorageDead(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:54: 22:55 - StorageDead(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:54: 22:55 - ((_3 as Vmin).0: f32) = move _24; // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:39: 22:56 - discriminant(_3) = 2; // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:39: 22:56 - StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 - StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 - StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:55: 22:56 -- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 -+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 + _22 = (((*(_4.0: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 + StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 + _23 = (((*(_4.1: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 + StorageLive(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:55 + StorageLive(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:47 + _25 = _22; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:47 + StorageLive(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:50: 25:55 + _26 = _23; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:50: 25:55 + _24 = Add(move _25, move _26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:44: 25:55 + StorageDead(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:54: 25:55 + StorageDead(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:54: 25:55 + ((_3 as Vmin).0: f32) = move _24; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:39: 25:56 + discriminant(_3) = 2; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:39: 25:56 + StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 + StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 + StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 } - bb9: { + bb5: { - StorageLive(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 - _27 = (((*(_4.0: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:16: 23:19 - StorageLive(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 - _28 = (((*(_4.1: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:28: 23:33 - StorageLive(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:55 - StorageLive(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:47 - _30 = _27; // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:47 - StorageLive(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:50: 23:55 - _31 = _28; // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:50: 23:55 - _29 = Add(move _30, move _31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:44: 23:55 - StorageDead(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:54: 23:55 - StorageDead(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:54: 23:55 - ((_3 as Vmax).0: f32) = move _29; // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:39: 23:56 - discriminant(_3) = 3; // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:39: 23:56 - StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 - StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 - StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:55: 23:56 -- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 -+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:8: 25:6 + StorageLive(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 + _27 = (((*(_4.0: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:16: 26:19 + StorageLive(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 + _28 = (((*(_4.1: &ViewportPercentageLength)) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:28: 26:33 + StorageLive(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:55 + StorageLive(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:47 + _30 = _27; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:47 + StorageLive(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:50: 26:55 + _31 = _28; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:50: 26:55 + _29 = Add(move _30, move _31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:44: 26:55 + StorageDead(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:54: 26:55 + StorageDead(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:54: 26:55 + ((_3 as Vmax).0: f32) = move _29; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:39: 26:56 + discriminant(_3) = 3; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:39: 26:56 + StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 + StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 + StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 +- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 ++ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 } - bb10: { + bb6: { - return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 + return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 } - bb11: { + bb7: { - ((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 25:7 - discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 25:7 - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:6: 25:7 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:1: 26:2 -- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 -+ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:2: 26:2 + ((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 + discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 + StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 +- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 ++ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 + } + + bb8: { -+ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 -+ switchInt(_11) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:20:21: 20:30 ++ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 ++ switchInt(_11) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 } }