diff --git a/compiler/rustc_middle/src/mir/patch.rs b/compiler/rustc_middle/src/mir/patch.rs index 15496842d905d..8aa761aae8d90 100644 --- a/compiler/rustc_middle/src/mir/patch.rs +++ b/compiler/rustc_middle/src/mir/patch.rs @@ -68,7 +68,7 @@ impl<'tcx> MirPatch<'tcx> { Location { block: bb, statement_index: offset } } - pub fn new_local_with_info( + pub fn new_internal_with_info( &mut self, ty: Ty<'tcx>, span: Span, @@ -76,14 +76,17 @@ impl<'tcx> MirPatch<'tcx> { ) -> Local { let index = self.next_local; self.next_local += 1; - let mut new_decl = LocalDecl::new(ty, span); + let mut new_decl = LocalDecl::new(ty, span).internal(); new_decl.local_info = local_info; self.new_locals.push(new_decl); Local::new(index as usize) } pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local { - self.new_local_with_info(ty, span, None) + let index = self.next_local; + self.next_local += 1; + self.new_locals.push(LocalDecl::new(ty, span)); + Local::new(index as usize) } pub fn new_internal(&mut self, ty: Ty<'tcx>, span: Span) -> Local { @@ -147,7 +150,6 @@ impl<'tcx> MirPatch<'tcx> { let mut delta = 0; let mut last_bb = START_BLOCK; - let mut stmts_and_targets: Vec<(Statement<'_>, BasicBlock)> = Vec::new(); for (mut loc, stmt) in new_statements { if loc.block != last_bb { delta = 0; @@ -156,27 +158,11 @@ impl<'tcx> MirPatch<'tcx> { debug!("MirPatch: adding statement {:?} at loc {:?}+{}", stmt, loc, delta); loc.statement_index += delta; let source_info = Self::source_info_for_index(&body[loc.block], loc); - - // For mir-opt `Derefer` to work in all cases we need to - // get terminator's targets and apply the statement to all of them. - if loc.statement_index > body[loc.block].statements.len() { - let term = body[loc.block].terminator(); - for i in term.successors() { - stmts_and_targets.push((Statement { source_info, kind: stmt.clone() }, i)); - } - delta += 1; - continue; - } - body[loc.block] .statements .insert(loc.statement_index, Statement { source_info, kind: stmt }); delta += 1; } - - for (stmt, target) in stmts_and_targets.into_iter().rev() { - body[target].statements.insert(0, stmt); - } } pub fn source_info_for_index(data: &BasicBlockData<'_>, loc: Location) -> SourceInfo { diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs index 87d7b664015a9..8869f3f92af29 100644 --- a/compiler/rustc_mir_transform/src/deref_separator.rs +++ b/compiler/rustc_mir_transform/src/deref_separator.rs @@ -28,8 +28,6 @@ impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> { let mut last_len = 0; let mut last_deref_idx = 0; - let mut prev_temp: Option = None; - for (idx, elem) in place.projection[0..].iter().enumerate() { if *elem == ProjectionElem::Deref { last_deref_idx = idx; @@ -39,14 +37,12 @@ impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> { for (idx, (p_ref, p_elem)) in place.iter_projections().enumerate() { if !p_ref.projection.is_empty() && p_elem == ProjectionElem::Deref { let ty = p_ref.ty(&self.local_decls, self.tcx).ty; - let temp = self.patcher.new_local_with_info( + let temp = self.patcher.new_internal_with_info( ty, self.local_decls[p_ref.local].source_info.span, Some(Box::new(LocalInfo::DerefTemp)), ); - self.patcher.add_statement(loc, StatementKind::StorageLive(temp)); - // We are adding current p_ref's projections to our // temp value, excluding projections we already covered. let deref_place = Place::from(place_local) @@ -66,22 +62,8 @@ impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> { Place::from(temp).project_deeper(&place.projection[idx..], self.tcx); *place = temp_place; } - - // We are destroying the previous temp since it's no longer used. - if let Some(prev_temp) = prev_temp { - self.patcher.add_statement(loc, StatementKind::StorageDead(prev_temp)); - } - - prev_temp = Some(temp); } } - - // Since we won't be able to reach final temp, we destroy it outside the loop. - if let Some(prev_temp) = prev_temp { - let last_loc = - Location { block: loc.block, statement_index: loc.statement_index + 1 }; - self.patcher.add_statement(last_loc, StatementKind::StorageDead(prev_temp)); - } } } } diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs index 7652223368964..e04094153dfc0 100644 --- a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs +++ b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs @@ -69,9 +69,7 @@ impl<'tcx, 'a> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'tcx, 'a> { let (unique_ty, nonnull_ty, ptr_ty) = build_ptr_tys(tcx, base_ty.boxed_ty(), self.unique_did, self.nonnull_did); - let ptr_local = self.patch.new_temp(ptr_ty, source_info.span); - - self.patch.add_statement(location, StatementKind::StorageLive(ptr_local)); + let ptr_local = self.patch.new_internal(ptr_ty, source_info.span); self.patch.add_assign( location, @@ -83,11 +81,6 @@ impl<'tcx, 'a> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'tcx, 'a> { ); place.local = ptr_local; - - self.patch.add_statement( - Location { block: location.block, statement_index: location.statement_index + 1 }, - StatementKind::StorageDead(ptr_local), - ); } self.super_place(place, context, location); diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 6704d3462f48e..c478c17be76c6 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -616,7 +616,9 @@ impl<'tcx> Inliner<'tcx> { // If there are any locals without storage markers, give them storage only for the // duration of the call. for local in callee_body.vars_and_temps_iter() { - if integrator.always_live_locals.contains(local) { + if !callee_body.local_decls[local].internal + && integrator.always_live_locals.contains(local) + { let new_local = integrator.map_local(local); caller_body[callsite.block].statements.push(Statement { source_info: callsite.source_info, @@ -629,7 +631,9 @@ impl<'tcx> Inliner<'tcx> { // the slice once. let mut n = 0; for local in callee_body.vars_and_temps_iter().rev() { - if integrator.always_live_locals.contains(local) { + if !callee_body.local_decls[local].internal + && integrator.always_live_locals.contains(local) + { let new_local = integrator.map_local(local); caller_body[block].statements.push(Statement { source_info: callsite.source_info, diff --git a/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff b/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff index cb82a7bea1493..5ec421eb2edd9 100644 --- a/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/boxes.main.ConstProp.diff @@ -35,16 +35,12 @@ bb1: { StorageLive(_7); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 _7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 - StorageLive(_8); // scope 0 at $DIR/boxes.rs:+1:19: +1:21 _8 = (((_7.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:19: +1:21 (*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:+1:19: +1:21 - StorageDead(_8); // scope 0 at $DIR/boxes.rs:+1:14: +1:22 _3 = move _7; // scope 0 at $DIR/boxes.rs:+1:14: +1:22 StorageDead(_7); // scope 0 at $DIR/boxes.rs:+1:21: +1:22 - StorageLive(_9); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 _9 = (((_3.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 _2 = (*_9); // scope 0 at $DIR/boxes.rs:+1:13: +1:22 - StorageDead(_9); // scope 0 at $DIR/boxes.rs:+1:13: +1:26 _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:+1:13: +1:26 StorageDead(_2); // scope 0 at $DIR/boxes.rs:+1:25: +1:26 drop(_3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/boxes.rs:+1:26: +1:27 diff --git a/src/test/mir-opt/derefer_complex_case.main.Derefer.diff b/src/test/mir-opt/derefer_complex_case.main.Derefer.diff index abd6193fed957..297836798cbcc 100644 --- a/src/test/mir-opt/derefer_complex_case.main.Derefer.diff +++ b/src/test/mir-opt/derefer_complex_case.main.Derefer.diff @@ -68,10 +68,8 @@ bb4: { StorageLive(_12); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 - _12 = (*((_7 as Some).0: &i32)); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 -+ StorageLive(_15); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 + _15 = deref_copy ((_7 as Some).0: &i32); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 + _12 = (*_15); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 -+ StorageDead(_15); // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37 StorageLive(_13); // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37 _13 = _12; // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37 _6 = std::mem::drop::(move _13) -> bb7; // scope 2 at $DIR/derefer_complex_case.rs:+1:29: +1:38 diff --git a/src/test/mir-opt/derefer_terminator_test.main.Derefer.diff b/src/test/mir-opt/derefer_terminator_test.main.Derefer.diff index ed336208325fe..60f7b9d5607b0 100644 --- a/src/test/mir-opt/derefer_terminator_test.main.Derefer.diff +++ b/src/test/mir-opt/derefer_terminator_test.main.Derefer.diff @@ -55,25 +55,18 @@ _5 = &_6; // scope 2 at $DIR/derefer_terminator_test.rs:+3:17: +3:21 _4 = &_5; // scope 2 at $DIR/derefer_terminator_test.rs:+3:15: +3:22 - switchInt((*(*(*(*_4))))) -> [false: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 -+ StorageLive(_10); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 + _10 = deref_copy (*_4); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 -+ StorageLive(_11); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 + _11 = deref_copy (*_10); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 -+ StorageDead(_10); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 -+ StorageLive(_12); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 + _12 = deref_copy (*_11); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 -+ StorageDead(_11); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 + switchInt((*_12)) -> [false: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 } bb3: { -+ StorageDead(_12); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 _3 = const (); // scope 2 at $DIR/derefer_terminator_test.rs:+5:18: +5:20 goto -> bb5; // scope 2 at $DIR/derefer_terminator_test.rs:+5:18: +5:20 } bb4: { -+ StorageDead(_12); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 StorageLive(_8); // scope 2 at $DIR/derefer_terminator_test.rs:+4:22: +4:23 _8 = const 5_i32; // scope 2 at $DIR/derefer_terminator_test.rs:+4:26: +4:27 _3 = const (); // scope 2 at $DIR/derefer_terminator_test.rs:+4:17: +4:29 diff --git a/src/test/mir-opt/derefer_test.main.Derefer.diff b/src/test/mir-opt/derefer_test.main.Derefer.diff index 6c2047e216c05..87306d818ff91 100644 --- a/src/test/mir-opt/derefer_test.main.Derefer.diff +++ b/src/test/mir-opt/derefer_test.main.Derefer.diff @@ -33,16 +33,12 @@ StorageDead(_3); // scope 1 at $DIR/derefer_test.rs:+2:28: +2:29 StorageLive(_4); // scope 2 at $DIR/derefer_test.rs:+3:9: +3:10 - _4 = &mut ((*(_2.1: &mut (i32, i32))).0: i32); // scope 2 at $DIR/derefer_test.rs:+3:13: +3:26 -+ StorageLive(_6); // scope 2 at $DIR/derefer_test.rs:+3:13: +3:26 + _6 = deref_copy (_2.1: &mut (i32, i32)); // scope 2 at $DIR/derefer_test.rs:+3:13: +3:26 + _4 = &mut ((*_6).0: i32); // scope 2 at $DIR/derefer_test.rs:+3:13: +3:26 -+ StorageDead(_6); // scope 3 at $DIR/derefer_test.rs:+4:9: +4:10 StorageLive(_5); // scope 3 at $DIR/derefer_test.rs:+4:9: +4:10 - _5 = &mut ((*(_2.1: &mut (i32, i32))).1: i32); // scope 3 at $DIR/derefer_test.rs:+4:13: +4:26 -+ StorageLive(_7); // scope 3 at $DIR/derefer_test.rs:+4:13: +4:26 + _7 = deref_copy (_2.1: &mut (i32, i32)); // scope 3 at $DIR/derefer_test.rs:+4:13: +4:26 + _5 = &mut ((*_7).1: i32); // scope 3 at $DIR/derefer_test.rs:+4:13: +4:26 -+ StorageDead(_7); // scope 0 at $DIR/derefer_test.rs:+0:11: +5:2 _0 = const (); // scope 0 at $DIR/derefer_test.rs:+0:11: +5:2 StorageDead(_5); // scope 3 at $DIR/derefer_test.rs:+5:1: +5:2 StorageDead(_4); // scope 2 at $DIR/derefer_test.rs:+5:1: +5:2 diff --git a/src/test/mir-opt/derefer_test_multiple.main.Derefer.diff b/src/test/mir-opt/derefer_test_multiple.main.Derefer.diff index e2dceecfd7c92..3e40db1186523 100644 --- a/src/test/mir-opt/derefer_test_multiple.main.Derefer.diff +++ b/src/test/mir-opt/derefer_test_multiple.main.Derefer.diff @@ -57,28 +57,16 @@ StorageDead(_7); // scope 3 at $DIR/derefer_test_multiple.rs:+4:28: +4:29 StorageLive(_8); // scope 4 at $DIR/derefer_test_multiple.rs:+5:9: +5:10 - _8 = &mut ((*((*((*(_6.1: &mut (i32, &mut (i32, &mut (i32, i32))))).1: &mut (i32, &mut (i32, i32)))).1: &mut (i32, i32))).1: i32); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 -+ StorageLive(_10); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 + _10 = deref_copy (_6.1: &mut (i32, &mut (i32, &mut (i32, i32)))); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 -+ StorageLive(_11); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 + _11 = deref_copy ((*_10).1: &mut (i32, &mut (i32, i32))); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 -+ StorageDead(_10); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 -+ StorageLive(_12); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 + _12 = deref_copy ((*_11).1: &mut (i32, i32)); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 -+ StorageDead(_11); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 + _8 = &mut ((*_12).1: i32); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30 -+ StorageDead(_12); // scope 5 at $DIR/derefer_test_multiple.rs:+6:9: +6:10 StorageLive(_9); // scope 5 at $DIR/derefer_test_multiple.rs:+6:9: +6:10 - _9 = &mut ((*((*((*(_6.1: &mut (i32, &mut (i32, &mut (i32, i32))))).1: &mut (i32, &mut (i32, i32)))).1: &mut (i32, i32))).1: i32); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 -+ StorageLive(_13); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 + _13 = deref_copy (_6.1: &mut (i32, &mut (i32, &mut (i32, i32)))); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 -+ StorageLive(_14); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 + _14 = deref_copy ((*_13).1: &mut (i32, &mut (i32, i32))); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 -+ StorageDead(_13); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 -+ StorageLive(_15); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 + _15 = deref_copy ((*_14).1: &mut (i32, i32)); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 -+ StorageDead(_14); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 + _9 = &mut ((*_15).1: i32); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30 -+ StorageDead(_15); // scope 0 at $DIR/derefer_test_multiple.rs:+0:12: +7:2 _0 = const (); // scope 0 at $DIR/derefer_test_multiple.rs:+0:12: +7:2 StorageDead(_9); // scope 5 at $DIR/derefer_test_multiple.rs:+7:1: +7:2 StorageDead(_8); // scope 4 at $DIR/derefer_test_multiple.rs:+7:1: +7:2 diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyConstCondition-final.after.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyConstCondition-final.after.diff index 4e6852ad7b6a5..8b37fb79f411b 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyConstCondition-final.after.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyConstCondition-final.after.diff @@ -92,18 +92,14 @@ StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24 - StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24 - StorageLive(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _34 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _11 = discriminant((*_34)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 - 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:+5:8: +5:24 + switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb11]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb1: { - StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _35 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _7 = discriminant((*_35)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } @@ -122,44 +118,33 @@ } bb3: { - StorageLive(_36); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _36 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _8 = discriminant((*_36)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_36); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb4: { - StorageLive(_37); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _37 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _9 = discriminant((*_37)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_37); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb5: { - StorageLive(_38); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _38 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _10 = discriminant((*_38)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_38); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb6: { - StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 - StorageLive(_39); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 _39 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 - _12 = (((*_39) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 -+ _15 = (((*_39) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 - StorageDead(_39); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 - StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 ++ _15 = (((*_39) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 - StorageLive(_40); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 _40 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 - _13 = (((*_40) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 -+ _16 = (((*_40) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 - StorageDead(_40); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:49 - StorageLive(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:49 - StorageLive(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41 - _15 = _12; // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41 @@ -174,6 +159,7 @@ - StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:49: +6:50 - StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:49: +6:50 - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:49: +6:50 ++ _16 = (((*_40) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 + nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:49 + nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41 + nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41 @@ -194,18 +180,13 @@ bb7: { - StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 - StorageLive(_41); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 _41 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 - _17 = (((*_41) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 -+ _20 = (((*_41) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 - StorageDead(_41); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 - StorageLive(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 ++ _20 = (((*_41) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 - StorageLive(_42); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 _42 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 - _18 = (((*_42) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 -+ _21 = (((*_42) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 - StorageDead(_42); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:49 - StorageLive(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:49 - StorageLive(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41 - _20 = _17; // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41 @@ -220,6 +201,7 @@ - StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:49: +7:50 - StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:49: +7:50 - StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:49: +7:50 ++ _21 = (((*_42) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 + nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:49 + nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41 + nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41 @@ -240,18 +222,13 @@ bb8: { - StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 - StorageLive(_43); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 _43 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 - _22 = (((*_43) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 -+ _25 = (((*_43) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 - StorageDead(_43); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 - StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 ++ _25 = (((*_43) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 - StorageLive(_44); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 _44 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 - _23 = (((*_44) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 -+ _26 = (((*_44) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 - StorageDead(_44); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:55 - StorageLive(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:55 - StorageLive(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47 - _25 = _22; // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47 @@ -266,6 +243,7 @@ - StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:55: +8:56 - StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:55: +8:56 - StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:55: +8:56 ++ _26 = (((*_44) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 + nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:55 + nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47 + nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47 @@ -286,18 +264,13 @@ bb9: { - StorageLive(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 - StorageLive(_45); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 _45 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 - _27 = (((*_45) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 -+ _30 = (((*_45) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 - StorageDead(_45); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 - StorageLive(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 ++ _30 = (((*_45) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 - StorageLive(_46); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 _46 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 - _28 = (((*_46) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 -+ _31 = (((*_46) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 - StorageDead(_46); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:55 - StorageLive(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:55 - StorageLive(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47 - _30 = _27; // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47 @@ -312,6 +285,7 @@ - StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:55: +9:56 - StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:55: +9:56 - StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:55: +9:56 ++ _31 = (((*_46) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 + nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:55 + nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47 + nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47 @@ -340,5 +314,9 @@ + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:1: +12:2 return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2 } + + bb11: { + unreachable; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2 + } } 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 2519f79f8254e..50a58d4792a8d 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 @@ -78,18 +78,14 @@ (_4.1: &ViewportPercentageLength) = move _6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24 StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24 - StorageLive(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _34 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _11 = discriminant((*_34)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 - 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:+5:8: +5:24 + switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb11]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb1: { - StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _35 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _7 = discriminant((*_35)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } @@ -106,40 +102,30 @@ } bb3: { - StorageLive(_36); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _36 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _8 = discriminant((*_36)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_36); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb4: { - StorageLive(_37); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _37 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _9 = discriminant((*_37)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_37); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb5: { - StorageLive(_38); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _38 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _10 = discriminant((*_38)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - StorageDead(_38); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb6: { StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 - StorageLive(_39); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 _39 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 _12 = (((*_39) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17 - StorageDead(_39); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 - StorageLive(_40); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 _40 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 _13 = (((*_40) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29 - StorageDead(_40); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:49 StorageLive(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:49 StorageLive(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41 _15 = _12; // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41 @@ -159,15 +145,11 @@ bb7: { StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 - StorageLive(_41); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 _41 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 _17 = (((*_41) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17 - StorageDead(_41); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 StorageLive(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 - StorageLive(_42); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 _42 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 _18 = (((*_42) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29 - StorageDead(_42); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:49 StorageLive(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:49 StorageLive(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41 _20 = _17; // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41 @@ -187,15 +169,11 @@ bb8: { StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 - StorageLive(_43); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 _43 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 _22 = (((*_43) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19 - StorageDead(_43); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 - StorageLive(_44); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 _44 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 _23 = (((*_44) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33 - StorageDead(_44); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:55 StorageLive(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:55 StorageLive(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47 _25 = _22; // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47 @@ -215,15 +193,11 @@ bb9: { StorageLive(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 - StorageLive(_45); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 _45 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 _27 = (((*_45) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19 - StorageDead(_45); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 StorageLive(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 - StorageLive(_46); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 _46 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 _28 = (((*_46) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33 - StorageDead(_46); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:55 StorageLive(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:55 StorageLive(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47 _30 = _27; // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47 @@ -249,5 +223,9 @@ StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:1: +12:2 return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2 } + + bb11: { + unreachable; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2 + } } diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index 3d7b3f75a8bf0..9e089b01b0f34 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -16,10 +16,8 @@ } bb1: { - StorageLive(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 _4 = deref_copy (((*_1) as Some).0: &E); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 - StorageDead(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 } diff --git a/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir index d60b064600f56..4b075a8163bf1 100644 --- a/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir @@ -45,15 +45,11 @@ fn foo(_1: T, _2: i32) -> (i32, T) { StorageLive(_9); // scope 1 at $DIR/inline-closure-captures.rs:+2:5: +2:9 _9 = move (_7.0: i32); // scope 1 at $DIR/inline-closure-captures.rs:+2:5: +2:9 StorageLive(_10); // scope 2 at $DIR/inline-closure-captures.rs:+1:19: +1:20 - StorageLive(_12); // scope 2 at $DIR/inline-closure-captures.rs:+1:19: +1:20 _12 = deref_copy ((*_6).0: &i32); // scope 2 at $DIR/inline-closure-captures.rs:+1:19: +1:20 _10 = (*_12); // scope 2 at $DIR/inline-closure-captures.rs:+1:19: +1:20 - StorageDead(_12); // scope 2 at $DIR/inline-closure-captures.rs:+1:22: +1:23 StorageLive(_11); // scope 2 at $DIR/inline-closure-captures.rs:+1:22: +1:23 - StorageLive(_13); // scope 2 at $DIR/inline-closure-captures.rs:+1:22: +1:23 _13 = deref_copy ((*_6).1: &T); // scope 2 at $DIR/inline-closure-captures.rs:+1:22: +1:23 _11 = (*_13); // scope 2 at $DIR/inline-closure-captures.rs:+1:22: +1:23 - StorageDead(_13); // scope 2 at $DIR/inline-closure-captures.rs:+1:18: +1:24 Deinit(_0); // scope 2 at $DIR/inline-closure-captures.rs:+1:18: +1:24 (_0.0: i32) = move _10; // scope 2 at $DIR/inline-closure-captures.rs:+1:18: +1:24 (_0.1: T) = move _11; // scope 2 at $DIR/inline-closure-captures.rs:+1:18: +1:24 diff --git a/src/test/mir-opt/inline/inline_generator.main.Inline.diff b/src/test/mir-opt/inline/inline_generator.main.Inline.diff index fd97d8bf3335e..669a787ae58fe 100644 --- a/src/test/mir-opt/inline/inline_generator.main.Inline.diff +++ b/src/test/mir-opt/inline/inline_generator.main.Inline.diff @@ -75,17 +75,13 @@ + _7 = const false; // scope 0 at $DIR/inline-generator.rs:+1:14: +1:46 + StorageLive(_10); // scope 0 at $DIR/inline-generator.rs:+1:14: +1:46 + StorageLive(_11); // scope 0 at $DIR/inline-generator.rs:+1:14: +1:46 -+ StorageLive(_12); // scope 0 at $DIR/inline-generator.rs:+1:14: +1:46 -+ StorageLive(_13); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8 + _13 = deref_copy (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8 + _12 = discriminant((*_13)); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8 -+ StorageDead(_13); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8 + switchInt(move _12) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline-generator.rs:15:5: 15:8 } - bb3: { + bb1: { -+ StorageDead(_12); // scope 0 at $DIR/inline-generator.rs:+1:14: +1:46 + StorageDead(_11); // scope 0 at $DIR/inline-generator.rs:+1:14: +1:46 + StorageDead(_10); // scope 0 at $DIR/inline-generator.rs:+1:14: +1:46 + StorageDead(_7); // scope 0 at $DIR/inline-generator.rs:+1:14: +1:46 @@ -124,10 +120,8 @@ + Deinit(_1); // scope 6 at $DIR/inline-generator.rs:15:11: 15:39 + ((_1 as Yielded).0: i32) = move _8; // scope 6 at $DIR/inline-generator.rs:15:11: 15:39 + discriminant(_1) = 0; // scope 6 at $DIR/inline-generator.rs:15:11: 15:39 -+ StorageLive(_14); // scope 6 at $DIR/inline-generator.rs:15:11: 15:39 + _14 = deref_copy (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline-generator.rs:15:11: 15:39 + discriminant((*_14)) = 3; // scope 6 at $DIR/inline-generator.rs:15:11: 15:39 -+ StorageDead(_14); // scope 6 at $DIR/inline-generator.rs:15:11: 15:39 + goto -> bb1; // scope 0 at $DIR/inline-generator.rs:15:11: 15:39 + } + @@ -138,10 +132,8 @@ + Deinit(_1); // scope 6 at $DIR/inline-generator.rs:15:8: 15:8 + ((_1 as Complete).0: bool) = move _10; // scope 6 at $DIR/inline-generator.rs:15:8: 15:8 + discriminant(_1) = 1; // scope 6 at $DIR/inline-generator.rs:15:8: 15:8 -+ StorageLive(_15); // scope 6 at $DIR/inline-generator.rs:15:8: 15:8 + _15 = deref_copy (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline-generator.rs:15:8: 15:8 + discriminant((*_15)) = 1; // scope 6 at $DIR/inline-generator.rs:15:8: 15:8 -+ StorageDead(_15); // scope 6 at $DIR/inline-generator.rs:15:8: 15:8 + goto -> bb1; // scope 0 at $DIR/inline-generator.rs:15:8: 15:8 + } + diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff index 5dfcd2d54ca27..7017413ad38a6 100644 --- a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff +++ b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff @@ -33,9 +33,8 @@ bb1: { StorageLive(_5); // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 _5 = ShallowInitBox(move _4, std::vec::Vec); // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 _7 = (((_5.0: std::ptr::Unique>).0: std::ptr::NonNull>).0: *const std::vec::Vec); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 -- (*_7) = Vec::::new() -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 +- (*_7) = Vec::::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 + StorageLive(_8); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 + _8 = &mut (*_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 + StorageLive(_9); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL @@ -55,11 +54,10 @@ + ((*_8).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_9); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_8); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 - StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 _1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 _0 = const (); // scope 0 at $DIR/inline-into-box-place.rs:+0:11: +2:2 -- drop(_1) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 +- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 + drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 } @@ -70,16 +68,15 @@ } - bb4 (cleanup): { -- StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 -- _6 = alloc::alloc::box_free::, std::alloc::Global>(move (_5.0: std::ptr::Unique>), move (_5.1: std::alloc::Global)) -> bb5; // scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 -- // mir::Constant -- // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 -- // + literal: Const { ty: unsafe fn(Unique>, std::alloc::Global) {alloc::alloc::box_free::, std::alloc::Global>}, val: Value() } ++ bb3 (cleanup): { + resume; // scope 0 at $DIR/inline-into-box-place.rs:+0:1: +2:2 - } - - bb5 (cleanup): { -+ bb3 (cleanup): { - resume; // scope 0 at $DIR/inline-into-box-place.rs:+0:1: +2:2 +- _6 = alloc::alloc::box_free::, std::alloc::Global>(move (_5.0: std::ptr::Unique>), move (_5.1: std::alloc::Global)) -> bb4; // scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 +- // mir::Constant +- // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 +- // + literal: Const { ty: unsafe fn(Unique>, std::alloc::Global) {alloc::alloc::box_free::, std::alloc::Global>}, val: Value() } } } diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff index 5dfcd2d54ca27..7017413ad38a6 100644 --- a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff +++ b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff @@ -33,9 +33,8 @@ bb1: { StorageLive(_5); // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 _5 = ShallowInitBox(move _4, std::vec::Vec); // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 _7 = (((_5.0: std::ptr::Unique>).0: std::ptr::NonNull>).0: *const std::vec::Vec); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 -- (*_7) = Vec::::new() -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 +- (*_7) = Vec::::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 + StorageLive(_8); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 + _8 = &mut (*_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 + StorageLive(_9); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL @@ -55,11 +54,10 @@ + ((*_8).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_9); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_8); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 - StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 _1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 _0 = const (); // scope 0 at $DIR/inline-into-box-place.rs:+0:11: +2:2 -- drop(_1) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 +- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 + drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 } @@ -70,16 +68,15 @@ } - bb4 (cleanup): { -- StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 -- _6 = alloc::alloc::box_free::, std::alloc::Global>(move (_5.0: std::ptr::Unique>), move (_5.1: std::alloc::Global)) -> bb5; // scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 -- // mir::Constant -- // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 -- // + literal: Const { ty: unsafe fn(Unique>, std::alloc::Global) {alloc::alloc::box_free::, std::alloc::Global>}, val: Value() } ++ bb3 (cleanup): { + resume; // scope 0 at $DIR/inline-into-box-place.rs:+0:1: +2:2 - } - - bb5 (cleanup): { -+ bb3 (cleanup): { - resume; // scope 0 at $DIR/inline-into-box-place.rs:+0:1: +2:2 +- _6 = alloc::alloc::box_free::, std::alloc::Global>(move (_5.0: std::ptr::Unique>), move (_5.1: std::alloc::Global)) -> bb4; // scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 +- // mir::Constant +- // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 +- // + literal: Const { ty: unsafe fn(Unique>, std::alloc::Global) {alloc::alloc::box_free::, std::alloc::Global>}, val: Value() } } } diff --git a/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index 4006dd15a42e9..06d442ae88b96 100644 --- a/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -21,13 +21,9 @@ fn b(_1: &mut Box) -> &mut T { _4 = &mut (*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:+1:5: +1:15 StorageLive(_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL StorageLive(_6); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - StorageLive(_7); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _7 = deref_copy (*_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - StorageLive(_8); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _8 = (((_7.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _6 = &mut (*_8); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - StorageDead(_8); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - StorageDead(_7); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _5 = &mut (*_6); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _3 = &mut (*_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL StorageDead(_6); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index e516269c1407a..d5f06c54a57c0 100644 --- a/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/src/test/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -15,13 +15,9 @@ fn d(_1: &Box) -> &T { StorageLive(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:+1:5: +1:15 StorageLive(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:+1:5: +1:15 _3 = &(*_1); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:+1:5: +1:15 - StorageLive(_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _4 = deref_copy (*_3); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - StorageLive(_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _5 = (((_4.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _2 = &(*_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - StorageDead(_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - StorageDead(_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _0 = &(*_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:+1:5: +1:15 StorageDead(_3); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:+1:14: +1:15 StorageDead(_2); // scope 0 at $DIR/issue-58867-inline-as-ref-as-mut.rs:+2:1: +2:2 diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 86b38d4b70adc..f46c10711f688 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -55,7 +55,6 @@ fn num_to_digit(_1: char) -> u32 { bb2: { StorageDead(_4); // scope 0 at $DIR/issue-59352.rs:+2:40: +2:41 - StorageLive(_10); // scope 0 at $DIR/issue-59352.rs:+2:26: +2:50 _10 = discriminant(_3); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL } @@ -73,11 +72,9 @@ fn num_to_digit(_1: char) -> u32 { bb5: { _6 = &_7; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageDead(_8); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_9); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL _9 = discriminant((*_6)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL StorageLive(_12); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _12 = move _9; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_9); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageDead(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageDead(_7); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageDead(_5); // scope 0 at $DIR/issue-59352.rs:+2:8: +2:23 @@ -102,7 +99,6 @@ fn num_to_digit(_1: char) -> u32 { bb8: { _0 = move ((_3 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:+2:26: +2:50 StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:+2:49: +2:50 goto -> bb4; // scope 0 at $DIR/issue-59352.rs:+2:5: +2:63 } diff --git a/src/test/mir-opt/separate_const_switch.identity.ConstProp.diff b/src/test/mir-opt/separate_const_switch.identity.ConstProp.diff index ca90489f8aebc..28536dc28a722 100644 --- a/src/test/mir-opt/separate_const_switch.identity.ConstProp.diff +++ b/src/test/mir-opt/separate_const_switch.identity.ConstProp.diff @@ -55,7 +55,6 @@ StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 _4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - StorageLive(_10); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 _10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL } @@ -116,7 +115,6 @@ discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 @@ -138,7 +136,6 @@ discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 diff --git a/src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir b/src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir index 952ef22d41001..df20f0ed36b60 100644 --- a/src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir +++ b/src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir @@ -52,7 +52,6 @@ fn identity(_1: Result) -> Result { StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 _4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - StorageLive(_8); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 _8 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL switchInt(move _8) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL } @@ -72,7 +71,6 @@ fn identity(_1: Result) -> Result { discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_8); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 StorageLive(_5); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 _5 = ((_3 as Break).0: std::result::Result); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 @@ -111,7 +109,6 @@ fn identity(_1: Result) -> Result { discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_9); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_8); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 StorageLive(_7); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 _7 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 diff --git a/src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff b/src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff index 6816f8f9c1e1b..b8c554d3ea6b0 100644 --- a/src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff +++ b/src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff @@ -55,14 +55,12 @@ StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 _4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - StorageLive(_10); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 _10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _10) -> [0_isize: bb7, 1_isize: bb5, otherwise: bb6]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL } bb1: { -- StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - switchInt(move _5) -> [0_isize: bb2, 1_isize: bb4, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 @@ -128,7 +126,6 @@ StorageDead(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 + StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 + _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 + switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 @@ -151,7 +148,6 @@ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 + StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 + _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 + switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10