diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs index 48f3f4f25228a..ff740a96ab68f 100644 --- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs +++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs @@ -17,8 +17,6 @@ use super::operand::{OperandRef, OperandValue}; use super::place::PlaceRef; use super::{FunctionCx, LocalRef}; -use std::ops::Range; - pub struct FunctionDebugContext<'tcx, S, L> { /// Maps from source code to the corresponding debug info scope. pub scopes: IndexVec>, @@ -36,17 +34,17 @@ pub enum VariableKind { #[derive(Clone)] pub struct PerLocalVarDebugInfo<'tcx, D> { pub name: Symbol, + pub ty: Ty<'tcx>, pub source_info: mir::SourceInfo, /// `DIVariable` returned by `create_dbg_var`. pub dbg_var: Option, - /// Byte range in the `dbg_var` covered by this fragment, - /// if this is a fragment of a composite `VarDebugInfo`. - pub fragment: Option>, - /// `.place.projection` from `mir::VarDebugInfo`. - pub projection: &'tcx ty::List>, + pub projection: &'tcx [mir::PlaceElem<'tcx>], + + /// Projection from fragment debuginfo. + pub fragment: &'tcx [mir::PlaceElem<'tcx>], } #[derive(Clone, Copy, Debug)] @@ -149,6 +147,8 @@ struct DebugInfoOffset { indirect_offsets: Vec, /// The final location debuginfo should point to. result: T, + /// Whether the final location is a fragment of a larger contiguous projection. + fragment: bool, } fn calculate_debuginfo_offset< @@ -165,17 +165,21 @@ fn calculate_debuginfo_offset< // FIXME(eddyb) use smallvec here. let mut indirect_offsets = vec![]; let mut place = base; + let mut fragment = false; for elem in projection { + let layout = place.layout(); match *elem { mir::ProjectionElem::Deref => { indirect_offsets.push(Size::ZERO); place = place.deref(bx); + fragment = false; } mir::ProjectionElem::Field(field, _) => { let offset = indirect_offsets.last_mut().unwrap_or(&mut direct_offset); *offset += place.layout().fields.offset(field.index()); place = place.project_field(bx, field); + fragment |= place.layout().size != layout.size; } mir::ProjectionElem::Downcast(_, variant) => { place = place.downcast(bx, variant); @@ -191,16 +195,17 @@ fn calculate_debuginfo_offset< }; *offset += stride * index; place = place.project_constant_index(bx, index); + fragment |= place.layout().size != layout.size; } _ => { // Sanity check for `can_use_in_debuginfo`. debug_assert!(!elem.can_use_in_debuginfo()); - bug!("unsupported var debuginfo projection `{:?}`", projection) + bug!("unsupported var debuginfo place `{:?}`", projection) } } } - DebugInfoOffset { direct_offset, indirect_offsets, result: place } + DebugInfoOffset { direct_offset, indirect_offsets, result: place, fragment } } impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { @@ -290,14 +295,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } else { let name = kw::Empty; let decl = &self.mir.local_decls[local]; + let arg_ty = self.monomorphize(decl.ty); + let dbg_var = if full_debug_info { self.adjusted_span_and_dbg_scope(decl.source_info).map( |(dbg_scope, _, span)| { // FIXME(eddyb) is this `+ 1` needed at all? let kind = VariableKind::ArgumentVariable(arg_index + 1); - let arg_ty = self.monomorphize(decl.ty); - self.cx.create_dbg_var(name, arg_ty, dbg_scope, kind, span) }, ) @@ -307,10 +312,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { Some(PerLocalVarDebugInfo { name, + ty: arg_ty, source_info: decl.source_info, dbg_var, - fragment: None, - projection: ty::List::empty(), + fragment: &[], + projection: &[], }) } } else { @@ -392,8 +398,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let Some(dbg_var) = var.dbg_var else { return }; let Some(dbg_loc) = self.dbg_loc(var.source_info) else { return }; - let DebugInfoOffset { direct_offset, indirect_offsets, result: _ } = + let DebugInfoOffset { mut direct_offset, indirect_offsets, result: _, fragment: _ } = calculate_debuginfo_offset(bx, var.projection, base.layout); + let mut indirect_offsets = &indirect_offsets[..]; // When targeting MSVC, create extra allocas for arguments instead of pointing multiple // dbg_var_addr() calls into the same alloca with offsets. MSVC uses CodeView records @@ -410,8 +417,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { && (direct_offset != Size::ZERO || !matches!(&indirect_offsets[..], [Size::ZERO] | [])); if should_create_individual_allocas { - let DebugInfoOffset { direct_offset: _, indirect_offsets: _, result: place } = - calculate_debuginfo_offset(bx, var.projection, base); + let DebugInfoOffset { + direct_offset: _, + indirect_offsets: _, + fragment: _, + result: place, + } = calculate_debuginfo_offset(bx, var.projection, base); // Create a variable which will be a pointer to the actual value let ptr_ty = Ty::new_ptr( @@ -426,24 +437,53 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx.store(place.llval, alloca.llval, alloca.align); // Point the debug info to `*alloca` for the current variable - bx.dbg_var_addr( - dbg_var, - dbg_loc, - alloca.llval, - Size::ZERO, - &[Size::ZERO], - var.fragment, - ); + direct_offset = Size::ZERO; + indirect_offsets = &[Size::ZERO]; + } + + self.debug_introduce_place( + bx, + dbg_var, + dbg_loc, + base.llval, + direct_offset, + indirect_offsets, + var.ty, + var.fragment, + ); + } + + fn debug_introduce_place( + &self, + bx: &mut Bx, + dbg_var: Bx::DIVariable, + dbg_loc: Bx::DILocation, + base: Bx::Value, + direct_offset: Size, + indirect_offsets: &[Size], + ty: Ty<'tcx>, + fragment: &[mir::PlaceElem<'tcx>], + ) { + let DebugInfoOffset { + direct_offset: fragment_offset, + indirect_offsets: fragment_indirect, + result: fragment_layout, + fragment, + } = calculate_debuginfo_offset(bx, fragment, bx.layout_of(ty)); + + let fragment = if fragment_layout.size == Size::ZERO { + return; + } else if fragment { + Some(fragment_offset..fragment_offset + fragment_layout.size) } else { - bx.dbg_var_addr( - dbg_var, - dbg_loc, - base.llval, - direct_offset, - &indirect_offsets, - var.fragment, - ); + None + }; + + if !fragment_indirect.is_empty() { + return; } + + bx.dbg_var_addr(dbg_var, dbg_loc, base, direct_offset, indirect_offsets, fragment); } pub fn debug_introduce_locals(&self, bx: &mut Bx) { @@ -515,32 +555,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span) }); - let fragment = if let Some(ref fragment) = var.composite { - let var_layout = self.cx.layout_of(var_ty); - - let DebugInfoOffset { direct_offset, indirect_offsets, result: fragment_layout } = - calculate_debuginfo_offset(bx, &fragment.projection, var_layout); - debug_assert!(indirect_offsets.is_empty()); - - if fragment_layout.size == Size::ZERO { - // Fragment is a ZST, so does not represent anything. Avoid generating anything - // as this may conflict with a fragment that covers the entire variable. - continue; - } else if fragment_layout.size == var_layout.size { - // Fragment covers entire variable, so as far as - // DWARF is concerned, it's not really a fragment. - None - } else { - Some(direct_offset..direct_offset + fragment_layout.size) - } - } else { - None - }; + let fragment = + if let Some(ref fragment) = var.composite { &fragment.projection[..] } else { &[] }; match var.value { mir::VarDebugInfoContents::Place(place) => { per_local[place.local].push(PerLocalVarDebugInfo { name: var.name, + ty: var_ty, source_info: var.source_info, dbg_var, fragment, @@ -556,7 +578,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let base = Self::spill_operand_to_stack(operand, Some(var.name.to_string()), bx); - bx.dbg_var_addr(dbg_var, dbg_loc, base.llval, Size::ZERO, &[], fragment); + self.debug_introduce_place( + bx, + dbg_var, + dbg_loc, + base.llval, + Size::ZERO, + &[], + var_ty, + fragment, + ); } } } diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs index d296ff5928b36..3b01ef92c559c 100644 --- a/compiler/rustc_const_eval/src/interpret/cast.rs +++ b/compiler/rustc_const_eval/src/interpret/cast.rs @@ -416,7 +416,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } } - fn unsize_into( + pub fn unsize_into( &mut self, src: &OpTy<'tcx, M::Provenance>, cast_ty: TyAndLayout<'tcx>, diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index 9c2f336e9128c..4782f500d7363 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -748,7 +748,12 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { format!("invalid empty projection in debuginfo for {:?}", debuginfo.name), ); } - if projection.iter().any(|p| !matches!(p, PlaceElem::Field(..))) { + if !projection.iter().all(|p| { + matches!( + p, + PlaceElem::Field(..) | PlaceElem::Deref | PlaceElem::ConstantIndex { .. } + ) + }) { self.fail( START_BLOCK.start_location(), format!( diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 4696f54c89787..8eb06378c8542 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -846,8 +846,13 @@ macro_rules! make_mir_visitor { if let Some(box VarDebugInfoFragment { ref $($mutability)? ty, ref $($mutability)? projection }) = composite { self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)); for elem in projection { - let ProjectionElem::Field(_, ty) = elem else { bug!() }; - self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)); + match elem { + ProjectionElem::Deref | ProjectionElem::ConstantIndex { .. } => {} + ProjectionElem::Field(_, ty) => { + self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)) + } + _ => bug!("unexpected projection in debuginfo: {elem:?}"), + } } } match value { diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs index 2802f5491be03..17af40d3c5d6d 100644 --- a/compiler/rustc_mir_dataflow/src/value_analysis.rs +++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs @@ -720,7 +720,7 @@ impl Map { /// This is currently the only way to create a [`Map`]. The way in which the tracked places are /// chosen is an implementation detail and may not be relied upon (other than that their type /// are scalars). - pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, value_limit: Option) -> Self { + pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, place_limit: Option) -> Self { let mut map = Self { locals: IndexVec::new(), projections: FxHashMap::default(), @@ -730,7 +730,7 @@ impl Map { inner_values_buffer: Vec::new(), }; let exclude = excluded_locals(body); - map.register(tcx, body, exclude, value_limit); + map.register(tcx, body, exclude, place_limit); debug!("registered {} places ({} nodes in total)", map.value_count, map.places.len()); map } @@ -741,9 +741,9 @@ impl Map { tcx: TyCtxt<'tcx>, body: &Body<'tcx>, exclude: BitSet, - value_limit: Option, + place_limit: Option, ) { - let mut worklist = VecDeque::with_capacity(value_limit.unwrap_or(body.local_decls.len())); + let mut worklist = VecDeque::with_capacity(place_limit.unwrap_or(body.local_decls.len())); let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); // Start by constructing the places for each bare local. @@ -766,8 +766,8 @@ impl Map { // `elem1` is either `Some(Variant(i))` or `None`. while let Some((mut place, elem1, elem2, ty)) = worklist.pop_front() { // The user requires a bound on the number of created values. - if let Some(value_limit) = value_limit - && self.value_count >= value_limit + if let Some(place_limit) = place_limit + && self.places.len() >= place_limit { break; } diff --git a/compiler/rustc_mir_transform/src/const_goto.rs b/compiler/rustc_mir_transform/src/const_goto.rs deleted file mode 100644 index cb5b66b314d69..0000000000000 --- a/compiler/rustc_mir_transform/src/const_goto.rs +++ /dev/null @@ -1,128 +0,0 @@ -//! This pass optimizes the following sequence -//! ```rust,ignore (example) -//! bb2: { -//! _2 = const true; -//! goto -> bb3; -//! } -//! -//! bb3: { -//! switchInt(_2) -> [false: bb4, otherwise: bb5]; -//! } -//! ``` -//! into -//! ```rust,ignore (example) -//! bb2: { -//! _2 = const true; -//! goto -> bb5; -//! } -//! ``` - -use rustc_middle::mir::*; -use rustc_middle::ty::TyCtxt; -use rustc_middle::{mir::visit::Visitor, ty::ParamEnv}; - -use super::simplify::{simplify_cfg, simplify_locals}; - -pub struct ConstGoto; - -impl<'tcx> MirPass<'tcx> for ConstGoto { - fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - // This pass participates in some as-of-yet untested unsoundness found - // in https://github.com/rust-lang/rust/issues/112460 - sess.mir_opt_level() >= 2 && sess.opts.unstable_opts.unsound_mir_opts - } - - fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - trace!("Running ConstGoto on {:?}", body.source); - let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); - let mut opt_finder = - ConstGotoOptimizationFinder { tcx, body, optimizations: vec![], param_env }; - opt_finder.visit_body(body); - let should_simplify = !opt_finder.optimizations.is_empty(); - for opt in opt_finder.optimizations { - let block = &mut body.basic_blocks_mut()[opt.bb_with_goto]; - block.statements.extend(opt.stmts_move_up); - let terminator = block.terminator_mut(); - let new_goto = TerminatorKind::Goto { target: opt.target_to_use_in_goto }; - debug!("SUCCESS: replacing `{:?}` with `{:?}`", terminator.kind, new_goto); - terminator.kind = new_goto; - } - - // if we applied optimizations, we potentially have some cfg to cleanup to - // make it easier for further passes - if should_simplify { - simplify_cfg(body); - simplify_locals(body, tcx); - } - } -} - -impl<'tcx> Visitor<'tcx> for ConstGotoOptimizationFinder<'_, 'tcx> { - fn visit_basic_block_data(&mut self, block: BasicBlock, data: &BasicBlockData<'tcx>) { - if data.is_cleanup { - // Because of the restrictions around control flow in cleanup blocks, we don't perform - // this optimization at all in such blocks. - return; - } - self.super_basic_block_data(block, data); - } - - fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) { - let _: Option<_> = try { - let target = terminator.kind.as_goto()?; - // We only apply this optimization if the last statement is a const assignment - let last_statement = self.body.basic_blocks[location.block].statements.last()?; - - if let (place, Rvalue::Use(Operand::Constant(_const))) = - last_statement.kind.as_assign()? - { - // We found a constant being assigned to `place`. - // Now check that the target of this Goto switches on this place. - let target_bb = &self.body.basic_blocks[target]; - - // The `StorageDead(..)` statement does not affect the functionality of mir. - // We can move this part of the statement up to the predecessor. - let mut stmts_move_up = Vec::new(); - for stmt in &target_bb.statements { - if let StatementKind::StorageDead(..) = stmt.kind { - stmts_move_up.push(stmt.clone()) - } else { - None?; - } - } - - let target_bb_terminator = target_bb.terminator(); - let (discr, targets) = target_bb_terminator.kind.as_switch()?; - if discr.place() == Some(*place) { - let switch_ty = place.ty(self.body.local_decls(), self.tcx).ty; - debug_assert_eq!(switch_ty, _const.ty()); - // We now know that the Switch matches on the const place, and it is statementless - // Now find which value in the Switch matches the const value. - let const_value = _const.const_.try_eval_bits(self.tcx, self.param_env)?; - let target_to_use_in_goto = targets.target_for_value(const_value); - self.optimizations.push(OptimizationToApply { - bb_with_goto: location.block, - target_to_use_in_goto, - stmts_move_up, - }); - } - } - Some(()) - }; - - self.super_terminator(terminator, location); - } -} - -struct OptimizationToApply<'tcx> { - bb_with_goto: BasicBlock, - target_to_use_in_goto: BasicBlock, - stmts_move_up: Vec>, -} - -pub struct ConstGotoOptimizationFinder<'a, 'tcx> { - tcx: TyCtxt<'tcx>, - body: &'a Body<'tcx>, - param_env: ParamEnv<'tcx>, - optimizations: Vec>, -} diff --git a/compiler/rustc_mir_transform/src/copy_prop.rs b/compiler/rustc_mir_transform/src/copy_prop.rs index 0119b95cced97..8af6bd2a96c9d 100644 --- a/compiler/rustc_mir_transform/src/copy_prop.rs +++ b/compiler/rustc_mir_transform/src/copy_prop.rs @@ -112,6 +112,9 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> { fn visit_local(&mut self, local: &mut Local, ctxt: PlaceContext, _: Location) { let new_local = self.copy_classes[*local]; + if self.borrowed_locals.contains(*local) { + return; + } match ctxt { // Do not modify the local in storage statements. PlaceContext::NonUse(NonUseContext::StorageLive | NonUseContext::StorageDead) => {} @@ -122,32 +125,16 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> { } } - fn visit_place(&mut self, place: &mut Place<'tcx>, ctxt: PlaceContext, loc: Location) { + fn visit_place(&mut self, place: &mut Place<'tcx>, _: PlaceContext, loc: Location) { if let Some(new_projection) = self.process_projection(place.projection, loc) { place.projection = self.tcx().mk_place_elems(&new_projection); } - let observes_address = match ctxt { - PlaceContext::NonMutatingUse( - NonMutatingUseContext::SharedBorrow - | NonMutatingUseContext::FakeBorrow - | NonMutatingUseContext::AddressOf, - ) => true, - // For debuginfo, merging locals is ok. - PlaceContext::NonUse(NonUseContext::VarDebugInfo) => { - self.borrowed_locals.contains(place.local) - } - _ => false, - }; - if observes_address && !place.is_indirect() { - // We observe the address of `place.local`. Do not replace it. - } else { - self.visit_local( - &mut place.local, - PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy), - loc, - ) - } + self.visit_local( + &mut place.local, + PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy), + loc, + ) } fn visit_operand(&mut self, operand: &mut Operand<'tcx>, loc: Location) { diff --git a/compiler/rustc_mir_transform/src/cost_checker.rs b/compiler/rustc_mir_transform/src/cost_checker.rs index 79bed960b950f..5a1a42e64cc8c 100644 --- a/compiler/rustc_mir_transform/src/cost_checker.rs +++ b/compiler/rustc_mir_transform/src/cost_checker.rs @@ -2,7 +2,7 @@ use rustc_middle::mir::visit::*; use rustc_middle::mir::*; use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt}; -const INSTR_COST: usize = 5; +const INSTR_COST: usize = 1; const CALL_PENALTY: usize = 25; const LANDINGPAD_PENALTY: usize = 50; const RESUME_PENALTY: usize = 45; diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index ad12bce9b0232..ae66bbf228ee0 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -2,7 +2,9 @@ //! //! Currently, this pass only propagates scalar values. -use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, PlaceTy, Projectable}; +use rustc_const_eval::interpret::{ + ImmTy, Immediate, InterpCx, OpTy, PlaceTy, Pointer, PointerArithmetic, Projectable, +}; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::DefKind; use rustc_middle::mir::interpret::{AllocId, ConstAllocation, InterpResult, Scalar}; @@ -23,23 +25,18 @@ use crate::const_prop::throw_machine_stop_str; // These constants are somewhat random guesses and have not been optimized. // If `tcx.sess.mir_opt_level() >= 4`, we ignore the limits (this can become very expensive). -const BLOCK_LIMIT: usize = 100; const PLACE_LIMIT: usize = 100; pub struct DataflowConstProp; impl<'tcx> MirPass<'tcx> for DataflowConstProp { fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - sess.mir_opt_level() >= 3 + sess.mir_opt_level() >= 2 } #[instrument(skip_all level = "debug")] fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { debug!(def_id = ?body.source.def_id()); - if tcx.sess.mir_opt_level() < 4 && body.basic_blocks.len() > BLOCK_LIMIT { - debug!("aborted dataflow const prop due too many basic blocks"); - return; - } // We want to have a somewhat linear runtime w.r.t. the number of statements/terminators. // Let's call this number `n`. Dataflow analysis has `O(h*n)` transfer function @@ -935,12 +932,64 @@ impl<'mir, 'tcx: 'mir> rustc_const_eval::interpret::Machine<'mir, 'tcx> for Dumm } fn binary_ptr_op( - _ecx: &InterpCx<'mir, 'tcx, Self>, - _bin_op: BinOp, - _left: &rustc_const_eval::interpret::ImmTy<'tcx, Self::Provenance>, - _right: &rustc_const_eval::interpret::ImmTy<'tcx, Self::Provenance>, + ecx: &InterpCx<'mir, 'tcx, Self>, + bin_op: BinOp, + left: &rustc_const_eval::interpret::ImmTy<'tcx, Self::Provenance>, + right: &rustc_const_eval::interpret::ImmTy<'tcx, Self::Provenance>, ) -> interpret::InterpResult<'tcx, (ImmTy<'tcx, Self::Provenance>, bool)> { - throw_machine_stop_str!("can't do pointer arithmetic"); + use rustc_middle::mir::BinOp::*; + Ok(match bin_op { + Eq | Ne | Lt | Le | Gt | Ge => { + assert_eq!(left.layout.abi, right.layout.abi); // types an differ, e.g. fn ptrs with different `for` + let size = ecx.pointer_size(); + // Just compare the bits. ScalarPairs are compared lexicographically. + // We thus always compare pairs and simply fill scalars up with 0. + let left = match **left { + Immediate::Scalar(l) => (l.to_bits(size)?, 0), + Immediate::ScalarPair(l1, l2) => (l1.to_bits(size)?, l2.to_bits(size)?), + Immediate::Uninit => panic!("we should never see uninit data here"), + }; + let right = match **right { + Immediate::Scalar(r) => (r.to_bits(size)?, 0), + Immediate::ScalarPair(r1, r2) => (r1.to_bits(size)?, r2.to_bits(size)?), + Immediate::Uninit => panic!("we should never see uninit data here"), + }; + let res = match bin_op { + Eq => left == right, + Ne => left != right, + Lt => left < right, + Le => left <= right, + Gt => left > right, + Ge => left >= right, + _ => bug!(), + }; + (ImmTy::from_bool(res, *ecx.tcx), false) + } + + // Some more operations are possible with atomics. + // The return value always has the provenance of the *left* operand. + Add | Sub | BitOr | BitAnd | BitXor => { + assert!(left.layout.ty.is_unsafe_ptr()); + assert!(right.layout.ty.is_unsafe_ptr()); + let ptr = left.to_scalar().to_pointer(ecx)?; + // We do the actual operation with usize-typed scalars. + let usize_layout = ecx.layout_of(ecx.tcx.types.usize).unwrap(); + let left = ImmTy::from_uint(ptr.addr().bytes(), usize_layout); + let right = ImmTy::from_uint(right.to_scalar().to_target_usize(ecx)?, usize_layout); + let (result, overflowing) = ecx.overflowing_binary_op(bin_op, &left, &right)?; + // Construct a new pointer with the provenance of `ptr` (the LHS). + let result_ptr = Pointer::new( + ptr.provenance, + Size::from_bytes(result.to_scalar().to_target_usize(ecx)?), + ); + ( + ImmTy::from_scalar(Scalar::from_maybe_pointer(result_ptr, ecx), left.layout), + overflowing, + ) + } + + _ => span_bug!(ecx.cur_span(), "Invalid operator on pointers: {:?}", bin_op), + }) } fn expose_ptr( diff --git a/compiler/rustc_mir_transform/src/dead_store_elimination.rs b/compiler/rustc_mir_transform/src/dead_store_elimination.rs index e6317e5469ce8..e6e105a5c461b 100644 --- a/compiler/rustc_mir_transform/src/dead_store_elimination.rs +++ b/compiler/rustc_mir_transform/src/dead_store_elimination.rs @@ -127,6 +127,7 @@ pub fn eliminate<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { pub enum DeadStoreElimination { Initial, + AfterJumpThreading, Final, } @@ -134,6 +135,7 @@ impl<'tcx> MirPass<'tcx> for DeadStoreElimination { fn name(&self) -> &'static str { match self { DeadStoreElimination::Initial => "DeadStoreElimination-initial", + DeadStoreElimination::AfterJumpThreading => "DeadStoreElimination-after-jump-threading", DeadStoreElimination::Final => "DeadStoreElimination-final", } } diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index 0ac4ab61d409c..aa22843251790 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -132,7 +132,7 @@ //! [attempt 3]: https://github.com/rust-lang/rust/pull/72632 use crate::MirPass; -use rustc_data_structures::fx::{FxIndexMap, IndexEntry, IndexOccupiedEntry}; +use rustc_data_structures::fx::{FxHashMap, FxIndexMap, IndexEntry, IndexOccupiedEntry}; use rustc_index::bit_set::BitSet; use rustc_index::interval::SparseIntervalMatrix; use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor}; @@ -159,7 +159,7 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { // 2. Despite being an overall perf improvement, this still causes a 30% regression in // keccak. We can temporarily fix this by bounding function size, but in the long term // we should fix this by being smarter about invalidating analysis results. - sess.mir_opt_level() >= 3 + sess.mir_opt_level() >= 2 } fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { @@ -216,12 +216,14 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { // This is the set of merges we will apply this round. It is a subset of the candidates. let mut merges = FxIndexMap::default(); + let mut remove_writes = FxHashMap::default(); - for (src, candidates) in candidates.c.iter() { - if merged_locals.contains(*src) { + for (src, candidates) in candidates.c.drain(..) { + if merged_locals.contains(src) { continue; } - let Some(dest) = candidates.iter().find(|dest| !merged_locals.contains(**dest)) + let Some(dest) = + candidates.into_iter().find(|(dest, _)| !merged_locals.contains(*dest)) else { continue; }; @@ -231,14 +233,17 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { break; } - // Replace `src` by `dest` everywhere. - merges.insert(*src, *dest); - merged_locals.insert(*src); - merged_locals.insert(*dest); - // Update liveness information based on the merge we just performed. // Every location where `src` was live, `dest` will be live. - live.union_rows(*src, *dest); + live.union_rows(src, dest.0); + + // Replace `src` by `dest` everywhere. + merged_locals.insert(src); + merged_locals.insert(dest.0); + merges.insert(src, dest.0); + if !dest.1.is_empty() { + remove_writes.insert(dest.0, dest.1); + } } trace!(merging = ?merges); @@ -247,7 +252,7 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { } round_count += 1; - apply_merges(body, tcx, &merges, &merged_locals); + apply_merges(body, tcx, &merges, &remove_writes, &merged_locals); } trace!(round_count); @@ -260,7 +265,7 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { /// frequently. Everything with a `&'alloc` lifetime points into here. #[derive(Default)] struct Allocations { - candidates: FxIndexMap>, + candidates: FxIndexMap)>>, candidates_reverse: FxIndexMap>, write_info: WriteInfo, // PERF: Do this for `MaybeLiveLocals` allocations too. @@ -282,7 +287,7 @@ struct Candidates<'alloc> { /// /// We will still report that we would like to merge `_1` and `_2` in an attempt to allow us to /// remove that assignment. - c: &'alloc mut FxIndexMap>, + c: &'alloc mut FxIndexMap)>>, /// A reverse index of the `c` set; if the `c` set contains `a => Place { local: b, proj }`, /// then this contains `b => a`. // PERF: Possibly these should be `SmallVec`s? @@ -298,18 +303,29 @@ fn apply_merges<'tcx>( body: &mut Body<'tcx>, tcx: TyCtxt<'tcx>, merges: &FxIndexMap, + remove_writes: &FxHashMap>, merged_locals: &BitSet, ) { - let mut merger = Merger { tcx, merges, merged_locals }; + let mut merger = Merger { tcx, merges, remove_writes, merged_locals }; merger.visit_body_preserves_cfg(body); } struct Merger<'a, 'tcx> { tcx: TyCtxt<'tcx>, merges: &'a FxIndexMap, + remove_writes: &'a FxHashMap>, merged_locals: &'a BitSet, } +impl<'a, 'tcx> Merger<'a, 'tcx> { + fn should_remove_write_at(&self, local: Local, location: Location) -> bool { + let Some(to_remove) = self.remove_writes.get(&local) else { + return false; + }; + to_remove.contains(&location) + } +} + impl<'a, 'tcx> MutVisitor<'tcx> for Merger<'a, 'tcx> { fn tcx(&self) -> TyCtxt<'tcx> { self.tcx @@ -348,10 +364,27 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Merger<'a, 'tcx> { _ => {} } } + StatementKind::Deinit(place) => { + if self.should_remove_write_at(place.local, location) { + statement.make_nop(); + } + } _ => {} } } + + fn visit_operand(&mut self, op: &mut Operand<'tcx>, location: Location) { + self.super_operand(op, location); + match op { + Operand::Move(place) => { + if self.should_remove_write_at(place.local, location) { + *op = Operand::Copy(*place); + } + } + _ => (), + } + } } ////////////////////////////////////////////////////////// @@ -373,30 +406,35 @@ struct FilterInformation<'a, 'body, 'alloc, 'tcx> { // through these methods, and not directly. impl<'alloc> Candidates<'alloc> { /// Just `Vec::retain`, but the condition is inverted and we add debugging output - fn vec_filter_candidates( + fn vec_modify_candidates( src: Local, - v: &mut Vec, - mut f: impl FnMut(Local) -> CandidateFilter, + v: &mut Vec<(Local, Vec)>, + mut f: impl FnMut(Local) -> CandidateModification, at: Location, ) { - v.retain(|dest| { - let remove = f(*dest); - if remove == CandidateFilter::Remove { + v.retain_mut(|(dest, remove_writes)| match f(*dest) { + CandidateModification::Remove => { trace!("eliminating {:?} => {:?} due to conflict at {:?}", src, dest, at); + false + } + CandidateModification::RemoveWrite => { + trace!("marking write for {:?} => {:?} as needing removing at {:?}", src, dest, at); + remove_writes.push(at); + true } - remove == CandidateFilter::Keep + CandidateModification::Keep => true, }); } /// `vec_filter_candidates` but for an `Entry` fn entry_filter_candidates( - mut entry: IndexOccupiedEntry<'_, Local, Vec>, + mut entry: IndexOccupiedEntry<'_, Local, Vec<(Local, Vec)>>, p: Local, - f: impl FnMut(Local) -> CandidateFilter, + f: impl FnMut(Local) -> CandidateModification, at: Location, ) { let candidates = entry.get_mut(); - Self::vec_filter_candidates(p, candidates, f, at); + Self::vec_modify_candidates(p, candidates, f, at); if candidates.len() == 0 { entry.remove(); } @@ -406,7 +444,7 @@ impl<'alloc> Candidates<'alloc> { fn filter_candidates_by( &mut self, p: Local, - mut f: impl FnMut(Local) -> CandidateFilter, + mut f: impl FnMut(Local) -> CandidateModification, at: Location, ) { // Cover the cases where `p` appears as a `src` @@ -420,7 +458,8 @@ impl<'alloc> Candidates<'alloc> { // We use `retain` here to remove the elements from the reverse set if we've removed the // matching candidate in the forward set. srcs.retain(|src| { - if f(*src) == CandidateFilter::Keep { + let modification = f(*src); + if modification == CandidateModification::Keep { return true; } let IndexEntry::Occupied(entry) = self.c.entry(*src) else { @@ -430,18 +469,20 @@ impl<'alloc> Candidates<'alloc> { entry, *src, |dest| { - if dest == p { CandidateFilter::Remove } else { CandidateFilter::Keep } + if dest == p { modification } else { CandidateModification::Keep } }, at, ); - false + // Remove the src from the reverse set if we removed the candidate pair + modification == CandidateModification::RemoveWrite }); } } #[derive(Copy, Clone, PartialEq, Eq)] -enum CandidateFilter { +enum CandidateModification { Keep, + RemoveWrite, Remove, } @@ -500,11 +541,16 @@ impl<'a, 'body, 'alloc, 'tcx> FilterInformation<'a, 'body, 'alloc, 'tcx> { fn apply_conflicts(&mut self) { let writes = &self.write_info.writes; - for p in writes { + for &(p, is_removable) in writes { + let modification = if is_removable { + CandidateModification::RemoveWrite + } else { + CandidateModification::Remove + }; let other_skip = self.write_info.skip_pair.and_then(|(a, b)| { - if a == *p { + if a == p { Some(b) - } else if b == *p { + } else if b == p { Some(a) } else { None @@ -512,20 +558,20 @@ impl<'a, 'body, 'alloc, 'tcx> FilterInformation<'a, 'body, 'alloc, 'tcx> { }); let at = self.points.point_from_location(self.at); self.candidates.filter_candidates_by( - *p, + p, |q| { if Some(q) == other_skip { - return CandidateFilter::Keep; + return CandidateModification::Keep; } // It is possible that a local may be live for less than the // duration of a statement This happens in the case of function // calls or inline asm. Because of this, we also mark locals as // conflicting when both of them are written to in the same // statement. - if self.live.contains(q, at) || writes.contains(&q) { - CandidateFilter::Remove + if self.live.contains(q, at) || writes.iter().any(|&(x, _)| x == q) { + modification } else { - CandidateFilter::Keep + CandidateModification::Keep } }, self.at, @@ -537,7 +583,9 @@ impl<'a, 'body, 'alloc, 'tcx> FilterInformation<'a, 'body, 'alloc, 'tcx> { /// Describes where a statement/terminator writes to #[derive(Default, Debug)] struct WriteInfo { - writes: Vec, + /// Which locals are written to. The `bool` is true if the write is "removable," ie if it comes + /// from a `Operand::Move` or `Deinit`. + writes: Vec<(Local, bool)>, /// If this pair of locals is a candidate pair, completely skip processing it during this /// statement. All other candidates are unaffected. skip_pair: Option<(Local, Local)>, @@ -581,10 +629,11 @@ impl WriteInfo { | Rvalue::CopyForDeref(_) => (), } } + StatementKind::Deinit(p) => { + self.writes.push((p.local, true)); + } // Retags are technically also reads, but reporting them as a write suffices - StatementKind::SetDiscriminant { place, .. } - | StatementKind::Deinit(place) - | StatementKind::Retag(_, place) => { + StatementKind::SetDiscriminant { place, .. } | StatementKind::Retag(_, place) => { self.add_place(**place); } StatementKind::Intrinsic(_) @@ -669,16 +718,12 @@ impl WriteInfo { } fn add_place(&mut self, place: Place<'_>) { - self.writes.push(place.local); + self.writes.push((place.local, false)); } fn add_operand<'tcx>(&mut self, op: &Operand<'tcx>) { match op { - // FIXME(JakobDegen): In a previous version, the `Move` case was incorrectly treated as - // being a read only. This was unsound, however we cannot add a regression test because - // it is not possible to set this off with current MIR. Once we have that ability, a - // regression test should be added. - Operand::Move(p) => self.add_place(*p), + Operand::Move(p) => self.writes.push((p.local, true)), Operand::Copy(_) | Operand::Constant(_) => (), } } @@ -733,7 +778,7 @@ fn places_to_candidate_pair<'tcx>( fn find_candidates<'alloc, 'tcx>( body: &Body<'tcx>, borrowed: &BitSet, - candidates: &'alloc mut FxIndexMap>, + candidates: &'alloc mut FxIndexMap)>>, candidates_reverse: &'alloc mut FxIndexMap>, ) -> Candidates<'alloc> { candidates.clear(); @@ -747,8 +792,8 @@ fn find_candidates<'alloc, 'tcx>( } // Generate the reverse map for (src, cands) in candidates.iter() { - for dest in cands.iter().copied() { - candidates_reverse.entry(dest).or_default().push(*src); + for (dest, _) in cands.iter() { + candidates_reverse.entry(*dest).or_default().push(*src); } } Candidates { c: candidates, reverse: candidates_reverse } @@ -756,7 +801,7 @@ fn find_candidates<'alloc, 'tcx>( struct FindAssignments<'a, 'alloc, 'tcx> { body: &'a Body<'tcx>, - candidates: &'alloc mut FxIndexMap>, + candidates: &'alloc mut FxIndexMap)>>, borrowed: &'a BitSet, } @@ -793,7 +838,7 @@ impl<'tcx> Visitor<'tcx> for FindAssignments<'_, '_, 'tcx> { } // We may insert duplicates here, but that's fine - self.candidates.entry(src).or_default().push(dest); + self.candidates.entry(src).or_default().push((dest, Vec::new())); } } } diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 390ec3e1a36ac..eab87f8f18260 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -93,7 +93,6 @@ use rustc_index::IndexVec; use rustc_middle::mir::interpret::GlobalAlloc; use rustc_middle::mir::visit::*; use rustc_middle::mir::*; -use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::layout::LayoutOf; use rustc_middle::ty::{self, Ty, TyCtxt, TypeAndMut}; use rustc_span::def_id::DefId; @@ -103,12 +102,23 @@ use smallvec::SmallVec; use std::borrow::Cow; use crate::dataflow_const_prop::DummyMachine; +use crate::simplify::UsedLocals; use crate::ssa::{AssignedValue, SsaLocals}; use either::Either; -pub struct GVN; +pub enum GVN { + Initial, + Final, +} impl<'tcx> MirPass<'tcx> for GVN { + fn name(&self) -> &'static str { + match self { + GVN::Initial => "GVN", + GVN::Final => "GVN-final", + } + } + fn is_enabled(&self, sess: &rustc_session::Session) -> bool { sess.mir_opt_level() >= 2 } @@ -159,6 +169,11 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { state.visit_basic_block_data(bb, data); } + let mut used_locals = UsedLocals::new(body, false); + for dbg in body.var_debug_info.iter_mut() { + state.reduce_debuginfo(dbg, &mut used_locals); + } + // For each local that is reused (`y` above), we remove its storage statements do avoid any // difficulty. Those locals are SSA, so should be easy to optimize by LLVM without storage // statements. @@ -551,6 +566,29 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { } value.offset(Size::ZERO, to, &self.ecx).ok()? } + CastKind::PointerCoercion(ty::adjustment::PointerCoercion::Unsize) => { + let src = self.evaluated[value].as_ref()?; + let to = self.ecx.layout_of(to).ok()?; + let dest = self.ecx.allocate(to, MemoryKind::Stack).ok()?; + self.ecx.unsize_into(src, to, &dest.clone().into()).ok()?; + self.ecx + .alloc_mark_immutable(dest.ptr().provenance.unwrap().alloc_id()) + .ok()?; + dest.into() + } + CastKind::FnPtrToPtr + | CastKind::PtrToPtr + | CastKind::PointerCoercion( + ty::adjustment::PointerCoercion::MutToConstPointer + | ty::adjustment::PointerCoercion::ArrayToPointer + | ty::adjustment::PointerCoercion::UnsafeFnPointer, + ) => { + let src = self.evaluated[value].as_ref()?; + let src = self.ecx.read_immediate(src).ok()?; + let to = self.ecx.layout_of(to).ok()?; + let ret = self.ecx.ptr_to_ptr(&src, to).ok()?; + ret.into() + } _ => return None, }, }; @@ -698,6 +736,14 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { // Invariant: `value` holds the value up-to the `index`th projection excluded. let mut value = self.locals[place.local]?; for (index, proj) in place.projection.iter().enumerate() { + if let Value::Projection(pointer, ProjectionElem::Deref) = *self.get(value) + && let Value::Address { place: mut pointee, kind, .. } = *self.get(pointer) + && let AddressKind::Ref(BorrowKind::Shared) = kind + && let Some(v) = self.simplify_place_value(&mut pointee, location) + { + value = v; + place_ref = pointee.project_deeper(&place.projection[index..], self.tcx).as_ref(); + } if let Some(local) = self.try_as_local(value, location) { // Both `local` and `Place { local: place.local, projection: projection[..index] }` // hold the same value. Therefore, following place holds the value in the original @@ -709,6 +755,14 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { value = self.project(base, value, proj)?; } + if let Value::Projection(pointer, ProjectionElem::Deref) = *self.get(value) + && let Value::Address { place: mut pointee, kind, .. } = *self.get(pointer) + && let AddressKind::Ref(BorrowKind::Shared) = kind + && let Some(v) = self.simplify_place_value(&mut pointee, location) + { + value = v; + place_ref = pointee.project_deeper(&[], self.tcx).as_ref(); + } if let Some(new_local) = self.try_as_local(value, location) { place_ref = PlaceRef { local: new_local, projection: &[] }; } @@ -777,18 +831,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { // Operations. Rvalue::Len(ref mut place) => return self.simplify_len(place, location), - Rvalue::Cast(kind, ref mut value, to) => { - let from = value.ty(self.local_decls, self.tcx); - let value = self.simplify_operand(value, location)?; - if let CastKind::PointerCoercion( - PointerCoercion::ReifyFnPointer | PointerCoercion::ClosureFnPointer(_), - ) = kind - { - // Each reification of a generic fn may get a different pointer. - // Do not try to merge them. - return self.new_opaque(); - } - Value::Cast { kind, value, from, to } + Rvalue::Cast(ref mut kind, ref mut value, to) => { + return self.simplify_cast(kind, value, to, location); } Rvalue::BinaryOp(op, box (ref mut lhs, ref mut rhs)) => { let ty = lhs.ty(self.local_decls, self.tcx); @@ -876,6 +920,12 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { } } + let fields: Option> = fields + .iter_mut() + .map(|op| self.simplify_operand(op, location).or_else(|| self.new_opaque())) + .collect(); + let fields = fields?; + let (ty, variant_index) = match *kind { AggregateKind::Array(..) => { assert!(!fields.is_empty()); @@ -895,12 +945,6 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { AggregateKind::Adt(_, _, _, _, Some(_)) => return None, }; - let fields: Option> = fields - .iter_mut() - .map(|op| self.simplify_operand(op, location).or_else(|| self.new_opaque())) - .collect(); - let fields = fields?; - if let AggregateTy::Array = ty && fields.len() > 4 { @@ -1031,6 +1075,50 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { } } + fn simplify_cast( + &mut self, + kind: &mut CastKind, + operand: &mut Operand<'tcx>, + to: Ty<'tcx>, + location: Location, + ) -> Option { + use rustc_middle::ty::adjustment::PointerCoercion::*; + use CastKind::*; + + let mut from = operand.ty(self.local_decls, self.tcx); + let mut value = self.simplify_operand(operand, location)?; + if from == to { + return Some(value); + } + + if let CastKind::PointerCoercion(ReifyFnPointer | ClosureFnPointer(_)) = kind { + // Each reification of a generic fn may get a different pointer. + // Do not try to merge them. + return self.new_opaque(); + } + + if let PtrToPtr | PointerCoercion(MutToConstPointer) = kind + && let Value::Cast { kind: inner_kind, value: inner_value, from: inner_from, to: _ } = + *self.get(value) + && let PtrToPtr | PointerCoercion(MutToConstPointer) = inner_kind + { + from = inner_from; + value = inner_value; + *kind = PtrToPtr; + if inner_from == to { + return Some(inner_value); + } + if let Some(const_) = self.try_as_constant(value) { + *operand = Operand::Constant(Box::new(const_)); + } else if let Some(local) = self.try_as_local(value, location) { + *operand = Operand::Copy(local.into()); + self.reused_locals.insert(local); + } + } + + Some(self.insert(Value::Cast { kind: *kind, value, from, to })) + } + fn simplify_len(&mut self, place: &mut Place<'tcx>, location: Location) -> Option { // Trivial case: we are fetching a statically known length. let place_ty = place.ty(self.local_decls, self.tcx).ty; @@ -1171,6 +1259,132 @@ impl<'tcx> VnState<'_, 'tcx> { .find(|&&other| self.ssa.assignment_dominates(self.dominators, other, loc)) .copied() } + + fn reduce_debuginfo( + &mut self, + var_debug_info: &mut VarDebugInfo<'tcx>, + used_locals: &mut UsedLocals, + ) { + let mut simplify_place = |place: &mut Place<'tcx>| -> Option> { + // Another place that points to the same memory. + let mut place_ref = place.as_ref(); + let mut value = self.locals[place.local]?; + + // The position of the last deref projection. If there is one, the place preceding it + // can be treated and simplified as a value. Afterwards, projections need to be treated + // as a memory place. + let last_deref = place.projection.iter().rposition(|e| e == PlaceElem::Deref); + + for (index, proj) in place.projection.iter().enumerate() { + // We are before the last projection, so we can treat as a value. + if last_deref.map_or(false, |ld| index <= ld) + && let Some(candidates) = self.rev_locals.get(value) + // Do not introduce an unused local. + && let Some(&local) = candidates.iter().find(|&&l| used_locals.is_used(l)) + { + place_ref = PlaceRef { local, projection: &place.projection[index..] }; + } + + // We are at the last projection, treat as a value if possible. + if Some(index) == last_deref { + *place = place_ref.project_deeper(&[], self.tcx); + + // If the base local is used, do not bother trying to simplify anything. + if used_locals.is_used(place_ref.local) { + return None; + } + } + + let place_upto = + PlaceRef { local: place.local, projection: &place.projection[..index] }; + if let Some(projected) = self.project(place_upto, value, proj) { + value = projected; + } else { + if last_deref.map_or(false, |ld| index <= ld) + && place_ref.projection.len() < place.projection.len() + { + *place = place_ref.project_deeper(&[], self.tcx); + } + return None; + } + } + + if let Some(constant) = self.try_as_constant(value) { + return Some(constant); + } + + let mut projections = vec![]; + loop { + if let Some(candidates) = self.rev_locals.get(value) + // Do not reintroduce an unused local. + && let Some(&local) = candidates.iter().find(|&&l| used_locals.is_used(l)) + { + projections.reverse(); + *place = Place { + local, + projection: self.tcx.mk_place_elems_from_iter(projections.into_iter()), + }; + return None; + } + + match *self.get(value) { + Value::Projection(base, elem) => { + let elem = match elem { + ProjectionElem::Deref => ProjectionElem::Deref, + ProjectionElem::Downcast(name, read_variant) => { + ProjectionElem::Downcast(name, read_variant) + } + ProjectionElem::Field(f, ty) => ProjectionElem::Field(f, ty), + ProjectionElem::ConstantIndex { + offset, + min_length, + from_end: false, + } => ProjectionElem::ConstantIndex { + offset, + min_length, + from_end: false, + }, + // Not allowed in debuginfo. + _ => return None, + }; + projections.push(elem); + value = base; + } + Value::Address { place: target, kind: _, provenance: _ } + if projections.is_empty() + && target.projection.iter().all(|e| e.can_use_in_debuginfo()) => + { + var_debug_info + .composite + .get_or_insert_with(|| { + Box::new(VarDebugInfoFragment { + ty: self.local_decls[place.local].ty, + projection: Vec::new(), + }) + }) + .projection + .push(PlaceElem::Deref); + *place = target; + break; + } + _ => return None, + } + } + + return None; + }; + + match &mut var_debug_info.value { + VarDebugInfoContents::Const(_) => {} + VarDebugInfoContents::Place(place) => { + if let Some(constant) = simplify_place(place) { + var_debug_info.value = VarDebugInfoContents::Const(constant); + } else { + used_locals.use_count[place.local] += 1; + } + } + } + } } impl<'tcx> MutVisitor<'tcx> for VnState<'_, 'tcx> { diff --git a/compiler/rustc_mir_transform/src/instsimplify.rs b/compiler/rustc_mir_transform/src/instsimplify.rs index a28db0defc993..e35e09a181679 100644 --- a/compiler/rustc_mir_transform/src/instsimplify.rs +++ b/compiler/rustc_mir_transform/src/instsimplify.rs @@ -1,11 +1,12 @@ //! Performs various peephole optimizations. use crate::simplify::simplify_duplicate_switch_targets; +use rustc_hir::def::DefKind; use rustc_middle::mir::*; use rustc_middle::ty::layout::ValidityRequirement; use rustc_middle::ty::{self, GenericArgsRef, ParamEnv, Ty, TyCtxt}; use rustc_span::symbol::Symbol; -use rustc_target::abi::FieldIdx; +use rustc_target::abi::{FieldIdx, FIRST_VARIANT}; pub struct InstSimplify; @@ -38,6 +39,10 @@ impl<'tcx> MirPass<'tcx> for InstSimplify { block.terminator.as_mut().unwrap(), &mut block.statements, ); + ctx.simplify_constructor_calls( + &mut block.terminator.as_mut().unwrap(), + &mut block.statements, + ); simplify_duplicate_switch_targets(block.terminator.as_mut().unwrap()); } } @@ -287,6 +292,57 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> { } } } + + fn simplify_constructor_calls( + &self, + terminator: &mut Terminator<'tcx>, + statements: &mut Vec>, + ) { + let TerminatorKind::Call { func, target, destination, args, .. } = &mut terminator.kind + else { + return; + }; + let Some(target_block) = target else { + return; + }; + let func_ty = func.ty(self.local_decls, self.tcx); + let ty::FnDef(ctor_id, generics) = *func_ty.kind() else { + return; + }; + let DefKind::Ctor(..) = self.tcx.def_kind(ctor_id) else { + return; + }; + + let sig = self + .tcx + .fn_sig(ctor_id) + .instantiate(self.tcx, generics) + .no_bound_vars() + .expect("LBR in ADT constructor signature"); + let ty::Adt(adt_def, generics) = sig.output().kind() else { + bug!("unexpected type for ADT ctor {:?}", sig.output()); + }; + let variant_index = if adt_def.is_enum() { + adt_def.variant_index_with_ctor_id(ctor_id) + } else { + FIRST_VARIANT + }; + + let kind = AggregateKind::Adt(adt_def.did(), variant_index, generics, None, None); + + let args = std::mem::take(args); + let fields = args.into_iter().map(|n| n.node).collect(); + + let statement = Statement { + kind: StatementKind::Assign(Box::new(( + *destination, + Rvalue::Aggregate(Box::new(kind), fields), + ))), + source_info: terminator.source_info, + }; + statements.push(statement); + terminator.kind = TerminatorKind::Goto { target: *target_block }; + } } fn intrinsic_assert_panics<'tcx>( diff --git a/compiler/rustc_mir_transform/src/jump_threading.rs b/compiler/rustc_mir_transform/src/jump_threading.rs index dcab124505e27..fea6cc082611f 100644 --- a/compiler/rustc_mir_transform/src/jump_threading.rs +++ b/compiler/rustc_mir_transform/src/jump_threading.rs @@ -36,16 +36,21 @@ //! cost by `MAX_COST`. use rustc_arena::DroplessArena; +use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, Projectable}; use rustc_data_structures::fx::FxHashSet; use rustc_index::bit_set::BitSet; use rustc_index::IndexVec; +use rustc_middle::mir::interpret::Scalar; use rustc_middle::mir::visit::Visitor; use rustc_middle::mir::*; -use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt}; +use rustc_middle::ty::layout::LayoutOf; +use rustc_middle::ty::{self, ScalarInt, TyCtxt}; use rustc_mir_dataflow::value_analysis::{Map, PlaceIndex, State, TrackElem}; +use rustc_span::DUMMY_SP; use rustc_target::abi::{TagEncoding, Variants}; use crate::cost_checker::CostChecker; +use crate::dataflow_const_prop::DummyMachine; pub struct JumpThreading; @@ -55,7 +60,7 @@ const MAX_PLACES: usize = 100; impl<'tcx> MirPass<'tcx> for JumpThreading { fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - sess.mir_opt_level() >= 4 + sess.mir_opt_level() >= 2 } #[instrument(skip_all level = "debug")] @@ -71,6 +76,7 @@ impl<'tcx> MirPass<'tcx> for JumpThreading { let mut finder = TOFinder { tcx, param_env, + ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine), body, arena: &arena, map: &map, @@ -88,7 +94,7 @@ impl<'tcx> MirPass<'tcx> for JumpThreading { debug!(?discr, ?bb); let discr_ty = discr.ty(body, tcx).ty; - let Ok(discr_layout) = tcx.layout_of(param_env.and(discr_ty)) else { continue }; + let Ok(discr_layout) = finder.ecx.layout_of(discr_ty) else { continue }; let Some(discr) = finder.map.find(discr.as_ref()) else { continue }; debug!(?discr); @@ -142,6 +148,7 @@ struct ThreadingOpportunity { struct TOFinder<'tcx, 'a> { tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, + ecx: InterpCx<'tcx, 'tcx, DummyMachine>, body: &'a Body<'tcx>, map: &'a Map, loop_headers: &'a BitSet, @@ -329,11 +336,11 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { } #[instrument(level = "trace", skip(self))] - fn process_operand( + fn process_immediate( &mut self, bb: BasicBlock, lhs: PlaceIndex, - rhs: &Operand<'tcx>, + rhs: ImmTy<'tcx>, state: &mut State>, ) -> Option { let register_opportunity = |c: Condition| { @@ -341,13 +348,70 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { self.opportunities.push(ThreadingOpportunity { chain: vec![bb], target: c.target }) }; + let conditions = state.try_get_idx(lhs, self.map)?; + if let Immediate::Scalar(Scalar::Int(int)) = *rhs { + conditions.iter_matches(int).for_each(register_opportunity); + } + + None + } + + /// If we expect `lhs ?= A`, we have an opportunity if we assume `constant == A`. + #[instrument(level = "trace", skip(self))] + fn process_constant( + &mut self, + bb: BasicBlock, + lhs: PlaceIndex, + constant: OpTy<'tcx>, + state: &mut State>, + ) { + self.map.for_each_projection_value( + lhs, + constant, + &mut |elem, op| match elem { + TrackElem::Field(idx) => self.ecx.project_field(op, idx.as_usize()).ok(), + TrackElem::Variant(idx) => self.ecx.project_downcast(op, idx).ok(), + TrackElem::Discriminant => { + let variant = self.ecx.read_discriminant(op).ok()?; + let discr_value = + self.ecx.discriminant_for_variant(op.layout.ty, variant).ok()?; + Some(discr_value.into()) + } + TrackElem::DerefLen => { + let op: OpTy<'_> = self.ecx.deref_pointer(op).ok()?.into(); + let len_usize = op.len(&self.ecx).ok()?; + let layout = self.ecx.layout_of(self.tcx.types.usize).unwrap(); + Some(ImmTy::from_uint(len_usize, layout).into()) + } + }, + &mut |place, op| { + if let Some(conditions) = state.try_get_idx(place, self.map) + && let Ok(imm) = self.ecx.read_immediate_raw(op) + && let Some(imm) = imm.right() + && let Immediate::Scalar(Scalar::Int(int)) = *imm + { + conditions.iter_matches(int).for_each(|c: Condition| { + self.opportunities + .push(ThreadingOpportunity { chain: vec![bb], target: c.target }) + }) + } + }, + ); + } + + #[instrument(level = "trace", skip(self))] + fn process_operand( + &mut self, + bb: BasicBlock, + lhs: PlaceIndex, + rhs: &Operand<'tcx>, + state: &mut State>, + ) -> Option { match rhs { // If we expect `lhs ?= A`, we have an opportunity if we assume `constant == A`. Operand::Constant(constant) => { - let conditions = state.try_get_idx(lhs, self.map)?; - let constant = - constant.const_.normalize(self.tcx, self.param_env).try_to_scalar_int()?; - conditions.iter_matches(constant).for_each(register_opportunity); + let constant = self.ecx.eval_mir_constant(&constant.const_, None, None).ok()?; + self.process_constant(bb, lhs, constant, state); } // Transfer the conditions on the copied rhs. Operand::Move(rhs) | Operand::Copy(rhs) => { @@ -359,6 +423,84 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { None } + #[instrument(level = "trace", skip(self))] + fn process_assign( + &mut self, + bb: BasicBlock, + lhs_place: &Place<'tcx>, + rhs: &Rvalue<'tcx>, + state: &mut State>, + ) -> Option { + let lhs = self.map.find(lhs_place.as_ref())?; + match rhs { + Rvalue::Use(operand) => self.process_operand(bb, lhs, operand, state)?, + // Transfer the conditions on the copy rhs. + Rvalue::CopyForDeref(rhs) => { + self.process_operand(bb, lhs, &Operand::Copy(*rhs), state)? + } + Rvalue::Discriminant(rhs) => { + let rhs = self.map.find_discr(rhs.as_ref())?; + state.insert_place_idx(rhs, lhs, self.map); + } + // If we expect `lhs ?= A`, we have an opportunity if we assume `constant == A`. + Rvalue::Aggregate(box ref kind, ref operands) => { + let agg_ty = lhs_place.ty(self.body, self.tcx).ty; + let lhs = match kind { + // Do not support unions. + AggregateKind::Adt(.., Some(_)) => return None, + AggregateKind::Adt(_, variant_index, ..) if agg_ty.is_enum() => { + if let Some(discr_target) = self.map.apply(lhs, TrackElem::Discriminant) + && let Ok(discr_value) = + self.ecx.discriminant_for_variant(agg_ty, *variant_index) + { + self.process_immediate(bb, discr_target, discr_value, state); + } + self.map.apply(lhs, TrackElem::Variant(*variant_index))? + } + _ => lhs, + }; + for (field_index, operand) in operands.iter_enumerated() { + if let Some(field) = self.map.apply(lhs, TrackElem::Field(field_index)) { + self.process_operand(bb, field, operand, state); + } + } + } + // Transfer the conditions on the copy rhs, after inversing polarity. + Rvalue::UnaryOp(UnOp::Not, Operand::Move(place) | Operand::Copy(place)) => { + let conditions = state.try_get_idx(lhs, self.map)?; + let place = self.map.find(place.as_ref())?; + let conds = conditions.map(self.arena, Condition::inv); + state.insert_value_idx(place, conds, self.map); + } + // We expect `lhs ?= A`. We found `lhs = Eq(rhs, B)`. + // Create a condition on `rhs ?= B`. + Rvalue::BinaryOp( + op, + box (Operand::Move(place) | Operand::Copy(place), Operand::Constant(value)) + | box (Operand::Constant(value), Operand::Move(place) | Operand::Copy(place)), + ) => { + let conditions = state.try_get_idx(lhs, self.map)?; + let place = self.map.find(place.as_ref())?; + let equals = match op { + BinOp::Eq => ScalarInt::TRUE, + BinOp::Ne => ScalarInt::FALSE, + _ => return None, + }; + let value = value.const_.normalize(self.tcx, self.param_env).try_to_scalar_int()?; + let conds = conditions.map(self.arena, |c| Condition { + value, + polarity: if c.matches(equals) { Polarity::Eq } else { Polarity::Ne }, + ..c + }); + state.insert_value_idx(place, conds, self.map); + } + + _ => {} + } + + None + } + #[instrument(level = "trace", skip(self))] fn process_statement( &mut self, @@ -374,18 +516,6 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { // Below, `lhs` is the return value of `mutated_statement`, // the place to which `conditions` apply. - let discriminant_for_variant = |enum_ty: Ty<'tcx>, variant_index| { - let discr = enum_ty.discriminant_for_variant(self.tcx, variant_index)?; - let discr_layout = self.tcx.layout_of(self.param_env.and(discr.ty)).ok()?; - let scalar = ScalarInt::try_from_uint(discr.val, discr_layout.size)?; - Some(Operand::const_from_scalar( - self.tcx, - discr.ty, - scalar.into(), - rustc_span::DUMMY_SP, - )) - }; - match &stmt.kind { // If we expect `discriminant(place) ?= A`, // we have an opportunity if `variant_index ?= A`. @@ -395,7 +525,7 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { // `SetDiscriminant` may be a no-op if the assigned variant is the untagged variant // of a niche encoding. If we cannot ensure that we write to the discriminant, do // nothing. - let enum_layout = self.tcx.layout_of(self.param_env.and(enum_ty)).ok()?; + let enum_layout = self.ecx.layout_of(enum_ty).ok()?; let writes_discriminant = match enum_layout.variants { Variants::Single { index } => { assert_eq!(index, *variant_index); @@ -408,8 +538,8 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { } => *variant_index != untagged_variant, }; if writes_discriminant { - let discr = discriminant_for_variant(enum_ty, *variant_index)?; - self.process_operand(bb, discr_target, &discr, state)?; + let discr = self.ecx.discriminant_for_variant(enum_ty, *variant_index).ok()?; + self.process_immediate(bb, discr_target, discr, state)?; } } // If we expect `lhs ?= true`, we have an opportunity if we assume `lhs == true`. @@ -420,89 +550,7 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { conditions.iter_matches(ScalarInt::TRUE).for_each(register_opportunity); } StatementKind::Assign(box (lhs_place, rhs)) => { - if let Some(lhs) = self.map.find(lhs_place.as_ref()) { - match rhs { - Rvalue::Use(operand) => self.process_operand(bb, lhs, operand, state)?, - // Transfer the conditions on the copy rhs. - Rvalue::CopyForDeref(rhs) => { - self.process_operand(bb, lhs, &Operand::Copy(*rhs), state)? - } - Rvalue::Discriminant(rhs) => { - let rhs = self.map.find_discr(rhs.as_ref())?; - state.insert_place_idx(rhs, lhs, self.map); - } - // If we expect `lhs ?= A`, we have an opportunity if we assume `constant == A`. - Rvalue::Aggregate(box ref kind, ref operands) => { - let agg_ty = lhs_place.ty(self.body, self.tcx).ty; - let lhs = match kind { - // Do not support unions. - AggregateKind::Adt(.., Some(_)) => return None, - AggregateKind::Adt(_, variant_index, ..) if agg_ty.is_enum() => { - if let Some(discr_target) = - self.map.apply(lhs, TrackElem::Discriminant) - && let Some(discr_value) = - discriminant_for_variant(agg_ty, *variant_index) - { - self.process_operand(bb, discr_target, &discr_value, state); - } - self.map.apply(lhs, TrackElem::Variant(*variant_index))? - } - _ => lhs, - }; - for (field_index, operand) in operands.iter_enumerated() { - if let Some(field) = - self.map.apply(lhs, TrackElem::Field(field_index)) - { - self.process_operand(bb, field, operand, state); - } - } - } - // Transfer the conditions on the copy rhs, after inversing polarity. - Rvalue::UnaryOp(UnOp::Not, Operand::Move(place) | Operand::Copy(place)) => { - let conditions = state.try_get_idx(lhs, self.map)?; - let place = self.map.find(place.as_ref())?; - let conds = conditions.map(self.arena, Condition::inv); - state.insert_value_idx(place, conds, self.map); - } - // We expect `lhs ?= A`. We found `lhs = Eq(rhs, B)`. - // Create a condition on `rhs ?= B`. - Rvalue::BinaryOp( - op, - box ( - Operand::Move(place) | Operand::Copy(place), - Operand::Constant(value), - ) - | box ( - Operand::Constant(value), - Operand::Move(place) | Operand::Copy(place), - ), - ) => { - let conditions = state.try_get_idx(lhs, self.map)?; - let place = self.map.find(place.as_ref())?; - let equals = match op { - BinOp::Eq => ScalarInt::TRUE, - BinOp::Ne => ScalarInt::FALSE, - _ => return None, - }; - let value = value - .const_ - .normalize(self.tcx, self.param_env) - .try_to_scalar_int()?; - let conds = conditions.map(self.arena, |c| Condition { - value, - polarity: if c.matches(equals) { - Polarity::Eq - } else { - Polarity::Ne - }, - ..c - }); - state.insert_value_idx(place, conds, self.map); - } - - _ => {} - } - } + self.process_assign(bb, lhs_place, rhs, state)?; } _ => {} } @@ -577,7 +625,7 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { let discr = discr.place()?; let discr_ty = discr.ty(self.body, self.tcx).ty; - let discr_layout = self.tcx.layout_of(self.param_env.and(discr_ty)).ok()?; + let discr_layout = self.ecx.layout_of(discr_ty).ok()?; let conditions = state.try_get(discr.as_ref(), self.map)?; if let Some((value, _)) = targets.iter().find(|&(_, target)| target == target_bb) { diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 19bfed4333c03..8961179f4dd0d 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -61,7 +61,6 @@ mod remove_place_mention; mod add_subtyping_projections; pub mod cleanup_post_borrowck; mod const_debuginfo; -mod const_goto; mod const_prop; mod const_prop_lint; mod copy_prop; @@ -94,7 +93,6 @@ mod lower_slice_len; mod match_branches; mod multiple_return_terminators; mod normalize_array_len; -mod nrvo; mod prettify; mod promote_consts; mod ref_prop; @@ -105,7 +103,6 @@ mod remove_unneeded_drops; mod remove_zsts; mod required_consts; mod reveal_all; -mod separate_const_switch; mod shim; mod ssa; // This pass is public to allow external drivers to perform MIR cleanup @@ -569,7 +566,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &check_alignment::CheckAlignment, // Before inlining: trim down MIR with passes to reduce inlining work. - // Has to be done before inlining, otherwise actual call will be almost always inlined. + // has to be done before inlining, otherwise actual call will be almost always inlined. // Also simple, so can just do first &lower_slice_len::LowerSliceLenCalls, // Perform inlining, which may add a lot of code. @@ -586,36 +583,52 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { // Inlining may have introduced a lot of redundant code and a large move pattern. // Now, we need to shrink the generated MIR. - // Has to run after `slice::len` lowering - &normalize_array_len::NormalizeArrayLen, - &const_goto::ConstGoto, + // Replace deref of borrow with direct uses. &ref_prop::ReferencePropagation, - &sroa::ScalarReplacementOfAggregates, + // Remove dead stores to help SSA-based analyses. + &dead_store_elimination::DeadStoreElimination::Initial, + // Deduplicate computations. + &gvn::GVN::Initial, + // GVN may have moved constant assignments in terminators. + &simplify_branches::SimplifyConstCondition::AfterGVN, + // Use const-prop results in debuginfo, to remove some locals' uses. + &const_debuginfo::ConstDebugInfo, + // Replace `if x == constant { true/false } else { false/true }` by `Eq/Ne(x, constant)`. &match_branches::MatchBranchSimplification, // inst combine is after MatchBranchSimplification to clean up Ne(_1, false) - &multiple_return_terminators::MultipleReturnTerminators, &instsimplify::InstSimplify, + &o1(simplify::SimplifyCfg::AfterGVN), + // Turn non-aliasing places into locals. + // Helps `DeadStoreElimination` to remove them and `CopyProp` to merge them. + &simplify::SimplifyLocals::BeforeSROA, + &sroa::ScalarReplacementOfAggregates, + // Compute `Len` when it comes from an unsizing cast. + &normalize_array_len::NormalizeArrayLen, + // Perform a first round of constant propagation. &simplify::SimplifyLocals::BeforeConstProp, - &dead_store_elimination::DeadStoreElimination::Initial, - &gvn::GVN, - &simplify::SimplifyLocals::AfterGVN, - // Perform `SeparateConstSwitch` after SSA-based analyses, as cloning blocks may - // destroy the SSA property. It should still happen before const-propagation, so the - // latter pass will leverage the created opportunities. - &separate_const_switch::SeparateConstSwitch, - &dataflow_const_prop::DataflowConstProp, - &const_debuginfo::ConstDebugInfo, - &o1(simplify_branches::SimplifyConstCondition::AfterConstProp), - &jump_threading::JumpThreading, - &early_otherwise_branch::EarlyOtherwiseBranch, + // Turn `SwitchInt(Eq(x, constant))` into `SwitchInt(x)`. + // Runs after ConstProp to increase probability to have constants. &simplify_comparison_integral::SimplifyComparisonIntegral, - &dest_prop::DestinationPropagation, - &o1(simplify_branches::SimplifyConstCondition::Final), + &o1(simplify::SimplifyCfg::AfterConstProp), + &early_otherwise_branch::EarlyOtherwiseBranch, + // Merge locals that just copy each another. + ©_prop::CopyProp, + // Thread jumps when possible. Note that no SSA-based pass should happen + // post-jump-threading, as this pass clones blocks and demotes SSA locals. + &jump_threading::JumpThreading, + &dataflow_const_prop::DataflowConstProp, + &simplify_branches::SimplifyConstCondition::Final, + // Jump threading may have created dead stores, notably enums which discriminant we + // don't read any more. Remove them. + &dead_store_elimination::DeadStoreElimination::AfterJumpThreading, + // Jump threading may have created wrap-upwrap sequences in enums. Remove those. + &gvn::GVN::Final, &o1(remove_noop_landing_pads::RemoveNoopLandingPads), &o1(simplify::SimplifyCfg::Final), - ©_prop::CopyProp, + &simplify::SimplifyLocals::BeforeDestProp, + &dest_prop::DestinationPropagation, + // Attempt to promote call operands from copies to moves. &dead_store_elimination::DeadStoreElimination::Final, - &nrvo::RenameReturnPlace, &simplify::SimplifyLocals::Final, &multiple_return_terminators::MultipleReturnTerminators, &deduplicate_blocks::DeduplicateBlocks, diff --git a/compiler/rustc_mir_transform/src/nrvo.rs b/compiler/rustc_mir_transform/src/nrvo.rs deleted file mode 100644 index ff309bd10ec82..0000000000000 --- a/compiler/rustc_mir_transform/src/nrvo.rs +++ /dev/null @@ -1,237 +0,0 @@ -//! See the docs for [`RenameReturnPlace`]. - -use rustc_hir::Mutability; -use rustc_index::bit_set::HybridBitSet; -use rustc_middle::mir::visit::{MutVisitor, NonUseContext, PlaceContext, Visitor}; -use rustc_middle::mir::{self, BasicBlock, Local, Location}; -use rustc_middle::ty::TyCtxt; - -use crate::MirPass; - -/// This pass looks for MIR that always copies the same local into the return place and eliminates -/// the copy by renaming all uses of that local to `_0`. -/// -/// This allows LLVM to perform an optimization similar to the named return value optimization -/// (NRVO) that is guaranteed in C++. This avoids a stack allocation and `memcpy` for the -/// relatively common pattern of allocating a buffer on the stack, mutating it, and returning it by -/// value like so: -/// -/// ```rust -/// fn foo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { -/// let mut buf = [0; 1024]; -/// init(&mut buf); -/// buf -/// } -/// ``` -/// -/// For now, this pass is very simple and only capable of eliminating a single copy. A more general -/// version of copy propagation, such as the one based on non-overlapping live ranges in [#47954] and -/// [#71003], could yield even more benefits. -/// -/// [#47954]: https://github.com/rust-lang/rust/pull/47954 -/// [#71003]: https://github.com/rust-lang/rust/pull/71003 -pub struct RenameReturnPlace; - -impl<'tcx> MirPass<'tcx> for RenameReturnPlace { - fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - // unsound: #111005 - sess.mir_opt_level() > 0 && sess.opts.unstable_opts.unsound_mir_opts - } - - fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) { - let def_id = body.source.def_id(); - let Some(returned_local) = local_eligible_for_nrvo(body) else { - debug!("`{:?}` was ineligible for NRVO", def_id); - return; - }; - - if !tcx.consider_optimizing(|| format!("RenameReturnPlace {def_id:?}")) { - return; - } - - debug!( - "`{:?}` was eligible for NRVO, making {:?} the return place", - def_id, returned_local - ); - - RenameToReturnPlace { tcx, to_rename: returned_local }.visit_body_preserves_cfg(body); - - // Clean up the `NOP`s we inserted for statements made useless by our renaming. - for block_data in body.basic_blocks.as_mut_preserves_cfg() { - block_data.statements.retain(|stmt| stmt.kind != mir::StatementKind::Nop); - } - - // Overwrite the debuginfo of `_0` with that of the renamed local. - let (renamed_decl, ret_decl) = - body.local_decls.pick2_mut(returned_local, mir::RETURN_PLACE); - - // Sometimes, the return place is assigned a local of a different but coercible type, for - // example `&mut T` instead of `&T`. Overwriting the `LocalInfo` for the return place means - // its type may no longer match the return type of its function. This doesn't cause a - // problem in codegen because these two types are layout-compatible, but may be unexpected. - debug!("_0: {:?} = {:?}: {:?}", ret_decl.ty, returned_local, renamed_decl.ty); - ret_decl.clone_from(renamed_decl); - - // The return place is always mutable. - ret_decl.mutability = Mutability::Mut; - } -} - -/// MIR that is eligible for the NRVO must fulfill two conditions: -/// 1. The return place must not be read prior to the `Return` terminator. -/// 2. A simple assignment of a whole local to the return place (e.g., `_0 = _1`) must be the -/// only definition of the return place reaching the `Return` terminator. -/// -/// If the MIR fulfills both these conditions, this function returns the `Local` that is assigned -/// to the return place along all possible paths through the control-flow graph. -fn local_eligible_for_nrvo(body: &mut mir::Body<'_>) -> Option { - if IsReturnPlaceRead::run(body) { - return None; - } - - let mut copied_to_return_place = None; - for block in body.basic_blocks.indices() { - // Look for blocks with a `Return` terminator. - if !matches!(body[block].terminator().kind, mir::TerminatorKind::Return) { - continue; - } - - // Look for an assignment of a single local to the return place prior to the `Return`. - let returned_local = find_local_assigned_to_return_place(block, body)?; - match body.local_kind(returned_local) { - // FIXME: Can we do this for arguments as well? - mir::LocalKind::Arg => return None, - - mir::LocalKind::ReturnPointer => bug!("Return place was assigned to itself?"), - mir::LocalKind::Temp => {} - } - - // If multiple different locals are copied to the return place. We can't pick a - // single one to rename. - if copied_to_return_place.is_some_and(|old| old != returned_local) { - return None; - } - - copied_to_return_place = Some(returned_local); - } - - copied_to_return_place -} - -fn find_local_assigned_to_return_place( - start: BasicBlock, - body: &mut mir::Body<'_>, -) -> Option { - let mut block = start; - let mut seen = HybridBitSet::new_empty(body.basic_blocks.len()); - - // Iterate as long as `block` has exactly one predecessor that we have not yet visited. - while seen.insert(block) { - trace!("Looking for assignments to `_0` in {:?}", block); - - let local = body[block].statements.iter().rev().find_map(as_local_assigned_to_return_place); - if local.is_some() { - return local; - } - - match body.basic_blocks.predecessors()[block].as_slice() { - &[pred] => block = pred, - _ => return None, - } - } - - None -} - -// If this statement is an assignment of an unprojected local to the return place, -// return that local. -fn as_local_assigned_to_return_place(stmt: &mir::Statement<'_>) -> Option { - if let mir::StatementKind::Assign(box (lhs, rhs)) = &stmt.kind { - if lhs.as_local() == Some(mir::RETURN_PLACE) { - if let mir::Rvalue::Use(mir::Operand::Copy(rhs) | mir::Operand::Move(rhs)) = rhs { - return rhs.as_local(); - } - } - } - - None -} - -struct RenameToReturnPlace<'tcx> { - to_rename: Local, - tcx: TyCtxt<'tcx>, -} - -/// Replaces all uses of `self.to_rename` with `_0`. -impl<'tcx> MutVisitor<'tcx> for RenameToReturnPlace<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx> { - self.tcx - } - - fn visit_statement(&mut self, stmt: &mut mir::Statement<'tcx>, loc: Location) { - // Remove assignments of the local being replaced to the return place, since it is now the - // return place: - // _0 = _1 - if as_local_assigned_to_return_place(stmt) == Some(self.to_rename) { - stmt.kind = mir::StatementKind::Nop; - return; - } - - // Remove storage annotations for the local being replaced: - // StorageLive(_1) - if let mir::StatementKind::StorageLive(local) | mir::StatementKind::StorageDead(local) = - stmt.kind - { - if local == self.to_rename { - stmt.kind = mir::StatementKind::Nop; - return; - } - } - - self.super_statement(stmt, loc) - } - - fn visit_terminator(&mut self, terminator: &mut mir::Terminator<'tcx>, loc: Location) { - // Ignore the implicit "use" of the return place in a `Return` statement. - if let mir::TerminatorKind::Return = terminator.kind { - return; - } - - self.super_terminator(terminator, loc); - } - - fn visit_local(&mut self, l: &mut Local, ctxt: PlaceContext, _: Location) { - if *l == mir::RETURN_PLACE { - assert_eq!(ctxt, PlaceContext::NonUse(NonUseContext::VarDebugInfo)); - } else if *l == self.to_rename { - *l = mir::RETURN_PLACE; - } - } -} - -struct IsReturnPlaceRead(bool); - -impl IsReturnPlaceRead { - fn run(body: &mir::Body<'_>) -> bool { - let mut vis = IsReturnPlaceRead(false); - vis.visit_body(body); - vis.0 - } -} - -impl<'tcx> Visitor<'tcx> for IsReturnPlaceRead { - fn visit_local(&mut self, l: Local, ctxt: PlaceContext, _: Location) { - if l == mir::RETURN_PLACE && ctxt.is_use() && !ctxt.is_place_assignment() { - self.0 = true; - } - } - - fn visit_terminator(&mut self, terminator: &mir::Terminator<'tcx>, loc: Location) { - // Ignore the implicit "use" of the return place in a `Return` statement. - if let mir::TerminatorKind::Return = terminator.kind { - return; - } - - self.super_terminator(terminator, loc); - } -} diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs index 05a3ac3cc7558..8177e4f58328c 100644 --- a/compiler/rustc_mir_transform/src/ref_prop.rs +++ b/compiler/rustc_mir_transform/src/ref_prop.rs @@ -89,13 +89,20 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool { debug!(?replacer.allowed_replacements); debug!(?replacer.storage_to_remove); - replacer.visit_body_preserves_cfg(body); + replacer.local_decls = Some(&body.local_decls); + for debuginfo in body.var_debug_info.iter_mut() { + replacer.visit_var_debug_info(debuginfo); + } + for (bb, bbdata) in body.basic_blocks.as_mut_preserves_cfg().iter_enumerated_mut() { + replacer.visit_basic_block_data(bb, bbdata); + } if replacer.any_replacement { crate::simplify::remove_unused_definitions(body); + true + } else { + false } - - replacer.any_replacement } #[derive(Copy, Clone, Debug, PartialEq, Eq)] @@ -113,7 +120,7 @@ fn compute_replacement<'tcx>( tcx: TyCtxt<'tcx>, body: &Body<'tcx>, ssa: &SsaLocals, -) -> Replacer<'tcx> { +) -> Replacer<'tcx, 'tcx> { let always_live_locals = always_storage_live_locals(body); // Compute which locals have a single `StorageLive` statement ever. @@ -268,7 +275,9 @@ fn compute_replacement<'tcx>( targets, storage_to_remove, allowed_replacements, + fully_replacable_locals, any_replacement: false, + local_decls: None, }; struct ReplacementFinder<'a, 'tcx, F> { @@ -342,15 +351,17 @@ fn fully_replacable_locals(ssa: &SsaLocals) -> BitSet { } /// Utility to help performing subtitution of `*pattern` by `target`. -struct Replacer<'tcx> { +struct Replacer<'a, 'tcx> { tcx: TyCtxt<'tcx>, targets: IndexVec>, storage_to_remove: BitSet, allowed_replacements: FxHashSet<(Local, Location)>, any_replacement: bool, + fully_replacable_locals: BitSet, + local_decls: Option<&'a LocalDecls<'tcx>>, } -impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> { +impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> { fn tcx(&self) -> TyCtxt<'tcx> { self.tcx } @@ -367,6 +378,19 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> { if let Some((&PlaceElem::Deref, rest)) = target.projection.split_last() { *place = Place::from(target.local).project_deeper(rest, self.tcx); self.any_replacement = true; + } else if self.fully_replacable_locals.contains(place.local) { + debuginfo + .composite + .get_or_insert_with(|| { + Box::new(VarDebugInfoFragment { + ty: self.local_decls.unwrap()[place.local].ty, + projection: Vec::new(), + }) + }) + .projection + .push(PlaceElem::Deref); + *place = target; + self.any_replacement = true; } else { break; } diff --git a/compiler/rustc_mir_transform/src/separate_const_switch.rs b/compiler/rustc_mir_transform/src/separate_const_switch.rs deleted file mode 100644 index 7120ef7214271..0000000000000 --- a/compiler/rustc_mir_transform/src/separate_const_switch.rs +++ /dev/null @@ -1,343 +0,0 @@ -//! A pass that duplicates switch-terminated blocks -//! into a new copy for each predecessor, provided -//! the predecessor sets the value being switched -//! over to a constant. -//! -//! The purpose of this pass is to help constant -//! propagation passes to simplify the switch terminator -//! of the copied blocks into gotos when some predecessors -//! statically determine the output of switches. -//! -//! ```text -//! x = 12 --- ---> something -//! \ / 12 -//! --> switch x -//! / \ otherwise -//! x = y --- ---> something else -//! ``` -//! becomes -//! ```text -//! x = 12 ---> switch x ------> something -//! \ / 12 -//! X -//! / \ otherwise -//! x = y ---> switch x ------> something else -//! ``` -//! so it can hopefully later be turned by another pass into -//! ```text -//! x = 12 --------------------> something -//! / 12 -//! / -//! / otherwise -//! x = y ---- switch x ------> something else -//! ``` -//! -//! This optimization is meant to cover simple cases -//! like `?` desugaring. For now, it thus focuses on -//! simplicity rather than completeness (it notably -//! sometimes duplicates abusively). - -use rustc_middle::mir::*; -use rustc_middle::ty::TyCtxt; -use smallvec::SmallVec; - -pub struct SeparateConstSwitch; - -impl<'tcx> MirPass<'tcx> for SeparateConstSwitch { - fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - // This pass participates in some as-of-yet untested unsoundness found - // in https://github.com/rust-lang/rust/issues/112460 - sess.mir_opt_level() >= 2 && sess.opts.unstable_opts.unsound_mir_opts - } - - fn run_pass(&self, _: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - // If execution did something, applying a simplification layer - // helps later passes optimize the copy away. - if separate_const_switch(body) > 0 { - super::simplify::simplify_cfg(body); - } - } -} - -/// Returns the amount of blocks that were duplicated -pub fn separate_const_switch(body: &mut Body<'_>) -> usize { - let mut new_blocks: SmallVec<[(BasicBlock, BasicBlock); 6]> = SmallVec::new(); - let predecessors = body.basic_blocks.predecessors(); - 'block_iter: for (block_id, block) in body.basic_blocks.iter_enumerated() { - if let TerminatorKind::SwitchInt { - discr: Operand::Copy(switch_place) | Operand::Move(switch_place), - .. - } = block.terminator().kind - { - // If the block is on an unwind path, do not - // apply the optimization as unwind paths - // rely on a unique parent invariant - if block.is_cleanup { - continue 'block_iter; - } - - // If the block has fewer than 2 predecessors, ignore it - // we could maybe chain blocks that have exactly one - // predecessor, but for now we ignore that - if predecessors[block_id].len() < 2 { - continue 'block_iter; - } - - // First, let's find a non-const place - // that determines the result of the switch - if let Some(switch_place) = find_determining_place(switch_place, block) { - // We now have an input place for which it would - // be interesting if predecessors assigned it from a const - - let mut predecessors_left = predecessors[block_id].len(); - 'predec_iter: for predecessor_id in predecessors[block_id].iter().copied() { - let predecessor = &body.basic_blocks[predecessor_id]; - - // First we make sure the predecessor jumps - // in a reasonable way - match &predecessor.terminator().kind { - // The following terminators are - // unconditionally valid - TerminatorKind::Goto { .. } | TerminatorKind::SwitchInt { .. } => {} - - TerminatorKind::FalseEdge { real_target, .. } => { - if *real_target != block_id { - continue 'predec_iter; - } - } - - // The following terminators are not allowed - TerminatorKind::UnwindResume - | TerminatorKind::Drop { .. } - | TerminatorKind::Call { .. } - | TerminatorKind::Assert { .. } - | TerminatorKind::FalseUnwind { .. } - | TerminatorKind::Yield { .. } - | TerminatorKind::UnwindTerminate(_) - | TerminatorKind::Return - | TerminatorKind::Unreachable - | TerminatorKind::InlineAsm { .. } - | TerminatorKind::CoroutineDrop => { - continue 'predec_iter; - } - } - - if is_likely_const(switch_place, predecessor) { - new_blocks.push((predecessor_id, block_id)); - predecessors_left -= 1; - if predecessors_left < 2 { - // If the original block only has one predecessor left, - // we have nothing left to do - break 'predec_iter; - } - } - } - } - } - } - - // Once the analysis is done, perform the duplication - let body_span = body.span; - let copied_blocks = new_blocks.len(); - let blocks = body.basic_blocks_mut(); - for (pred_id, target_id) in new_blocks { - let new_block = blocks[target_id].clone(); - let new_block_id = blocks.push(new_block); - let terminator = blocks[pred_id].terminator_mut(); - - match terminator.kind { - TerminatorKind::Goto { ref mut target } => { - *target = new_block_id; - } - - TerminatorKind::FalseEdge { ref mut real_target, .. } => { - if *real_target == target_id { - *real_target = new_block_id; - } - } - - TerminatorKind::SwitchInt { ref mut targets, .. } => { - targets.all_targets_mut().iter_mut().for_each(|x| { - if *x == target_id { - *x = new_block_id; - } - }); - } - - TerminatorKind::UnwindResume - | TerminatorKind::UnwindTerminate(_) - | TerminatorKind::Return - | TerminatorKind::Unreachable - | TerminatorKind::CoroutineDrop - | TerminatorKind::Assert { .. } - | TerminatorKind::FalseUnwind { .. } - | TerminatorKind::Drop { .. } - | TerminatorKind::Call { .. } - | TerminatorKind::InlineAsm { .. } - | TerminatorKind::Yield { .. } => { - span_bug!( - body_span, - "basic block terminator had unexpected kind {:?}", - &terminator.kind - ) - } - } - } - - copied_blocks -} - -/// This function describes a rough heuristic guessing -/// whether a place is last set with a const within the block. -/// Notably, it will be overly pessimistic in cases that are already -/// not handled by `separate_const_switch`. -fn is_likely_const<'tcx>(mut tracked_place: Place<'tcx>, block: &BasicBlockData<'tcx>) -> bool { - for statement in block.statements.iter().rev() { - match &statement.kind { - StatementKind::Assign(assign) => { - if assign.0 == tracked_place { - match assign.1 { - // These rvalues are definitely constant - Rvalue::Use(Operand::Constant(_)) - | Rvalue::Ref(_, _, _) - | Rvalue::AddressOf(_, _) - | Rvalue::Cast(_, Operand::Constant(_), _) - | Rvalue::NullaryOp(_, _) - | Rvalue::ShallowInitBox(_, _) - | Rvalue::UnaryOp(_, Operand::Constant(_)) => return true, - - // These rvalues make things ambiguous - Rvalue::Repeat(_, _) - | Rvalue::ThreadLocalRef(_) - | Rvalue::Len(_) - | Rvalue::BinaryOp(_, _) - | Rvalue::CheckedBinaryOp(_, _) - | Rvalue::Aggregate(_, _) => return false, - - // These rvalues move the place to track - Rvalue::Cast(_, Operand::Copy(place) | Operand::Move(place), _) - | Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) - | Rvalue::CopyForDeref(place) - | Rvalue::UnaryOp(_, Operand::Copy(place) | Operand::Move(place)) - | Rvalue::Discriminant(place) => tracked_place = place, - } - } - } - - // If the discriminant is set, it is always set - // as a constant, so the job is done. - // As we are **ignoring projections**, if the place - // we are tracking sees its discriminant be set, - // that means we had to be tracking the discriminant - // specifically (as it is impossible to switch over - // an enum directly, and if we were switching over - // its content, we would have had to at least cast it to - // some variant first) - StatementKind::SetDiscriminant { place, .. } => { - if **place == tracked_place { - return true; - } - } - - // These statements have no influence on the place - // we are interested in - StatementKind::FakeRead(_) - | StatementKind::Deinit(_) - | StatementKind::StorageLive(_) - | StatementKind::Retag(_, _) - | StatementKind::AscribeUserType(_, _) - | StatementKind::PlaceMention(..) - | StatementKind::Coverage(_) - | StatementKind::StorageDead(_) - | StatementKind::Intrinsic(_) - | StatementKind::ConstEvalCounter - | StatementKind::Nop => {} - } - } - - // If no good reason for the place to be const is found, - // give up. We could maybe go up predecessors, but in - // most cases giving up now should be sufficient. - false -} - -/// Finds a unique place that entirely determines the value -/// of `switch_place`, if it exists. This is only a heuristic. -/// Ideally we would like to track multiple determining places -/// for some edge cases, but one is enough for a lot of situations. -fn find_determining_place<'tcx>( - mut switch_place: Place<'tcx>, - block: &BasicBlockData<'tcx>, -) -> Option> { - for statement in block.statements.iter().rev() { - match &statement.kind { - StatementKind::Assign(op) => { - if op.0 != switch_place { - continue; - } - - match op.1 { - // The following rvalues move the place - // that may be const in the predecessor - Rvalue::Use(Operand::Move(new) | Operand::Copy(new)) - | Rvalue::UnaryOp(_, Operand::Copy(new) | Operand::Move(new)) - | Rvalue::CopyForDeref(new) - | Rvalue::Cast(_, Operand::Move(new) | Operand::Copy(new), _) - | Rvalue::Repeat(Operand::Move(new) | Operand::Copy(new), _) - | Rvalue::Discriminant(new) - => switch_place = new, - - // The following rvalues might still make the block - // be valid but for now we reject them - Rvalue::Len(_) - | Rvalue::Ref(_, _, _) - | Rvalue::BinaryOp(_, _) - | Rvalue::CheckedBinaryOp(_, _) - | Rvalue::Aggregate(_, _) - - // The following rvalues definitely mean we cannot - // or should not apply this optimization - | Rvalue::Use(Operand::Constant(_)) - | Rvalue::Repeat(Operand::Constant(_), _) - | Rvalue::ThreadLocalRef(_) - | Rvalue::AddressOf(_, _) - | Rvalue::NullaryOp(_, _) - | Rvalue::ShallowInitBox(_, _) - | Rvalue::UnaryOp(_, Operand::Constant(_)) - | Rvalue::Cast(_, Operand::Constant(_), _) => return None, - } - } - - // These statements have no influence on the place - // we are interested in - StatementKind::FakeRead(_) - | StatementKind::Deinit(_) - | StatementKind::StorageLive(_) - | StatementKind::StorageDead(_) - | StatementKind::Retag(_, _) - | StatementKind::AscribeUserType(_, _) - | StatementKind::PlaceMention(..) - | StatementKind::Coverage(_) - | StatementKind::Intrinsic(_) - | StatementKind::ConstEvalCounter - | StatementKind::Nop => {} - - // If the discriminant is set, it is always set - // as a constant, so the job is already done. - // As we are **ignoring projections**, if the place - // we are tracking sees its discriminant be set, - // that means we had to be tracking the discriminant - // specifically (as it is impossible to switch over - // an enum directly, and if we were switching over - // its content, we would have had to at least cast it to - // some variant first) - StatementKind::SetDiscriminant { place, .. } => { - if **place == switch_place { - return None; - } - } - } - } - - Some(switch_place) -} diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs index 8c8818bd68e6f..69699ae9e9174 100644 --- a/compiler/rustc_mir_transform/src/simplify.rs +++ b/compiler/rustc_mir_transform/src/simplify.rs @@ -28,7 +28,9 @@ //! return. use rustc_index::{Idx, IndexSlice, IndexVec}; -use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor}; +use rustc_middle::mir::visit::{ + MutVisitor, MutatingUseContext, NonUseContext, PlaceContext, Visitor, +}; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; use smallvec::SmallVec; @@ -39,9 +41,12 @@ pub enum SimplifyCfg { RemoveFalseEdges, EarlyOpt, ElaborateDrops, + AfterGVN, + AfterConstProp, Final, MakeShim, AfterUninhabitedEnumBranching, + BeforeConstProp, } impl SimplifyCfg { @@ -52,11 +57,14 @@ impl SimplifyCfg { SimplifyCfg::RemoveFalseEdges => "SimplifyCfg-remove-false-edges", SimplifyCfg::EarlyOpt => "SimplifyCfg-early-opt", SimplifyCfg::ElaborateDrops => "SimplifyCfg-elaborate-drops", + SimplifyCfg::AfterGVN => "SimplifyCfg-after-gvn", + SimplifyCfg::AfterConstProp => "SimplifyCfg-after-const-prop", SimplifyCfg::Final => "SimplifyCfg-final", SimplifyCfg::MakeShim => "SimplifyCfg-make_shim", SimplifyCfg::AfterUninhabitedEnumBranching => { "SimplifyCfg-after-uninhabited-enum-branching" } + SimplifyCfg::BeforeConstProp => "SimplifyCfg-before-const-prop", } } } @@ -346,7 +354,9 @@ pub(crate) fn remove_dead_blocks(body: &mut Body<'_>) { } pub enum SimplifyLocals { + BeforeSROA, BeforeConstProp, + BeforeDestProp, AfterGVN, Final, } @@ -354,7 +364,9 @@ pub enum SimplifyLocals { impl<'tcx> MirPass<'tcx> for SimplifyLocals { fn name(&self) -> &'static str { match &self { + SimplifyLocals::BeforeSROA => "SimplifyLocals-before-sroa", SimplifyLocals::BeforeConstProp => "SimplifyLocals-before-const-prop", + SimplifyLocals::BeforeDestProp => "SimplifyLocals-before-dest-prop", SimplifyLocals::AfterGVN => "SimplifyLocals-after-value-numbering", SimplifyLocals::Final => "SimplifyLocals-final", } @@ -372,7 +384,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyLocals { pub fn remove_unused_definitions<'tcx>(body: &mut Body<'tcx>) { // First, we're going to get a count of *actual* uses for every `Local`. - let mut used_locals = UsedLocals::new(body); + let mut used_locals = UsedLocals::new(body, true); // Next, we're going to remove any `Local` with zero actual uses. When we remove those // `Locals`, we're also going to subtract any uses of other `Locals` from the `used_locals` @@ -384,7 +396,7 @@ pub fn remove_unused_definitions<'tcx>(body: &mut Body<'tcx>) { pub fn simplify_locals<'tcx>(body: &mut Body<'tcx>, tcx: TyCtxt<'tcx>) { // First, we're going to get a count of *actual* uses for every `Local`. - let mut used_locals = UsedLocals::new(body); + let mut used_locals = UsedLocals::new(body, true); // Next, we're going to remove any `Local` with zero actual uses. When we remove those // `Locals`, we're also going to subtract any uses of other `Locals` from the `used_locals` @@ -431,19 +443,21 @@ fn make_local_map( } /// Keeps track of used & unused locals. -struct UsedLocals { +pub(crate) struct UsedLocals { increment: bool, arg_count: u32, - use_count: IndexVec, + pub(crate) use_count: IndexVec, + with_debuginfo: bool, } impl UsedLocals { /// Determines which locals are used & unused in the given body. - fn new(body: &Body<'_>) -> Self { + pub(crate) fn new(body: &Body<'_>, with_debuginfo: bool) -> Self { let mut this = Self { increment: true, arg_count: body.arg_count.try_into().unwrap(), use_count: IndexVec::from_elem(0, &body.local_decls), + with_debuginfo, }; this.visit_body(body); this @@ -452,7 +466,7 @@ impl UsedLocals { /// Checks if local is used. /// /// Return place and arguments are always considered used. - fn is_used(&self, local: Local) -> bool { + pub(crate) fn is_used(&self, local: Local) -> bool { trace!("is_used({:?}): use_count: {:?}", local, self.use_count[local]); local.as_u32() <= self.arg_count || self.use_count[local] != 0 } @@ -516,7 +530,11 @@ impl<'tcx> Visitor<'tcx> for UsedLocals { } } - fn visit_local(&mut self, local: Local, _ctx: PlaceContext, _location: Location) { + fn visit_local(&mut self, local: Local, ctx: PlaceContext, _location: Location) { + if matches!(ctx, PlaceContext::NonUse(NonUseContext::VarDebugInfo)) && !self.with_debuginfo + { + return; + }; if self.increment { self.use_count[local] += 1; } else { diff --git a/compiler/rustc_mir_transform/src/simplify_branches.rs b/compiler/rustc_mir_transform/src/simplify_branches.rs index 35a052166bd93..07ef9e977a215 100644 --- a/compiler/rustc_mir_transform/src/simplify_branches.rs +++ b/compiler/rustc_mir_transform/src/simplify_branches.rs @@ -2,18 +2,25 @@ use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; pub enum SimplifyConstCondition { - AfterConstProp, + AfterGVN, Final, } /// A pass that replaces a branch with a goto when its condition is known. impl<'tcx> MirPass<'tcx> for SimplifyConstCondition { fn name(&self) -> &'static str { match self { - SimplifyConstCondition::AfterConstProp => "SimplifyConstCondition-after-const-prop", + SimplifyConstCondition::AfterGVN => "SimplifyConstCondition-after-gvn", SimplifyConstCondition::Final => "SimplifyConstCondition-final", } } + fn is_enabled(&self, sess: &rustc_session::Session) -> bool { + match self { + SimplifyConstCondition::Final => sess.mir_opt_level() >= 1, + SimplifyConstCondition::AfterGVN => sess.mir_opt_level() >= 2, + } + } + fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { trace!("Running SimplifyConstCondition on {:?}", body.source); let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); diff --git a/compiler/rustc_mir_transform/src/sroa.rs b/compiler/rustc_mir_transform/src/sroa.rs index 06d5e17fdd6c6..7fbf3f7cb6a33 100644 --- a/compiler/rustc_mir_transform/src/sroa.rs +++ b/compiler/rustc_mir_transform/src/sroa.rs @@ -93,6 +93,7 @@ fn escaping_locals<'tcx>( set.insert_range(RETURN_PLACE..=Local::from_usize(body.arg_count)); for (local, decl) in body.local_decls().iter_enumerated() { if excluded.contains(local) || is_excluded_ty(decl.ty) { + trace!(?local, "early exclusion"); set.insert(local); } } @@ -105,13 +106,17 @@ fn escaping_locals<'tcx>( } impl<'tcx> Visitor<'tcx> for EscapeVisitor { - fn visit_local(&mut self, local: Local, _: PlaceContext, _: Location) { - self.set.insert(local); + fn visit_local(&mut self, local: Local, _: PlaceContext, loc: Location) { + if self.set.insert(local) { + trace!(?local, "escapes at {loc:?}"); + } } fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) { // Mirror the implementation in PreFlattenVisitor. - if let &[PlaceElem::Field(..), ..] = &place.projection[..] { + if let &[PlaceElem::Field(..) | PlaceElem::ConstantIndex { from_end: false, .. }, ..] = + &place.projection[..] + { return; } self.super_place(place, context, location); @@ -126,7 +131,7 @@ fn escaping_locals<'tcx>( if lvalue.as_local().is_some() { match rvalue { // Aggregate assignments are expanded in run_pass. - Rvalue::Aggregate(..) | Rvalue::Use(..) => { + Rvalue::Repeat(..) | Rvalue::Aggregate(..) | Rvalue::Use(..) => { self.visit_rvalue(rvalue, location); return; } @@ -152,32 +157,62 @@ fn escaping_locals<'tcx>( } } +#[derive(Copy, Clone, Debug)] +enum LocalMode<'tcx> { + Field(Ty<'tcx>, Local), + Index(Local), +} + +impl<'tcx> LocalMode<'tcx> { + fn local(self) -> Local { + match self { + LocalMode::Field(_, l) | LocalMode::Index(l) => l, + } + } + + fn elem(self, field: FieldIdx) -> PlaceElem<'tcx> { + match self { + LocalMode::Field(ty, _) => PlaceElem::Field(field, ty), + LocalMode::Index(_) => PlaceElem::ConstantIndex { + offset: field.as_u32() as u64, + min_length: field.as_u32() as u64 + 1, + from_end: false, + }, + } + } +} + #[derive(Default, Debug)] struct ReplacementMap<'tcx> { /// Pre-computed list of all "new" locals for each "old" local. This is used to expand storage /// and deinit statement and debuginfo. - fragments: IndexVec, Local)>>>>, + fragments: IndexVec>>>>, } impl<'tcx> ReplacementMap<'tcx> { fn replace_place(&self, tcx: TyCtxt<'tcx>, place: PlaceRef<'tcx>) -> Option> { - let &[PlaceElem::Field(f, _), ref rest @ ..] = place.projection else { + let &[first, ref rest @ ..] = place.projection else { return None; }; + let f = match first { + PlaceElem::Field(f, _) => f, + PlaceElem::ConstantIndex { offset, .. } => FieldIdx::from_u32(offset.try_into().ok()?), + _ => return None, + }; let fields = self.fragments[place.local].as_ref()?; - let (_, new_local) = fields[f]?; + let new_local = fields[f]?.local(); Some(Place { local: new_local, projection: tcx.mk_place_elems(rest) }) } fn place_fragments( &self, place: Place<'tcx>, - ) -> Option, Local)> + '_> { + ) -> Option)> + '_> { let local = place.as_local()?; let fields = self.fragments[local].as_ref()?; - Some(fields.iter_enumerated().filter_map(|(field, &opt_ty_local)| { - let (ty, local) = opt_ty_local?; - Some((field, ty, local)) + Some(fields.iter_enumerated().filter_map(|(field, &local)| { + let local = local?; + Some((field, local)) })) } } @@ -200,15 +235,32 @@ fn compute_flattening<'tcx>( } let decl = body.local_decls[local].clone(); let ty = decl.ty; - iter_fields(ty, tcx, param_env, |variant, field, field_ty| { - if variant.is_some() { - // Downcasts are currently not supported. - return; - }; - let new_local = - body.local_decls.push(LocalDecl { ty: field_ty, user_ty: None, ..decl.clone() }); - fragments.get_or_insert_with(local, IndexVec::new).insert(field, (field_ty, new_local)); - }); + if let ty::Array(inner, count) = ty.kind() + && let Some(count) = count.try_eval_target_usize(tcx, param_env) + && count <= 64 + { + let fragments = fragments.get_or_insert_with(local, IndexVec::new); + for field in 0..(count as u32) { + let new_local = + body.local_decls.push(LocalDecl { ty: *inner, user_ty: None, ..decl.clone() }); + fragments.insert(FieldIdx::from_u32(field), LocalMode::Index(new_local)); + } + } else { + iter_fields(ty, tcx, param_env, |variant, field, field_ty| { + if variant.is_some() { + // Downcasts are currently not supported. + return; + }; + let new_local = body.local_decls.push(LocalDecl { + ty: field_ty, + user_ty: None, + ..decl.clone() + }); + fragments + .get_or_insert_with(local, IndexVec::new) + .insert(field, LocalMode::Field(field_ty, new_local)); + }); + } } ReplacementMap { fragments } } @@ -284,14 +336,16 @@ impl<'tcx> ReplacementVisitor<'tcx, '_> { let ty = place.ty(self.local_decls, self.tcx).ty; parts - .map(|(field, field_ty, replacement_local)| { + .map(|(field, replacement_local)| { let mut var_debug_info = var_debug_info.clone(); let composite = var_debug_info.composite.get_or_insert_with(|| { Box::new(VarDebugInfoFragment { ty, projection: Vec::new() }) }); - composite.projection.push(PlaceElem::Field(field, field_ty)); + let elem = replacement_local.elem(field); + composite.projection.push(elem); - var_debug_info.value = VarDebugInfoContents::Place(replacement_local.into()); + let local = replacement_local.local(); + var_debug_info.value = VarDebugInfoContents::Place(local.into()); var_debug_info }) .collect() @@ -318,7 +372,8 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> { // Duplicate storage and deinit statements, as they pretty much apply to all fields. StatementKind::StorageLive(l) => { if let Some(final_locals) = self.replacements.place_fragments(l.into()) { - for (_, _, fl) in final_locals { + for (_, fl) in final_locals { + let fl = fl.local(); self.patch.add_statement(location, StatementKind::StorageLive(fl)); } statement.make_nop(); @@ -327,7 +382,8 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> { } StatementKind::StorageDead(l) => { if let Some(final_locals) = self.replacements.place_fragments(l.into()) { - for (_, _, fl) in final_locals { + for (_, fl) in final_locals { + let fl = fl.local(); self.patch.add_statement(location, StatementKind::StorageDead(fl)); } statement.make_nop(); @@ -336,7 +392,8 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> { } StatementKind::Deinit(box place) => { if let Some(final_locals) = self.replacements.place_fragments(place) { - for (_, _, fl) in final_locals { + for (_, fl) in final_locals { + let fl = fl.local(); self.patch .add_statement(location, StatementKind::Deinit(Box::new(fl.into()))); } @@ -345,6 +402,35 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> { } } + // We have `a = [x; N]` + // We replace it by + // ``` + // a_0 = x + // a_1 = x + // ... + // ``` + StatementKind::Assign(box (place, Rvalue::Repeat(ref mut operand, _))) => { + if let Some(local) = place.as_local() + && let Some(final_locals) = &self.replacements.fragments[local] + { + // Replace mentions of SROA'd locals that appear in the operand. + self.visit_operand(&mut *operand, location); + + for &new_local in final_locals.iter() { + if let Some(new_local) = new_local { + let new_local = new_local.local(); + let rvalue = Rvalue::Use(operand.to_copy()); + self.patch.add_statement( + location, + StatementKind::Assign(Box::new((new_local.into(), rvalue))), + ); + } + } + statement.make_nop(); + return; + } + } + // We have `a = Struct { 0: x, 1: y, .. }`. // We replace it by // ``` @@ -358,8 +444,10 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> { { // This is ok as we delete the statement later. let operands = std::mem::take(operands); - for (&opt_ty_local, mut operand) in final_locals.iter().zip(operands) { - if let Some((_, new_local)) = opt_ty_local { + for (&new_local, mut operand) in final_locals.iter().zip(operands) { + if let Some(new_local) = new_local { + let new_local = new_local.local(); + // Replace mentions of SROA'd locals that appear in the operand. self.visit_operand(&mut operand, location); @@ -387,8 +475,10 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> { if let Some(final_locals) = self.replacements.place_fragments(place) { // Put the deaggregated statements *after* the original one. let location = location.successor_within_block(); - for (field, ty, new_local) in final_locals { - let rplace = self.tcx.mk_place_field(place, field, ty); + for (field, new_local) in final_locals { + let elem = new_local.elem(field); + let new_local = new_local.local(); + let rplace = self.tcx.mk_place_elem(place, elem); let rvalue = Rvalue::Use(Operand::Move(rplace)); self.patch.add_statement( location, @@ -414,8 +504,10 @@ impl<'tcx, 'll> MutVisitor<'tcx> for ReplacementVisitor<'tcx, 'll> { Operand::Constant(_) => bug!(), }; if let Some(final_locals) = self.replacements.place_fragments(lhs) { - for (field, ty, new_local) in final_locals { - let rplace = self.tcx.mk_place_field(rplace, field, ty); + for (field, new_local) in final_locals { + let elem = new_local.elem(field); + let new_local = new_local.local(); + let rplace = self.tcx.mk_place_elem(rplace, elem); debug!(?rplace); let rplace = self .replacements diff --git a/compiler/rustc_mir_transform/src/ssa.rs b/compiler/rustc_mir_transform/src/ssa.rs index 1ed3b14e75504..5459d29a82682 100644 --- a/compiler/rustc_mir_transform/src/ssa.rs +++ b/compiler/rustc_mir_transform/src/ssa.rs @@ -235,11 +235,7 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor<'tcx, '_> { // Anything can happen with raw pointers, so remove them. // We do not verify that all uses of the borrow dominate the assignment to `local`, // so we have to remove them too. - PlaceContext::NonMutatingUse( - NonMutatingUseContext::SharedBorrow - | NonMutatingUseContext::FakeBorrow - | NonMutatingUseContext::AddressOf, - ) + PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf) | PlaceContext::MutatingUse(_) => { self.assignments[local] = Set1::Many; } diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 427a9f3f49456..d523850b2819b 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -341,10 +341,13 @@ impl NonNull { /// ``` #[stable(feature = "nonnull", since = "1.25.0")] #[rustc_const_stable(feature = "const_nonnull_as_ptr", since = "1.32.0")] + #[rustc_allow_const_fn_unstable(const_ptr_is_null)] #[rustc_never_returns_null_ptr] #[must_use] #[inline(always)] pub const fn as_ptr(self) -> *mut T { + // SAFETY: By definition of this type. + unsafe { crate::intrinsics::assume(!self.pointer.is_null()) }; self.pointer as *mut T } diff --git a/tests/codegen/inline-hint.rs b/tests/codegen/inline-hint.rs index bb2a8e6a649d1..dff5a406b0b51 100644 --- a/tests/codegen/inline-hint.rs +++ b/tests/codegen/inline-hint.rs @@ -1,7 +1,7 @@ // Checks that closures, constructors, and shims except // for a drop glue receive inline hint by default. // -// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 -Zinline-mir=no +// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 -Zmir-opt-level=0 #![crate_type = "lib"] pub fn f() { diff --git a/tests/codegen/simd/simd-wide-sum.rs b/tests/codegen/simd/simd-wide-sum.rs index 109d538134388..6623d7ac04216 100644 --- a/tests/codegen/simd/simd-wide-sum.rs +++ b/tests/codegen/simd/simd-wide-sum.rs @@ -52,8 +52,8 @@ pub fn wider_reduce_iter(x: Simd) -> u16 { #[no_mangle] // CHECK-LABEL: @wider_reduce_into_iter pub fn wider_reduce_into_iter(x: Simd) -> u16 { - // FIXME: It would be nice if this was exactly the same as the above tests, - // but at the time of writing this comment, that didn't happen on LLVM main. - // CHECK: call i16 @llvm.vector.reduce.add + // CHECK: zext <16 x i8> + // CHECK-SAME: to <16 x i16> + // CHECK: call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> x.to_array().into_iter().map(u16::from).sum() } diff --git a/tests/codegen/slice-ref-equality.rs b/tests/codegen/slice-ref-equality.rs index afbdf66ce0aa8..4d0dce7b07437 100644 --- a/tests/codegen/slice-ref-equality.rs +++ b/tests/codegen/slice-ref-equality.rs @@ -44,48 +44,48 @@ pub fn is_zero_array(data: &[u8; 4]) -> bool { // equality for non-byte types also just emit a `bcmp`, not a loop. // CHECK-LABEL: @eq_slice_of_nested_u8( -// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1 -// CHECK-SAME: [[USIZE]] noundef %3 +// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %x.1 +// CHECK-SAME: [[USIZE]] noundef %y.1 #[no_mangle] fn eq_slice_of_nested_u8(x: &[[u8; 3]], y: &[[u8; 3]]) -> bool { - // CHECK: icmp eq [[USIZE]] %1, %3 - // CHECK: %[[BYTES:.+]] = mul nsw [[USIZE]] %1, 3 + // CHECK: icmp eq [[USIZE]] %x.1, %y.1 + // CHECK: %[[BYTES:.+]] = mul nsw [[USIZE]] %x.1, 3 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y } // CHECK-LABEL: @eq_slice_of_i32( -// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1 -// CHECK-SAME: [[USIZE]] noundef %3 +// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %x.1 +// CHECK-SAME: [[USIZE]] noundef %y.1 #[no_mangle] fn eq_slice_of_i32(x: &[i32], y: &[i32]) -> bool { - // CHECK: icmp eq [[USIZE]] %1, %3 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %1, 2 + // CHECK: icmp eq [[USIZE]] %x.1, %y.1 + // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %x.1, 2 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y } // CHECK-LABEL: @eq_slice_of_nonzero( -// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1 -// CHECK-SAME: [[USIZE]] noundef %3 +// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %x.1 +// CHECK-SAME: [[USIZE]] noundef %y.1 #[no_mangle] fn eq_slice_of_nonzero(x: &[NonZeroU32], y: &[NonZeroU32]) -> bool { - // CHECK: icmp eq [[USIZE]] %1, %3 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %1, 2 + // CHECK: icmp eq [[USIZE]] %x.1, %y.1 + // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %x.1, 2 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y } // CHECK-LABEL: @eq_slice_of_option_of_nonzero( -// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1 -// CHECK-SAME: [[USIZE]] noundef %3 +// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %x.1 +// CHECK-SAME: [[USIZE]] noundef %y.1 #[no_mangle] fn eq_slice_of_option_of_nonzero(x: &[Option], y: &[Option]) -> bool { - // CHECK: icmp eq [[USIZE]] %1, %3 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %1, 1 + // CHECK: icmp eq [[USIZE]] %x.1, %y.1 + // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %x.1, 1 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y diff --git a/tests/codegen/swap-large-types.rs b/tests/codegen/swap-large-types.rs index 7b6611f3da43f..dc5c3da3a4c37 100644 --- a/tests/codegen/swap-large-types.rs +++ b/tests/codegen/swap-large-types.rs @@ -16,7 +16,9 @@ type KeccakBuffer = [[u64; 5]; 5]; // CHECK-LABEL: @swap_basic #[no_mangle] pub fn swap_basic(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { -// CHECK: alloca [5 x [5 x i64]] +// CHECK-NOT: alloca [5 x [5 x i64]] +// CHECK: tail call void @llvm.memcpy +// CHECK-NOT: tail call void @llvm.memcpy // SAFETY: exclusive references are always valid to read/write, // are non-overlapping, and nothing here panics so it's drop-safe. diff --git a/tests/coverage/closure.cov-map b/tests/coverage/closure.cov-map index c5ac17600cd2a..e15b25327096c 100644 --- a/tests/coverage/closure.cov-map +++ b/tests/coverage/closure.cov-map @@ -33,20 +33,16 @@ Number of file 0 mappings: 24 - Code(Expression(1, Add)) at (prev + 1, 5) to (start + 3, 2) = (c1 + (c0 - c1)) -Function name: closure::main::{closure#0} -Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 27, 05, 02, 14, 05, 02, 15, 02, 0a, 02, 02, 0a, 00, 0b, 07, 01, 09, 01, 06] +Function name: closure::main::{closure#0} (unused) +Raw bytes (24): 0x[01, 01, 00, 04, 00, 27, 05, 02, 14, 00, 02, 15, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 01, 06] Number of files: 1 - file 0 => global file 1 -Number of expressions: 2 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub) +Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 39, 5) to (start + 2, 20) -- Code(Counter(1)) at (prev + 2, 21) to (start + 2, 10) -- Code(Expression(0, Sub)) at (prev + 2, 10) to (start + 0, 11) - = (c0 - c1) -- Code(Expression(1, Add)) at (prev + 1, 9) to (start + 1, 6) - = (c1 + (c0 - c1)) +- Code(Zero) at (prev + 39, 5) to (start + 2, 20) +- Code(Zero) at (prev + 2, 21) to (start + 2, 10) +- Code(Zero) at (prev + 2, 10) to (start + 0, 11) +- Code(Zero) at (prev + 1, 9) to (start + 1, 6) Function name: closure::main::{closure#10} (unused) Raw bytes (10): 0x[01, 01, 00, 01, 00, 9a, 01, 07, 00, 21] @@ -148,20 +144,16 @@ Number of file 0 mappings: 6 - Code(Expression(0, Add)) at (prev + 2, 9) to (start + 0, 10) = (c1 + (c0 - c1)) -Function name: closure::main::{closure#18} -Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 18, 0d, 02, 1c, 05, 02, 1d, 02, 12, 02, 02, 12, 00, 13, 07, 01, 11, 01, 0e] +Function name: closure::main::{closure#18} (unused) +Raw bytes (24): 0x[01, 01, 00, 04, 00, 18, 0d, 02, 1c, 00, 02, 1d, 02, 12, 00, 02, 12, 00, 13, 00, 01, 11, 01, 0e] Number of files: 1 - file 0 => global file 1 -Number of expressions: 2 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub) +Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 24, 13) to (start + 2, 28) -- Code(Counter(1)) at (prev + 2, 29) to (start + 2, 18) -- Code(Expression(0, Sub)) at (prev + 2, 18) to (start + 0, 19) - = (c0 - c1) -- Code(Expression(1, Add)) at (prev + 1, 17) to (start + 1, 14) - = (c1 + (c0 - c1)) +- Code(Zero) at (prev + 24, 13) to (start + 2, 28) +- Code(Zero) at (prev + 2, 29) to (start + 2, 18) +- Code(Zero) at (prev + 2, 18) to (start + 0, 19) +- Code(Zero) at (prev + 1, 17) to (start + 1, 14) Function name: closure::main::{closure#19} Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 42, 0d, 02, 1c, 05, 02, 1d, 02, 12, 02, 02, 12, 00, 13, 07, 01, 11, 01, 0e] diff --git a/tests/coverage/conditions.cov-map b/tests/coverage/conditions.cov-map index cfee55ed31a4a..a99c6e1737d7d 100644 --- a/tests/coverage/conditions.cov-map +++ b/tests/coverage/conditions.cov-map @@ -1,259 +1,100 @@ Function name: conditions::main -Raw bytes (784): 0x[01, 01, 8e, 01, 09, 33, 37, 41, 3b, 3d, 35, 39, 05, 00, b7, 04, 09, 05, 00, 0d, 35, 26, 39, 0d, 35, 3b, 3d, 35, 39, 37, 41, 3b, 3d, 35, 39, b2, 04, 0d, b7, 04, 09, 05, 00, 45, 00, 83, 01, 49, 45, 00, 7e, 31, 83, 01, 49, 45, 00, 7a, 4d, 7e, 31, 83, 01, 49, 45, 00, 76, 51, 7a, 4d, 7e, 31, 83, 01, 49, 45, 00, a7, 01, 55, 4d, 51, a3, 01, 59, a7, 01, 55, 4d, 51, 49, 9f, 01, a3, 01, 59, a7, 01, 55, 4d, 51, 61, 00, e3, 01, 65, 61, 00, de, 01, 2d, e3, 01, 65, 61, 00, da, 01, 69, de, 01, 2d, e3, 01, 65, 61, 00, d6, 01, 6d, da, 01, 69, de, 01, 2d, e3, 01, 65, 61, 00, 8b, 02, 71, 69, 6d, 87, 02, 75, 8b, 02, 71, 69, 6d, ff, 01, 00, 65, 83, 02, 87, 02, 75, 8b, 02, 71, 69, 6d, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 79, 00, d7, 02, 7d, 79, 00, d2, 02, 29, d7, 02, 7d, 79, 00, ce, 02, 81, 01, d2, 02, 29, d7, 02, 7d, 79, 00, ca, 02, 85, 01, ce, 02, 81, 01, d2, 02, 29, d7, 02, 7d, 79, 00, f3, 03, 89, 01, 81, 01, 85, 01, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 11, 93, 04, 97, 04, 21, 9b, 04, 1d, 15, 19, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, de, 03, 15, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, da, 03, 19, de, 03, 15, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 9b, 04, 1d, 15, 19, 97, 04, 21, 9b, 04, 1d, 15, 19, 8f, 04, 9f, 04, 11, 93, 04, 97, 04, 21, 9b, 04, 1d, 15, 19, a3, 04, ae, 04, a7, 04, 31, ab, 04, 2d, 25, 29, b2, 04, 0d, b7, 04, 09, 05, 00, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 06, 00, 07, 03, 03, 09, 00, 0a, b7, 04, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, b2, 04, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 26, 00, 1d, 00, 2a, 22, 00, 2e, 00, 3c, 37, 00, 3d, 02, 0a, 41, 02, 0a, 00, 0b, 33, 01, 09, 01, 12, ae, 04, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 45, 01, 0d, 02, 06, 00, 02, 06, 00, 07, 83, 01, 02, 08, 00, 15, 49, 00, 16, 02, 06, 7e, 02, 0f, 00, 1c, 7a, 01, 0c, 00, 19, 76, 00, 1d, 00, 2a, 72, 00, 2e, 00, 3c, a3, 01, 00, 3d, 02, 0a, 59, 02, 0a, 00, 0b, 9f, 01, 01, 09, 00, 17, 31, 02, 09, 00, 0f, 9b, 01, 03, 08, 00, 0c, 5d, 01, 0d, 01, 10, 61, 01, 11, 02, 0a, 00, 02, 0a, 00, 0b, e3, 01, 02, 0c, 00, 19, 65, 00, 1a, 02, 0a, de, 01, 03, 11, 00, 1e, da, 01, 01, 10, 00, 1d, d6, 01, 00, 21, 00, 2e, d2, 01, 00, 32, 00, 40, 87, 02, 00, 41, 02, 0e, 75, 02, 0e, 00, 0f, 83, 02, 01, 0d, 00, 1b, 2d, 02, 0d, 00, 13, 00, 02, 06, 00, 07, fb, 01, 02, 09, 01, 0c, 79, 01, 0d, 02, 06, 00, 02, 06, 00, 07, e7, 03, 02, 09, 00, 0a, d7, 02, 00, 10, 00, 1d, 7d, 00, 1e, 02, 06, d2, 02, 02, 0f, 00, 1c, ce, 02, 01, 0c, 00, 19, ca, 02, 00, 1d, 00, 2a, c6, 02, 00, 2e, 00, 3c, ef, 03, 00, 3d, 02, 0a, 8d, 01, 02, 0a, 00, 0b, eb, 03, 01, 09, 00, 17, 29, 02, 0d, 02, 0f, 8f, 04, 05, 09, 00, 0a, e7, 03, 00, 10, 00, 1d, 11, 00, 1e, 02, 06, e2, 03, 02, 0f, 00, 1c, de, 03, 01, 0c, 00, 19, da, 03, 00, 1d, 00, 2a, d6, 03, 00, 2e, 00, 3c, 97, 04, 00, 3d, 02, 0a, 21, 02, 0a, 00, 0b, 93, 04, 01, 09, 00, 17, 25, 02, 09, 00, 0f, 8b, 04, 02, 01, 00, 02] +Raw bytes (374): 0x[01, 01, 0f, 09, 00, 05, 00, 45, 00, 49, 00, 61, 00, 1b, 00, 65, 00, 79, 00, 27, 00, 79, 00, 00, 2f, 33, 00, 37, 00, 3b, 00, 00, 29, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 06, 00, 07, 03, 03, 09, 00, 0a, 07, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, 00, 02, 0f, 00, 1c, 00, 01, 0c, 00, 19, 00, 00, 1d, 00, 2a, 00, 00, 2e, 00, 3c, 00, 00, 3d, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 01, 12, 00, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 45, 01, 0d, 02, 06, 00, 02, 06, 00, 07, 0b, 02, 08, 00, 15, 49, 00, 16, 02, 06, 00, 02, 0f, 00, 1c, 00, 01, 0c, 00, 19, 00, 00, 1d, 00, 2a, 00, 00, 2e, 00, 3c, 00, 00, 3d, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 00, 17, 00, 02, 09, 00, 0f, 0f, 03, 08, 00, 0c, 5d, 01, 0d, 01, 10, 61, 01, 11, 02, 0a, 00, 02, 0a, 00, 0b, 13, 02, 0c, 00, 19, 65, 00, 1a, 02, 0a, 00, 03, 11, 00, 1e, 00, 01, 10, 00, 1d, 00, 00, 21, 00, 2e, 00, 00, 32, 00, 40, 00, 00, 41, 02, 0e, 00, 02, 0e, 00, 0f, 00, 01, 0d, 00, 1b, 00, 02, 0d, 00, 13, 00, 02, 06, 00, 07, 17, 02, 09, 01, 0c, 79, 01, 0d, 02, 06, 00, 02, 06, 00, 07, 00, 02, 09, 00, 0a, 27, 00, 10, 00, 1d, 00, 00, 1e, 02, 06, 22, 02, 0f, 00, 1c, 00, 01, 0c, 00, 19, 00, 00, 1d, 00, 2a, 00, 00, 2e, 00, 3c, 00, 00, 3d, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 00, 17, 29, 02, 0d, 02, 0f, 00, 05, 09, 00, 0a, 00, 00, 10, 00, 1d, 00, 00, 1e, 02, 06, 00, 02, 0f, 00, 1c, 00, 01, 0c, 00, 19, 00, 00, 1d, 00, 2a, 00, 00, 2e, 00, 3c, 00, 00, 3d, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 00, 17, 00, 02, 09, 00, 0f, 2b, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 142 -- expression 0 operands: lhs = Counter(2), rhs = Expression(12, Add) -- expression 1 operands: lhs = Expression(13, Add), rhs = Counter(16) -- expression 2 operands: lhs = Expression(14, Add), rhs = Counter(15) -- expression 3 operands: lhs = Counter(13), rhs = Counter(14) -- expression 4 operands: lhs = Counter(1), rhs = Zero -- expression 5 operands: lhs = Expression(141, Add), rhs = Counter(2) -- expression 6 operands: lhs = Counter(1), rhs = Zero -- expression 7 operands: lhs = Counter(3), rhs = Counter(13) -- expression 8 operands: lhs = Expression(9, Sub), rhs = Counter(14) -- expression 9 operands: lhs = Counter(3), rhs = Counter(13) -- expression 10 operands: lhs = Expression(14, Add), rhs = Counter(15) -- expression 11 operands: lhs = Counter(13), rhs = Counter(14) -- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(16) -- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(15) -- expression 14 operands: lhs = Counter(13), rhs = Counter(14) -- expression 15 operands: lhs = Expression(140, Sub), rhs = Counter(3) -- expression 16 operands: lhs = Expression(141, Add), rhs = Counter(2) -- expression 17 operands: lhs = Counter(1), rhs = Zero -- expression 18 operands: lhs = Counter(17), rhs = Zero -- expression 19 operands: lhs = Expression(32, Add), rhs = Counter(18) -- expression 20 operands: lhs = Counter(17), rhs = Zero -- expression 21 operands: lhs = Expression(31, Sub), rhs = Counter(12) -- expression 22 operands: lhs = Expression(32, Add), rhs = Counter(18) -- expression 23 operands: lhs = Counter(17), rhs = Zero -- expression 24 operands: lhs = Expression(30, Sub), rhs = Counter(19) -- expression 25 operands: lhs = Expression(31, Sub), rhs = Counter(12) -- expression 26 operands: lhs = Expression(32, Add), rhs = Counter(18) -- expression 27 operands: lhs = Counter(17), rhs = Zero -- expression 28 operands: lhs = Expression(29, Sub), rhs = Counter(20) -- expression 29 operands: lhs = Expression(30, Sub), rhs = Counter(19) -- expression 30 operands: lhs = Expression(31, Sub), rhs = Counter(12) -- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(18) -- expression 32 operands: lhs = Counter(17), rhs = Zero -- expression 33 operands: lhs = Expression(41, Add), rhs = Counter(21) -- expression 34 operands: lhs = Counter(19), rhs = Counter(20) -- expression 35 operands: lhs = Expression(40, Add), rhs = Counter(22) -- expression 36 operands: lhs = Expression(41, Add), rhs = Counter(21) -- expression 37 operands: lhs = Counter(19), rhs = Counter(20) -- expression 38 operands: lhs = Counter(18), rhs = Expression(39, Add) -- expression 39 operands: lhs = Expression(40, Add), rhs = Counter(22) -- expression 40 operands: lhs = Expression(41, Add), rhs = Counter(21) -- expression 41 operands: lhs = Counter(19), rhs = Counter(20) -- expression 42 operands: lhs = Counter(24), rhs = Zero -- expression 43 operands: lhs = Expression(56, Add), rhs = Counter(25) -- expression 44 operands: lhs = Counter(24), rhs = Zero -- expression 45 operands: lhs = Expression(55, Sub), rhs = Counter(11) -- expression 46 operands: lhs = Expression(56, Add), rhs = Counter(25) -- expression 47 operands: lhs = Counter(24), rhs = Zero -- expression 48 operands: lhs = Expression(54, Sub), rhs = Counter(26) -- expression 49 operands: lhs = Expression(55, Sub), rhs = Counter(11) -- expression 50 operands: lhs = Expression(56, Add), rhs = Counter(25) -- expression 51 operands: lhs = Counter(24), rhs = Zero -- expression 52 operands: lhs = Expression(53, Sub), rhs = Counter(27) -- expression 53 operands: lhs = Expression(54, Sub), rhs = Counter(26) -- expression 54 operands: lhs = Expression(55, Sub), rhs = Counter(11) -- expression 55 operands: lhs = Expression(56, Add), rhs = Counter(25) -- expression 56 operands: lhs = Counter(24), rhs = Zero -- expression 57 operands: lhs = Expression(66, Add), rhs = Counter(28) -- expression 58 operands: lhs = Counter(26), rhs = Counter(27) -- expression 59 operands: lhs = Expression(65, Add), rhs = Counter(29) -- expression 60 operands: lhs = Expression(66, Add), rhs = Counter(28) -- expression 61 operands: lhs = Counter(26), rhs = Counter(27) -- expression 62 operands: lhs = Expression(63, Add), rhs = Zero -- expression 63 operands: lhs = Counter(25), rhs = Expression(64, Add) -- expression 64 operands: lhs = Expression(65, Add), rhs = Counter(29) -- expression 65 operands: lhs = Expression(66, Add), rhs = Counter(28) -- expression 66 operands: lhs = Counter(26), rhs = Counter(27) -- expression 67 operands: lhs = Counter(31), rhs = Expression(122, Add) -- expression 68 operands: lhs = Expression(123, Add), rhs = Counter(35) -- expression 69 operands: lhs = Expression(124, Add), rhs = Counter(34) -- expression 70 operands: lhs = Counter(32), rhs = Counter(33) -- expression 71 operands: lhs = Counter(30), rhs = Zero -- expression 72 operands: lhs = Expression(85, Add), rhs = Counter(31) -- expression 73 operands: lhs = Counter(30), rhs = Zero -- expression 74 operands: lhs = Expression(84, Sub), rhs = Counter(10) -- expression 75 operands: lhs = Expression(85, Add), rhs = Counter(31) -- expression 76 operands: lhs = Counter(30), rhs = Zero -- expression 77 operands: lhs = Expression(83, Sub), rhs = Counter(32) -- expression 78 operands: lhs = Expression(84, Sub), rhs = Counter(10) -- expression 79 operands: lhs = Expression(85, Add), rhs = Counter(31) -- expression 80 operands: lhs = Counter(30), rhs = Zero -- expression 81 operands: lhs = Expression(82, Sub), rhs = Counter(33) -- expression 82 operands: lhs = Expression(83, Sub), rhs = Counter(32) -- expression 83 operands: lhs = Expression(84, Sub), rhs = Counter(10) -- expression 84 operands: lhs = Expression(85, Add), rhs = Counter(31) -- expression 85 operands: lhs = Counter(30), rhs = Zero -- expression 86 operands: lhs = Expression(124, Add), rhs = Counter(34) -- expression 87 operands: lhs = Counter(32), rhs = Counter(33) -- expression 88 operands: lhs = Expression(123, Add), rhs = Counter(35) -- expression 89 operands: lhs = Expression(124, Add), rhs = Counter(34) -- expression 90 operands: lhs = Counter(32), rhs = Counter(33) -- expression 91 operands: lhs = Counter(4), rhs = Expression(132, Add) -- expression 92 operands: lhs = Expression(133, Add), rhs = Counter(8) -- expression 93 operands: lhs = Expression(134, Add), rhs = Counter(7) -- expression 94 operands: lhs = Counter(5), rhs = Counter(6) -- expression 95 operands: lhs = Counter(31), rhs = Expression(122, Add) -- expression 96 operands: lhs = Expression(123, Add), rhs = Counter(35) -- expression 97 operands: lhs = Expression(124, Add), rhs = Counter(34) -- expression 98 operands: lhs = Counter(32), rhs = Counter(33) -- expression 99 operands: lhs = Expression(121, Add), rhs = Counter(4) -- expression 100 operands: lhs = Counter(31), rhs = Expression(122, Add) -- expression 101 operands: lhs = Expression(123, Add), rhs = Counter(35) -- expression 102 operands: lhs = Expression(124, Add), rhs = Counter(34) -- expression 103 operands: lhs = Counter(32), rhs = Counter(33) -- expression 104 operands: lhs = Expression(120, Sub), rhs = Counter(9) -- expression 105 operands: lhs = Expression(121, Add), rhs = Counter(4) -- expression 106 operands: lhs = Counter(31), rhs = Expression(122, Add) -- expression 107 operands: lhs = Expression(123, Add), rhs = Counter(35) -- expression 108 operands: lhs = Expression(124, Add), rhs = Counter(34) -- expression 109 operands: lhs = Counter(32), rhs = Counter(33) -- expression 110 operands: lhs = Expression(119, Sub), rhs = Counter(5) -- expression 111 operands: lhs = Expression(120, Sub), rhs = Counter(9) -- expression 112 operands: lhs = Expression(121, Add), rhs = Counter(4) -- expression 113 operands: lhs = Counter(31), rhs = Expression(122, Add) -- expression 114 operands: lhs = Expression(123, Add), rhs = Counter(35) -- expression 115 operands: lhs = Expression(124, Add), rhs = Counter(34) -- expression 116 operands: lhs = Counter(32), rhs = Counter(33) -- expression 117 operands: lhs = Expression(118, Sub), rhs = Counter(6) -- expression 118 operands: lhs = Expression(119, Sub), rhs = Counter(5) -- expression 119 operands: lhs = Expression(120, Sub), rhs = Counter(9) -- expression 120 operands: lhs = Expression(121, Add), rhs = Counter(4) -- expression 121 operands: lhs = Counter(31), rhs = Expression(122, Add) -- expression 122 operands: lhs = Expression(123, Add), rhs = Counter(35) -- expression 123 operands: lhs = Expression(124, Add), rhs = Counter(34) -- expression 124 operands: lhs = Counter(32), rhs = Counter(33) -- expression 125 operands: lhs = Expression(134, Add), rhs = Counter(7) -- expression 126 operands: lhs = Counter(5), rhs = Counter(6) -- expression 127 operands: lhs = Expression(133, Add), rhs = Counter(8) -- expression 128 operands: lhs = Expression(134, Add), rhs = Counter(7) -- expression 129 operands: lhs = Counter(5), rhs = Counter(6) -- expression 130 operands: lhs = Expression(131, Add), rhs = Expression(135, Add) -- expression 131 operands: lhs = Counter(4), rhs = Expression(132, Add) -- expression 132 operands: lhs = Expression(133, Add), rhs = Counter(8) -- expression 133 operands: lhs = Expression(134, Add), rhs = Counter(7) -- expression 134 operands: lhs = Counter(5), rhs = Counter(6) -- expression 135 operands: lhs = Expression(136, Add), rhs = Expression(139, Sub) -- expression 136 operands: lhs = Expression(137, Add), rhs = Counter(12) -- expression 137 operands: lhs = Expression(138, Add), rhs = Counter(11) -- expression 138 operands: lhs = Counter(9), rhs = Counter(10) -- expression 139 operands: lhs = Expression(140, Sub), rhs = Counter(3) -- expression 140 operands: lhs = Expression(141, Add), rhs = Counter(2) -- expression 141 operands: lhs = Counter(1), rhs = Zero +Number of expressions: 15 +- expression 0 operands: lhs = Counter(2), rhs = Zero +- expression 1 operands: lhs = Counter(1), rhs = Zero +- expression 2 operands: lhs = Counter(17), rhs = Zero +- expression 3 operands: lhs = Counter(18), rhs = Zero +- expression 4 operands: lhs = Counter(24), rhs = Zero +- expression 5 operands: lhs = Expression(6, Add), rhs = Zero +- expression 6 operands: lhs = Counter(25), rhs = Zero +- expression 7 operands: lhs = Counter(30), rhs = Zero +- expression 8 operands: lhs = Expression(9, Add), rhs = Zero +- expression 9 operands: lhs = Counter(30), rhs = Zero +- expression 10 operands: lhs = Zero, rhs = Expression(11, Add) +- expression 11 operands: lhs = Expression(12, Add), rhs = Zero +- expression 12 operands: lhs = Expression(13, Add), rhs = Zero +- expression 13 operands: lhs = Expression(14, Add), rhs = Zero +- expression 14 operands: lhs = Zero, rhs = Counter(10) Number of file 0 mappings: 68 - Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12) - Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 6) to (start + 0, 7) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10) - = (c2 + (((c13 + c14) + c15) + c16)) -- Code(Expression(141, Add)) at (prev + 0, 16) to (start + 0, 29) + = (c2 + Zero) +- Code(Expression(1, Add)) at (prev + 0, 16) to (start + 0, 29) = (c1 + Zero) - Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10) -- Code(Expression(140, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((c1 + Zero) - c2) -- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25) -- Code(Expression(9, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c3 - c13) -- Code(Expression(8, Sub)) at (prev + 0, 46) to (start + 0, 60) - = ((c3 - c13) - c14) -- Code(Expression(13, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c13 + c14) + c15) -- Code(Counter(16)) at (prev + 2, 10) to (start + 0, 11) -- Code(Expression(12, Add)) at (prev + 1, 9) to (start + 1, 18) - = (((c13 + c14) + c15) + c16) -- Code(Expression(139, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (((c1 + Zero) - c2) - c3) +- Code(Zero) at (prev + 2, 15) to (start + 0, 28) +- Code(Zero) at (prev + 1, 12) to (start + 0, 25) +- Code(Zero) at (prev + 0, 29) to (start + 0, 42) +- Code(Zero) at (prev + 0, 46) to (start + 0, 60) +- Code(Zero) at (prev + 0, 61) to (start + 2, 10) +- Code(Zero) at (prev + 2, 10) to (start + 0, 11) +- Code(Zero) at (prev + 1, 9) to (start + 1, 18) +- Code(Zero) at (prev + 3, 9) to (start + 0, 15) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 1, 12) - = (c2 + (((c13 + c14) + c15) + c16)) + = (c2 + Zero) - Code(Counter(17)) at (prev + 1, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 6) to (start + 0, 7) -- Code(Expression(32, Add)) at (prev + 2, 8) to (start + 0, 21) +- Code(Expression(2, Add)) at (prev + 2, 8) to (start + 0, 21) = (c17 + Zero) - Code(Counter(18)) at (prev + 0, 22) to (start + 2, 6) -- Code(Expression(31, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((c17 + Zero) - c18) -- Code(Expression(30, Sub)) at (prev + 1, 12) to (start + 0, 25) - = (((c17 + Zero) - c18) - c12) -- Code(Expression(29, Sub)) at (prev + 0, 29) to (start + 0, 42) - = ((((c17 + Zero) - c18) - c12) - c19) -- Code(Expression(28, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (((((c17 + Zero) - c18) - c12) - c19) - c20) -- Code(Expression(40, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c19 + c20) + c21) -- Code(Counter(22)) at (prev + 2, 10) to (start + 0, 11) -- Code(Expression(39, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c19 + c20) + c21) + c22) -- Code(Counter(12)) at (prev + 2, 9) to (start + 0, 15) -- Code(Expression(38, Add)) at (prev + 3, 8) to (start + 0, 12) - = (c18 + (((c19 + c20) + c21) + c22)) +- Code(Zero) at (prev + 2, 15) to (start + 0, 28) +- Code(Zero) at (prev + 1, 12) to (start + 0, 25) +- Code(Zero) at (prev + 0, 29) to (start + 0, 42) +- Code(Zero) at (prev + 0, 46) to (start + 0, 60) +- Code(Zero) at (prev + 0, 61) to (start + 2, 10) +- Code(Zero) at (prev + 2, 10) to (start + 0, 11) +- Code(Zero) at (prev + 1, 9) to (start + 0, 23) +- Code(Zero) at (prev + 2, 9) to (start + 0, 15) +- Code(Expression(3, Add)) at (prev + 3, 8) to (start + 0, 12) + = (c18 + Zero) - Code(Counter(23)) at (prev + 1, 13) to (start + 1, 16) - Code(Counter(24)) at (prev + 1, 17) to (start + 2, 10) - Code(Zero) at (prev + 2, 10) to (start + 0, 11) -- Code(Expression(56, Add)) at (prev + 2, 12) to (start + 0, 25) +- Code(Expression(4, Add)) at (prev + 2, 12) to (start + 0, 25) = (c24 + Zero) - Code(Counter(25)) at (prev + 0, 26) to (start + 2, 10) -- Code(Expression(55, Sub)) at (prev + 3, 17) to (start + 0, 30) - = ((c24 + Zero) - c25) -- Code(Expression(54, Sub)) at (prev + 1, 16) to (start + 0, 29) - = (((c24 + Zero) - c25) - c11) -- Code(Expression(53, Sub)) at (prev + 0, 33) to (start + 0, 46) - = ((((c24 + Zero) - c25) - c11) - c26) -- Code(Expression(52, Sub)) at (prev + 0, 50) to (start + 0, 64) - = (((((c24 + Zero) - c25) - c11) - c26) - c27) -- Code(Expression(65, Add)) at (prev + 0, 65) to (start + 2, 14) - = ((c26 + c27) + c28) -- Code(Counter(29)) at (prev + 2, 14) to (start + 0, 15) -- Code(Expression(64, Add)) at (prev + 1, 13) to (start + 0, 27) - = (((c26 + c27) + c28) + c29) -- Code(Counter(11)) at (prev + 2, 13) to (start + 0, 19) +- Code(Zero) at (prev + 3, 17) to (start + 0, 30) +- Code(Zero) at (prev + 1, 16) to (start + 0, 29) +- Code(Zero) at (prev + 0, 33) to (start + 0, 46) +- Code(Zero) at (prev + 0, 50) to (start + 0, 64) +- Code(Zero) at (prev + 0, 65) to (start + 2, 14) +- Code(Zero) at (prev + 2, 14) to (start + 0, 15) +- Code(Zero) at (prev + 1, 13) to (start + 0, 27) +- Code(Zero) at (prev + 2, 13) to (start + 0, 19) - Code(Zero) at (prev + 2, 6) to (start + 0, 7) -- Code(Expression(62, Add)) at (prev + 2, 9) to (start + 1, 12) - = ((c25 + (((c26 + c27) + c28) + c29)) + Zero) +- Code(Expression(5, Add)) at (prev + 2, 9) to (start + 1, 12) + = ((c25 + Zero) + Zero) - Code(Counter(30)) at (prev + 1, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 6) to (start + 0, 7) -- Code(Expression(121, Add)) at (prev + 2, 9) to (start + 0, 10) - = (c31 + (((c32 + c33) + c34) + c35)) -- Code(Expression(85, Add)) at (prev + 0, 16) to (start + 0, 29) +- Code(Zero) at (prev + 2, 9) to (start + 0, 10) +- Code(Expression(9, Add)) at (prev + 0, 16) to (start + 0, 29) = (c30 + Zero) -- Code(Counter(31)) at (prev + 0, 30) to (start + 2, 6) -- Code(Expression(84, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((c30 + Zero) - c31) -- Code(Expression(83, Sub)) at (prev + 1, 12) to (start + 0, 25) - = (((c30 + Zero) - c31) - c10) -- Code(Expression(82, Sub)) at (prev + 0, 29) to (start + 0, 42) - = ((((c30 + Zero) - c31) - c10) - c32) -- Code(Expression(81, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (((((c30 + Zero) - c31) - c10) - c32) - c33) -- Code(Expression(123, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c32 + c33) + c34) -- Code(Counter(35)) at (prev + 2, 10) to (start + 0, 11) -- Code(Expression(122, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c32 + c33) + c34) + c35) +- Code(Zero) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(8, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((c30 + Zero) - Zero) +- Code(Zero) at (prev + 1, 12) to (start + 0, 25) +- Code(Zero) at (prev + 0, 29) to (start + 0, 42) +- Code(Zero) at (prev + 0, 46) to (start + 0, 60) +- Code(Zero) at (prev + 0, 61) to (start + 2, 10) +- Code(Zero) at (prev + 2, 10) to (start + 0, 11) +- Code(Zero) at (prev + 1, 9) to (start + 0, 23) - Code(Counter(10)) at (prev + 2, 13) to (start + 2, 15) -- Code(Expression(131, Add)) at (prev + 5, 9) to (start + 0, 10) - = (c4 + (((c5 + c6) + c7) + c8)) -- Code(Expression(121, Add)) at (prev + 0, 16) to (start + 0, 29) - = (c31 + (((c32 + c33) + c34) + c35)) -- Code(Counter(4)) at (prev + 0, 30) to (start + 2, 6) -- Code(Expression(120, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((c31 + (((c32 + c33) + c34) + c35)) - c4) -- Code(Expression(119, Sub)) at (prev + 1, 12) to (start + 0, 25) - = (((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) -- Code(Expression(118, Sub)) at (prev + 0, 29) to (start + 0, 42) - = ((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5) -- Code(Expression(117, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5) - c6) -- Code(Expression(133, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c5 + c6) + c7) -- Code(Counter(8)) at (prev + 2, 10) to (start + 0, 11) -- Code(Expression(132, Add)) at (prev + 1, 9) to (start + 0, 23) - = (((c5 + c6) + c7) + c8) -- Code(Counter(9)) at (prev + 2, 9) to (start + 0, 15) -- Code(Expression(130, Add)) at (prev + 2, 1) to (start + 0, 2) - = ((c4 + (((c5 + c6) + c7) + c8)) + ((((c9 + c10) + c11) + c12) + (((c1 + Zero) - c2) - c3))) +- Code(Zero) at (prev + 5, 9) to (start + 0, 10) +- Code(Zero) at (prev + 0, 16) to (start + 0, 29) +- Code(Zero) at (prev + 0, 30) to (start + 2, 6) +- Code(Zero) at (prev + 2, 15) to (start + 0, 28) +- Code(Zero) at (prev + 1, 12) to (start + 0, 25) +- Code(Zero) at (prev + 0, 29) to (start + 0, 42) +- Code(Zero) at (prev + 0, 46) to (start + 0, 60) +- Code(Zero) at (prev + 0, 61) to (start + 2, 10) +- Code(Zero) at (prev + 2, 10) to (start + 0, 11) +- Code(Zero) at (prev + 1, 9) to (start + 0, 23) +- Code(Zero) at (prev + 2, 9) to (start + 0, 15) +- Code(Expression(10, Add)) at (prev + 2, 1) to (start + 0, 2) + = (Zero + ((((Zero + c10) + Zero) + Zero) + Zero)) diff --git a/tests/coverage/issue-83601.cov-map b/tests/coverage/issue-83601.cov-map index f5db3a89750c7..fa689c1892ad3 100644 --- a/tests/coverage/issue-83601.cov-map +++ b/tests/coverage/issue-83601.cov-map @@ -15,14 +15,14 @@ Number of file 0 mappings: 1 - Code(Counter(0)) at (prev + 3, 10) to (start + 0, 15) Function name: issue_83601::main -Raw bytes (21): 0x[01, 01, 01, 05, 09, 03, 01, 06, 01, 02, 1c, 05, 03, 09, 01, 1c, 02, 02, 05, 03, 02] +Raw bytes (21): 0x[01, 01, 01, 05, 00, 03, 01, 06, 01, 02, 1c, 05, 03, 09, 01, 1c, 02, 02, 05, 03, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 1 -- expression 0 operands: lhs = Counter(1), rhs = Counter(2) +- expression 0 operands: lhs = Counter(1), rhs = Zero Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 6, 1) to (start + 2, 28) - Code(Counter(1)) at (prev + 3, 9) to (start + 1, 28) - Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 3, 2) - = (c1 - c2) + = (c1 - Zero) diff --git a/tests/coverage/issue-84561.cov-map b/tests/coverage/issue-84561.cov-map index 82582b309bfcf..509f514ac4a66 100644 --- a/tests/coverage/issue-84561.cov-map +++ b/tests/coverage/issue-84561.cov-map @@ -85,22 +85,22 @@ Number of file 0 mappings: 1 - Code(Counter(0)) at (prev + 165, 9) to (start + 2, 10) Function name: issue_84561::test3 -Raw bytes (436): 0x[01, 01, 41, 05, 09, 0d, 00, 15, 19, 12, 00, 15, 19, 21, 00, 1e, 00, 21, 00, 31, 00, 3d, 41, 2e, 45, 3d, 41, 42, 49, 45, 00, 3f, 51, 42, 49, 45, 00, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 92, 01, 55, 51, 00, 8f, 01, 5d, 92, 01, 55, 51, 00, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 82, 01, 65, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, 71, fe, 01, 82, 02, 71, 69, 6d, 69, 6d, 82, 02, 71, 69, 6d, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, ee, 01, 00, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, 33, 01, 06, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 12, 02, 05, 00, 1f, 0e, 01, 05, 00, 0f, 00, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 00, 03, 20, 00, 30, 00, 00, 33, 00, 41, 00, 00, 4b, 00, 5a, 1e, 01, 05, 00, 0f, 00, 05, 09, 03, 10, 00, 05, 0d, 00, 1b, 00, 02, 0d, 00, 1c, 1a, 04, 09, 05, 06, 31, 06, 05, 03, 06, 22, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 2e, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 2a, 05, 09, 03, 0a, 3f, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 00, 03, 0d, 00, 1d, 3a, 03, 09, 00, 13, 00, 03, 0d, 00, 1d, 87, 01, 03, 05, 00, 0f, 8f, 01, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 8a, 01, 02, 0d, 00, 13, 82, 01, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 7e, 02, 0d, 00, 13, f3, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 75, 04, 0d, 00, 13, fb, 01, 02, 0d, 00, 17, 82, 02, 01, 14, 00, 1b, 71, 01, 15, 00, 1b, fe, 01, 02, 15, 00, 1b, f6, 01, 04, 0d, 00, 13, 7d, 03, 09, 00, 19, ee, 01, 02, 05, 00, 0f, ea, 01, 03, 09, 00, 22, 00, 02, 05, 00, 0f, 00, 03, 09, 00, 2c, 00, 02, 01, 00, 02] +Raw bytes (436): 0x[01, 01, 41, 05, 00, 0d, 00, 15, 00, 12, 00, 15, 00, 21, 00, 1e, 00, 21, 00, 31, 00, 3d, 00, 2e, 45, 3d, 00, 42, 49, 45, 00, 3f, 51, 42, 49, 45, 00, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 92, 01, 55, 51, 00, 8f, 01, 5d, 92, 01, 55, 51, 00, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 82, 01, 65, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 75, f6, 01, fb, 01, 79, 00, fe, 01, 82, 02, 00, 69, 6d, 00, fe, 01, 82, 02, 00, 69, 6d, 69, 6d, 82, 02, 00, 69, 6d, fb, 01, 79, 00, fe, 01, 82, 02, 00, 69, 6d, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 00, fe, 01, 82, 02, 00, 69, 6d, ee, 01, 00, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 00, fe, 01, 82, 02, 00, 69, 6d, 33, 01, 06, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 12, 02, 05, 00, 1f, 0e, 01, 05, 00, 0f, 00, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 00, 03, 20, 00, 30, 00, 00, 33, 00, 41, 00, 00, 4b, 00, 5a, 1e, 01, 05, 00, 0f, 00, 05, 09, 03, 10, 00, 05, 0d, 00, 1b, 00, 02, 0d, 00, 1c, 1a, 04, 09, 05, 06, 31, 06, 05, 03, 06, 22, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 2e, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 2a, 05, 09, 03, 0a, 3f, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 00, 03, 0d, 00, 1d, 3a, 03, 09, 00, 13, 00, 03, 0d, 00, 1d, 87, 01, 03, 05, 00, 0f, 8f, 01, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 8a, 01, 02, 0d, 00, 13, 82, 01, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 7e, 02, 0d, 00, 13, f3, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 75, 04, 0d, 00, 13, fb, 01, 02, 0d, 00, 17, 82, 02, 01, 14, 00, 1b, 00, 01, 15, 00, 1b, fe, 01, 02, 15, 00, 1b, f6, 01, 04, 0d, 00, 13, 7d, 03, 09, 00, 19, ee, 01, 02, 05, 00, 0f, ea, 01, 03, 09, 00, 22, 00, 02, 05, 00, 0f, 00, 03, 09, 00, 2c, 00, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 65 -- expression 0 operands: lhs = Counter(1), rhs = Counter(2) +- expression 0 operands: lhs = Counter(1), rhs = Zero - expression 1 operands: lhs = Counter(3), rhs = Zero -- expression 2 operands: lhs = Counter(5), rhs = Counter(6) +- expression 2 operands: lhs = Counter(5), rhs = Zero - expression 3 operands: lhs = Expression(4, Sub), rhs = Zero -- expression 4 operands: lhs = Counter(5), rhs = Counter(6) +- expression 4 operands: lhs = Counter(5), rhs = Zero - expression 5 operands: lhs = Counter(8), rhs = Zero - expression 6 operands: lhs = Expression(7, Sub), rhs = Zero - expression 7 operands: lhs = Counter(8), rhs = Zero - expression 8 operands: lhs = Counter(12), rhs = Zero -- expression 9 operands: lhs = Counter(15), rhs = Counter(16) +- expression 9 operands: lhs = Counter(15), rhs = Zero - expression 10 operands: lhs = Expression(11, Sub), rhs = Counter(17) -- expression 11 operands: lhs = Counter(15), rhs = Counter(16) +- expression 11 operands: lhs = Counter(15), rhs = Zero - expression 12 operands: lhs = Expression(16, Sub), rhs = Counter(18) - expression 13 operands: lhs = Counter(17), rhs = Zero - expression 14 operands: lhs = Expression(15, Add), rhs = Counter(20) @@ -128,45 +128,45 @@ Number of expressions: 65 - expression 36 operands: lhs = Counter(20), rhs = Zero - expression 37 operands: lhs = Counter(29), rhs = Expression(61, Sub) - expression 38 operands: lhs = Expression(62, Add), rhs = Counter(30) -- expression 39 operands: lhs = Counter(28), rhs = Expression(63, Sub) -- expression 40 operands: lhs = Expression(64, Sub), rhs = Counter(28) +- expression 39 operands: lhs = Zero, rhs = Expression(63, Sub) +- expression 40 operands: lhs = Expression(64, Sub), rhs = Zero - expression 41 operands: lhs = Counter(26), rhs = Counter(27) -- expression 42 operands: lhs = Counter(28), rhs = Expression(63, Sub) -- expression 43 operands: lhs = Expression(64, Sub), rhs = Counter(28) +- expression 42 operands: lhs = Zero, rhs = Expression(63, Sub) +- expression 43 operands: lhs = Expression(64, Sub), rhs = Zero - expression 44 operands: lhs = Counter(26), rhs = Counter(27) - expression 45 operands: lhs = Counter(26), rhs = Counter(27) -- expression 46 operands: lhs = Expression(64, Sub), rhs = Counter(28) +- expression 46 operands: lhs = Expression(64, Sub), rhs = Zero - expression 47 operands: lhs = Counter(26), rhs = Counter(27) - expression 48 operands: lhs = Expression(62, Add), rhs = Counter(30) -- expression 49 operands: lhs = Counter(28), rhs = Expression(63, Sub) -- expression 50 operands: lhs = Expression(64, Sub), rhs = Counter(28) +- expression 49 operands: lhs = Zero, rhs = Expression(63, Sub) +- expression 50 operands: lhs = Expression(64, Sub), rhs = Zero - expression 51 operands: lhs = Counter(26), rhs = Counter(27) - expression 52 operands: lhs = Expression(60, Add), rhs = Counter(31) - expression 53 operands: lhs = Counter(29), rhs = Expression(61, Sub) - expression 54 operands: lhs = Expression(62, Add), rhs = Counter(30) -- expression 55 operands: lhs = Counter(28), rhs = Expression(63, Sub) -- expression 56 operands: lhs = Expression(64, Sub), rhs = Counter(28) +- expression 55 operands: lhs = Zero, rhs = Expression(63, Sub) +- expression 56 operands: lhs = Expression(64, Sub), rhs = Zero - expression 57 operands: lhs = Counter(26), rhs = Counter(27) - expression 58 operands: lhs = Expression(59, Sub), rhs = Zero - expression 59 operands: lhs = Expression(60, Add), rhs = Counter(31) - expression 60 operands: lhs = Counter(29), rhs = Expression(61, Sub) - expression 61 operands: lhs = Expression(62, Add), rhs = Counter(30) -- expression 62 operands: lhs = Counter(28), rhs = Expression(63, Sub) -- expression 63 operands: lhs = Expression(64, Sub), rhs = Counter(28) +- expression 62 operands: lhs = Zero, rhs = Expression(63, Sub) +- expression 63 operands: lhs = Expression(64, Sub), rhs = Zero - expression 64 operands: lhs = Counter(26), rhs = Counter(27) Number of file 0 mappings: 51 - Code(Counter(0)) at (prev + 6, 1) to (start + 3, 28) - Code(Counter(1)) at (prev + 4, 9) to (start + 1, 28) - Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 4, 31) - = (c1 - c2) + = (c1 - Zero) - Code(Counter(3)) at (prev + 5, 5) to (start + 0, 31) - Code(Expression(1, Sub)) at (prev + 1, 5) to (start + 0, 31) = (c3 - Zero) - Code(Counter(5)) at (prev + 1, 9) to (start + 1, 28) - Code(Expression(4, Sub)) at (prev + 2, 5) to (start + 0, 31) - = (c5 - c6) + = (c5 - Zero) - Code(Expression(3, Sub)) at (prev + 1, 5) to (start + 0, 15) - = ((c5 - c6) - Zero) + = ((c5 - Zero) - Zero) - Code(Zero) at (prev + 0, 32) to (start + 0, 48) - Code(Counter(8)) at (prev + 1, 5) to (start + 3, 15) - Code(Zero) at (prev + 3, 32) to (start + 0, 48) @@ -184,10 +184,10 @@ Number of file 0 mappings: 51 = (c12 - Zero) - Code(Counter(15)) at (prev + 4, 9) to (start + 4, 6) - Code(Expression(11, Sub)) at (prev + 5, 8) to (start + 0, 15) - = (c15 - c16) + = (c15 - Zero) - Code(Counter(17)) at (prev + 1, 9) to (start + 3, 10) - Code(Expression(10, Sub)) at (prev + 5, 9) to (start + 3, 10) - = ((c15 - c16) - c17) + = ((c15 - Zero) - c17) - Code(Expression(15, Add)) at (prev + 5, 8) to (start + 0, 15) = ((c17 - Zero) + c18) - Code(Counter(20)) at (prev + 1, 9) to (start + 0, 19) @@ -208,24 +208,24 @@ Number of file 0 mappings: 51 - Code(Expression(31, Sub)) at (prev + 2, 13) to (start + 0, 19) = (((c23 + (((c20 - Zero) + c21) - c23)) - c24) - c25) - Code(Expression(60, Add)) at (prev + 3, 5) to (start + 0, 15) - = (c29 + ((c28 + ((c26 - c27) - c28)) - c30)) + = (c29 + ((Zero + ((c26 - c27) - Zero)) - c30)) - Code(Counter(26)) at (prev + 1, 12) to (start + 0, 19) - Code(Counter(27)) at (prev + 1, 13) to (start + 3, 14) - Code(Counter(29)) at (prev + 4, 13) to (start + 0, 19) - Code(Expression(62, Add)) at (prev + 2, 13) to (start + 0, 23) - = (c28 + ((c26 - c27) - c28)) + = (Zero + ((c26 - c27) - Zero)) - Code(Expression(64, Sub)) at (prev + 1, 20) to (start + 0, 27) = (c26 - c27) -- Code(Counter(28)) at (prev + 1, 21) to (start + 0, 27) +- Code(Zero) at (prev + 1, 21) to (start + 0, 27) - Code(Expression(63, Sub)) at (prev + 2, 21) to (start + 0, 27) - = ((c26 - c27) - c28) + = ((c26 - c27) - Zero) - Code(Expression(61, Sub)) at (prev + 4, 13) to (start + 0, 19) - = ((c28 + ((c26 - c27) - c28)) - c30) + = ((Zero + ((c26 - c27) - Zero)) - c30) - Code(Counter(31)) at (prev + 3, 9) to (start + 0, 25) - Code(Expression(59, Sub)) at (prev + 2, 5) to (start + 0, 15) - = ((c29 + ((c28 + ((c26 - c27) - c28)) - c30)) - c31) + = ((c29 + ((Zero + ((c26 - c27) - Zero)) - c30)) - c31) - Code(Expression(58, Sub)) at (prev + 3, 9) to (start + 0, 34) - = (((c29 + ((c28 + ((c26 - c27) - c28)) - c30)) - c31) - Zero) + = (((c29 + ((Zero + ((c26 - c27) - Zero)) - c30)) - c31) - Zero) - Code(Zero) at (prev + 2, 5) to (start + 0, 15) - Code(Zero) at (prev + 3, 9) to (start + 0, 44) - Code(Zero) at (prev + 2, 1) to (start + 0, 2) diff --git a/tests/coverage/match_or_pattern.cov-map b/tests/coverage/match_or_pattern.cov-map index d63407a99c35f..e3ec78f44232e 100644 --- a/tests/coverage/match_or_pattern.cov-map +++ b/tests/coverage/match_or_pattern.cov-map @@ -1,43 +1,43 @@ Function name: match_or_pattern::main -Raw bytes (202): 0x[01, 01, 23, 01, 05, 05, 02, 09, 0d, 2f, 11, 09, 0d, 2b, 15, 2f, 11, 09, 0d, 15, 26, 2b, 15, 2f, 11, 09, 0d, 19, 1d, 57, 21, 19, 1d, 53, 25, 57, 21, 19, 1d, 25, 4e, 53, 25, 57, 21, 19, 1d, 29, 2d, 7f, 31, 29, 2d, 7b, 35, 7f, 31, 29, 2d, 35, 76, 7b, 35, 7f, 31, 29, 2d, 39, 3d, 8b, 01, 41, 39, 3d, 19, 01, 01, 01, 08, 0f, 05, 08, 10, 03, 06, 02, 03, 06, 00, 07, 07, 01, 0b, 00, 11, 11, 03, 1b, 00, 1d, 2f, 01, 0e, 00, 10, 2b, 02, 08, 00, 0f, 15, 00, 10, 03, 06, 26, 03, 06, 00, 07, 23, 01, 0b, 00, 11, 21, 01, 1b, 00, 1d, 57, 01, 0e, 00, 10, 53, 02, 08, 00, 0f, 25, 00, 10, 03, 06, 4e, 03, 06, 00, 07, 4b, 01, 0b, 00, 11, 31, 01, 1b, 00, 1d, 7f, 01, 0e, 00, 10, 7b, 02, 08, 00, 0f, 35, 00, 10, 03, 06, 76, 03, 06, 00, 07, 73, 01, 0b, 00, 11, 41, 01, 1b, 00, 1d, 8b, 01, 01, 0e, 00, 10, 87, 01, 02, 01, 00, 02] +Raw bytes (202): 0x[01, 01, 23, 01, 05, 05, 02, 09, 0d, 2f, 00, 09, 0d, 2b, 15, 2f, 00, 09, 0d, 15, 26, 2b, 15, 2f, 00, 09, 0d, 00, 1d, 57, 00, 00, 1d, 53, 25, 57, 00, 00, 1d, 25, 4e, 53, 25, 57, 00, 00, 1d, 29, 2d, 7f, 00, 29, 2d, 7b, 35, 7f, 00, 29, 2d, 35, 76, 7b, 35, 7f, 00, 29, 2d, 00, 3d, 8b, 01, 41, 00, 3d, 19, 01, 01, 01, 08, 0f, 05, 08, 10, 03, 06, 02, 03, 06, 00, 07, 07, 01, 0b, 00, 11, 00, 03, 1b, 00, 1d, 2f, 01, 0e, 00, 10, 2b, 02, 08, 00, 0f, 15, 00, 10, 03, 06, 26, 03, 06, 00, 07, 23, 01, 0b, 00, 11, 00, 01, 1b, 00, 1d, 57, 01, 0e, 00, 10, 53, 02, 08, 00, 0f, 25, 00, 10, 03, 06, 4e, 03, 06, 00, 07, 4b, 01, 0b, 00, 11, 00, 01, 1b, 00, 1d, 7f, 01, 0e, 00, 10, 7b, 02, 08, 00, 0f, 35, 00, 10, 03, 06, 76, 03, 06, 00, 07, 73, 01, 0b, 00, 11, 41, 01, 1b, 00, 1d, 8b, 01, 01, 0e, 00, 10, 87, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 35 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) - expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub) - expression 2 operands: lhs = Counter(2), rhs = Counter(3) -- expression 3 operands: lhs = Expression(11, Add), rhs = Counter(4) +- expression 3 operands: lhs = Expression(11, Add), rhs = Zero - expression 4 operands: lhs = Counter(2), rhs = Counter(3) - expression 5 operands: lhs = Expression(10, Add), rhs = Counter(5) -- expression 6 operands: lhs = Expression(11, Add), rhs = Counter(4) +- expression 6 operands: lhs = Expression(11, Add), rhs = Zero - expression 7 operands: lhs = Counter(2), rhs = Counter(3) - expression 8 operands: lhs = Counter(5), rhs = Expression(9, Sub) - expression 9 operands: lhs = Expression(10, Add), rhs = Counter(5) -- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(4) +- expression 10 operands: lhs = Expression(11, Add), rhs = Zero - expression 11 operands: lhs = Counter(2), rhs = Counter(3) -- expression 12 operands: lhs = Counter(6), rhs = Counter(7) -- expression 13 operands: lhs = Expression(21, Add), rhs = Counter(8) -- expression 14 operands: lhs = Counter(6), rhs = Counter(7) +- expression 12 operands: lhs = Zero, rhs = Counter(7) +- expression 13 operands: lhs = Expression(21, Add), rhs = Zero +- expression 14 operands: lhs = Zero, rhs = Counter(7) - expression 15 operands: lhs = Expression(20, Add), rhs = Counter(9) -- expression 16 operands: lhs = Expression(21, Add), rhs = Counter(8) -- expression 17 operands: lhs = Counter(6), rhs = Counter(7) +- expression 16 operands: lhs = Expression(21, Add), rhs = Zero +- expression 17 operands: lhs = Zero, rhs = Counter(7) - expression 18 operands: lhs = Counter(9), rhs = Expression(19, Sub) - expression 19 operands: lhs = Expression(20, Add), rhs = Counter(9) -- expression 20 operands: lhs = Expression(21, Add), rhs = Counter(8) -- expression 21 operands: lhs = Counter(6), rhs = Counter(7) +- expression 20 operands: lhs = Expression(21, Add), rhs = Zero +- expression 21 operands: lhs = Zero, rhs = Counter(7) - expression 22 operands: lhs = Counter(10), rhs = Counter(11) -- expression 23 operands: lhs = Expression(31, Add), rhs = Counter(12) +- expression 23 operands: lhs = Expression(31, Add), rhs = Zero - expression 24 operands: lhs = Counter(10), rhs = Counter(11) - expression 25 operands: lhs = Expression(30, Add), rhs = Counter(13) -- expression 26 operands: lhs = Expression(31, Add), rhs = Counter(12) +- expression 26 operands: lhs = Expression(31, Add), rhs = Zero - expression 27 operands: lhs = Counter(10), rhs = Counter(11) - expression 28 operands: lhs = Counter(13), rhs = Expression(29, Sub) - expression 29 operands: lhs = Expression(30, Add), rhs = Counter(13) -- expression 30 operands: lhs = Expression(31, Add), rhs = Counter(12) +- expression 30 operands: lhs = Expression(31, Add), rhs = Zero - expression 31 operands: lhs = Counter(10), rhs = Counter(11) -- expression 32 operands: lhs = Counter(14), rhs = Counter(15) +- expression 32 operands: lhs = Zero, rhs = Counter(15) - expression 33 operands: lhs = Expression(34, Add), rhs = Counter(16) -- expression 34 operands: lhs = Counter(14), rhs = Counter(15) +- expression 34 operands: lhs = Zero, rhs = Counter(15) Number of file 0 mappings: 25 - Code(Counter(0)) at (prev + 1, 1) to (start + 8, 15) - Code(Counter(1)) at (prev + 8, 16) to (start + 3, 6) @@ -45,39 +45,39 @@ Number of file 0 mappings: 25 = (c0 - c1) - Code(Expression(1, Add)) at (prev + 1, 11) to (start + 0, 17) = (c1 + (c0 - c1)) -- Code(Counter(4)) at (prev + 3, 27) to (start + 0, 29) +- Code(Zero) at (prev + 3, 27) to (start + 0, 29) - Code(Expression(11, Add)) at (prev + 1, 14) to (start + 0, 16) = (c2 + c3) - Code(Expression(10, Add)) at (prev + 2, 8) to (start + 0, 15) - = ((c2 + c3) + c4) + = ((c2 + c3) + Zero) - Code(Counter(5)) at (prev + 0, 16) to (start + 3, 6) - Code(Expression(9, Sub)) at (prev + 3, 6) to (start + 0, 7) - = (((c2 + c3) + c4) - c5) + = (((c2 + c3) + Zero) - c5) - Code(Expression(8, Add)) at (prev + 1, 11) to (start + 0, 17) - = (c5 + (((c2 + c3) + c4) - c5)) -- Code(Counter(8)) at (prev + 1, 27) to (start + 0, 29) + = (c5 + (((c2 + c3) + Zero) - c5)) +- Code(Zero) at (prev + 1, 27) to (start + 0, 29) - Code(Expression(21, Add)) at (prev + 1, 14) to (start + 0, 16) - = (c6 + c7) + = (Zero + c7) - Code(Expression(20, Add)) at (prev + 2, 8) to (start + 0, 15) - = ((c6 + c7) + c8) + = ((Zero + c7) + Zero) - Code(Counter(9)) at (prev + 0, 16) to (start + 3, 6) - Code(Expression(19, Sub)) at (prev + 3, 6) to (start + 0, 7) - = (((c6 + c7) + c8) - c9) + = (((Zero + c7) + Zero) - c9) - Code(Expression(18, Add)) at (prev + 1, 11) to (start + 0, 17) - = (c9 + (((c6 + c7) + c8) - c9)) -- Code(Counter(12)) at (prev + 1, 27) to (start + 0, 29) + = (c9 + (((Zero + c7) + Zero) - c9)) +- Code(Zero) at (prev + 1, 27) to (start + 0, 29) - Code(Expression(31, Add)) at (prev + 1, 14) to (start + 0, 16) = (c10 + c11) - Code(Expression(30, Add)) at (prev + 2, 8) to (start + 0, 15) - = ((c10 + c11) + c12) + = ((c10 + c11) + Zero) - Code(Counter(13)) at (prev + 0, 16) to (start + 3, 6) - Code(Expression(29, Sub)) at (prev + 3, 6) to (start + 0, 7) - = (((c10 + c11) + c12) - c13) + = (((c10 + c11) + Zero) - c13) - Code(Expression(28, Add)) at (prev + 1, 11) to (start + 0, 17) - = (c13 + (((c10 + c11) + c12) - c13)) + = (c13 + (((c10 + c11) + Zero) - c13)) - Code(Counter(16)) at (prev + 1, 27) to (start + 0, 29) - Code(Expression(34, Add)) at (prev + 1, 14) to (start + 0, 16) - = (c14 + c15) + = (Zero + c15) - Code(Expression(33, Add)) at (prev + 2, 1) to (start + 0, 2) - = ((c14 + c15) + c16) + = ((Zero + c15) + c16) diff --git a/tests/coverage/partial_eq.cov-map b/tests/coverage/partial_eq.cov-map index 3a803e3c18fbd..200fa725c74a5 100644 --- a/tests/coverage/partial_eq.cov-map +++ b/tests/coverage/partial_eq.cov-map @@ -25,18 +25,17 @@ Number of file 0 mappings: 2 - Code(Zero) at (prev + 0, 32) to (start + 0, 33) Function name: ::partial_cmp -Raw bytes (22): 0x[01, 01, 04, 07, 0b, 00, 09, 0f, 15, 00, 11, 02, 01, 04, 27, 00, 28, 03, 00, 30, 00, 31] +Raw bytes (20): 0x[01, 01, 03, 00, 07, 0b, 00, 00, 11, 02, 01, 04, 27, 00, 28, 03, 00, 30, 00, 31] Number of files: 1 - file 0 => global file 1 -Number of expressions: 4 -- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add) -- expression 1 operands: lhs = Zero, rhs = Counter(2) -- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5) -- expression 3 operands: lhs = Zero, rhs = Counter(4) +Number of expressions: 3 +- expression 0 operands: lhs = Zero, rhs = Expression(1, Add) +- expression 1 operands: lhs = Expression(2, Add), rhs = Zero +- expression 2 operands: lhs = Zero, rhs = Counter(4) Number of file 0 mappings: 2 - Code(Counter(0)) at (prev + 4, 39) to (start + 0, 40) - Code(Expression(0, Add)) at (prev + 0, 48) to (start + 0, 49) - = ((Zero + c2) + ((Zero + c4) + c5)) + = (Zero + ((Zero + c4) + Zero)) Function name: ::fmt Raw bytes (9): 0x[01, 01, 00, 01, 01, 04, 11, 00, 16] diff --git a/tests/coverage/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map index a9a18a180dddf..17f3d0e67814b 100644 --- a/tests/coverage/try_error_result.cov-map +++ b/tests/coverage/try_error_result.cov-map @@ -59,162 +59,131 @@ Number of file 0 mappings: 4 = (c1 + (c0 - c1)) Function name: try_error_result::test1 -Raw bytes (77): 0x[01, 01, 09, 01, 07, 05, 09, 03, 0d, 1d, 11, 16, 1d, 03, 0d, 1f, 0d, 23, 19, 11, 15, 0b, 01, 0c, 01, 02, 17, 03, 07, 09, 00, 0e, 16, 02, 09, 04, 1a, 1d, 06, 0d, 00, 29, 11, 00, 29, 00, 2a, 0e, 01, 0d, 00, 2a, 15, 00, 2a, 00, 2b, 12, 04, 0d, 00, 2a, 19, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 1b, 01, 01, 00, 02] +Raw bytes (75): 0x[01, 01, 08, 01, 07, 00, 09, 03, 0d, 12, 1d, 03, 0d, 1b, 0d, 1f, 00, 11, 00, 0b, 01, 0c, 01, 02, 17, 03, 07, 09, 00, 0e, 12, 02, 09, 04, 1a, 1d, 06, 0d, 00, 29, 11, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 17, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 9 +Number of expressions: 8 - expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Zero, rhs = Counter(2) - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(7), rhs = Counter(4) -- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(7) -- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(3) -- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(6) -- expression 8 operands: lhs = Counter(4), rhs = Counter(5) +- expression 3 operands: lhs = Expression(4, Sub), rhs = Counter(7) +- expression 4 operands: lhs = Expression(0, Add), rhs = Counter(3) +- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(3) +- expression 6 operands: lhs = Expression(7, Add), rhs = Zero +- expression 7 operands: lhs = Counter(4), rhs = Zero Number of file 0 mappings: 11 - Code(Counter(0)) at (prev + 12, 1) to (start + 2, 23) - Code(Expression(0, Add)) at (prev + 7, 9) to (start + 0, 14) - = (c0 + (c1 + c2)) -- Code(Expression(5, Sub)) at (prev + 2, 9) to (start + 4, 26) - = ((c0 + (c1 + c2)) - c3) + = (c0 + (Zero + c2)) +- Code(Expression(4, Sub)) at (prev + 2, 9) to (start + 4, 26) + = ((c0 + (Zero + c2)) - c3) - Code(Counter(7)) at (prev + 6, 13) to (start + 0, 41) - Code(Counter(4)) at (prev + 0, 41) to (start + 0, 42) -- Code(Expression(3, Sub)) at (prev + 1, 13) to (start + 0, 42) - = (c7 - c4) -- Code(Counter(5)) at (prev + 0, 42) to (start + 0, 43) -- Code(Expression(4, Sub)) at (prev + 4, 13) to (start + 0, 42) - = (((c0 + (c1 + c2)) - c3) - c7) -- Code(Counter(6)) at (prev + 0, 42) to (start + 0, 43) +- Code(Zero) at (prev + 1, 13) to (start + 0, 42) +- Code(Zero) at (prev + 0, 42) to (start + 0, 43) +- Code(Expression(3, Sub)) at (prev + 4, 13) to (start + 0, 42) + = (((c0 + (Zero + c2)) - c3) - c7) +- Code(Zero) at (prev + 0, 42) to (start + 0, 43) - Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11) -- Code(Expression(6, Add)) at (prev + 1, 1) to (start + 0, 2) - = (((c4 + c5) + c6) + c3) +- Code(Expression(5, Add)) at (prev + 1, 1) to (start + 0, 2) + = (((c4 + Zero) + Zero) + c3) Function name: try_error_result::test2 -Raw bytes (358): 0x[01, 01, 3b, 01, 07, 05, 09, 03, 0d, 41, 11, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 4a, 15, 41, 11, 46, 19, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 5e, 25, 49, 21, 49, 21, 5e, 25, 49, 21, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, 92, 01, 41, 03, 0d, 8e, 01, 29, 92, 01, 41, 03, 0d, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, a6, 01, 35, 45, 31, 45, 31, a6, 01, 35, 45, 31, ba, 01, 3d, 4d, 39, 4d, 39, ba, 01, 3d, 4d, 39, c3, 01, 0d, c7, 01, db, 01, cb, 01, cf, 01, 11, 15, d3, 01, d7, 01, 19, 1d, 21, 25, df, 01, e3, 01, 29, 2d, e7, 01, eb, 01, 31, 35, 39, 3d, 28, 01, 3c, 01, 03, 17, 03, 08, 09, 00, 0e, 92, 01, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 4a, 00, 31, 03, 35, 15, 04, 11, 00, 12, 46, 02, 11, 04, 12, 3e, 05, 11, 00, 14, 46, 00, 17, 00, 41, 19, 00, 41, 00, 42, 42, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 3e, 01, 0d, 00, 20, 5a, 01, 11, 00, 14, 49, 00, 17, 00, 41, 21, 00, 41, 00, 42, 5e, 00, 43, 00, 60, 25, 00, 60, 00, 61, 5a, 01, 0d, 00, 20, 86, 01, 04, 11, 00, 14, 8e, 01, 00, 17, 00, 42, 29, 00, 42, 00, 43, 8a, 01, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 86, 01, 01, 0d, 00, 20, a2, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, a6, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 39, 02, 11, 00, 12, ba, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, bf, 01, 01, 01, 00, 02] +Raw bytes (280): 0x[01, 01, 24, 01, 07, 00, 09, 03, 0d, 41, 00, 1e, 00, 41, 00, 1e, 00, 41, 00, 4a, 00, 4e, 00, 52, 41, 03, 0d, 52, 41, 03, 0d, 4e, 00, 52, 41, 03, 0d, 4a, 00, 4e, 00, 52, 41, 03, 0d, 66, 00, 45, 00, 45, 00, 66, 00, 45, 00, 7a, 00, 4d, 00, 4d, 00, 7a, 00, 4d, 00, 83, 01, 0d, 87, 01, 00, 00, 8b, 01, 8f, 01, 00, 19, 00, 28, 01, 3c, 01, 03, 17, 03, 08, 09, 00, 0e, 52, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 00, 00, 2f, 00, 30, 1e, 00, 31, 03, 35, 00, 04, 11, 00, 12, 1a, 02, 11, 04, 12, 00, 05, 11, 00, 14, 1a, 00, 17, 00, 41, 19, 00, 41, 00, 42, 00, 00, 43, 00, 5f, 00, 00, 5f, 00, 60, 00, 01, 0d, 00, 20, 00, 01, 11, 00, 14, 00, 00, 17, 00, 41, 00, 00, 41, 00, 42, 00, 00, 43, 00, 60, 00, 00, 60, 00, 61, 00, 01, 0d, 00, 20, 46, 04, 11, 00, 14, 4e, 00, 17, 00, 42, 00, 00, 42, 00, 43, 4a, 00, 44, 00, 61, 00, 00, 61, 00, 62, 46, 01, 0d, 00, 20, 62, 01, 11, 00, 14, 45, 00, 17, 01, 36, 00, 01, 36, 00, 37, 66, 01, 12, 00, 2f, 00, 00, 2f, 00, 30, 62, 01, 0d, 00, 20, 76, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 00, 02, 11, 00, 12, 7a, 01, 12, 00, 2f, 00, 01, 11, 00, 12, 76, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, 7f, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 59 +Number of expressions: 36 - expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Zero, rhs = Counter(2) - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 3 operands: lhs = Counter(16), rhs = Counter(4) -- expression 4 operands: lhs = Expression(18, Sub), rhs = Counter(5) -- expression 5 operands: lhs = Counter(16), rhs = Counter(4) -- expression 6 operands: lhs = Expression(16, Sub), rhs = Counter(7) -- expression 7 operands: lhs = Expression(17, Sub), rhs = Counter(6) -- expression 8 operands: lhs = Expression(18, Sub), rhs = Counter(5) -- expression 9 operands: lhs = Counter(16), rhs = Counter(4) -- expression 10 operands: lhs = Expression(18, Sub), rhs = Counter(5) -- expression 11 operands: lhs = Counter(16), rhs = Counter(4) -- expression 12 operands: lhs = Expression(17, Sub), rhs = Counter(6) -- expression 13 operands: lhs = Expression(18, Sub), rhs = Counter(5) -- expression 14 operands: lhs = Counter(16), rhs = Counter(4) -- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(7) -- expression 16 operands: lhs = Expression(17, Sub), rhs = Counter(6) -- expression 17 operands: lhs = Expression(18, Sub), rhs = Counter(5) -- expression 18 operands: lhs = Counter(16), rhs = Counter(4) -- expression 19 operands: lhs = Expression(23, Sub), rhs = Counter(9) -- expression 20 operands: lhs = Counter(18), rhs = Counter(8) -- expression 21 operands: lhs = Counter(18), rhs = Counter(8) -- expression 22 operands: lhs = Expression(23, Sub), rhs = Counter(9) -- expression 23 operands: lhs = Counter(18), rhs = Counter(8) -- expression 24 operands: lhs = Expression(34, Sub), rhs = Counter(11) -- expression 25 operands: lhs = Expression(35, Sub), rhs = Counter(10) -- expression 26 operands: lhs = Expression(36, Sub), rhs = Counter(16) -- expression 27 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 28 operands: lhs = Expression(36, Sub), rhs = Counter(16) -- expression 29 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 30 operands: lhs = Expression(35, Sub), rhs = Counter(10) -- expression 31 operands: lhs = Expression(36, Sub), rhs = Counter(16) -- expression 32 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 33 operands: lhs = Expression(34, Sub), rhs = Counter(11) -- expression 34 operands: lhs = Expression(35, Sub), rhs = Counter(10) -- expression 35 operands: lhs = Expression(36, Sub), rhs = Counter(16) -- expression 36 operands: lhs = Expression(0, Add), rhs = Counter(3) -- expression 37 operands: lhs = Expression(41, Sub), rhs = Counter(13) -- expression 38 operands: lhs = Counter(17), rhs = Counter(12) -- expression 39 operands: lhs = Counter(17), rhs = Counter(12) -- expression 40 operands: lhs = Expression(41, Sub), rhs = Counter(13) -- expression 41 operands: lhs = Counter(17), rhs = Counter(12) -- expression 42 operands: lhs = Expression(46, Sub), rhs = Counter(15) -- expression 43 operands: lhs = Counter(19), rhs = Counter(14) -- expression 44 operands: lhs = Counter(19), rhs = Counter(14) -- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(15) -- expression 46 operands: lhs = Counter(19), rhs = Counter(14) -- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(3) -- expression 48 operands: lhs = Expression(49, Add), rhs = Expression(54, Add) -- expression 49 operands: lhs = Expression(50, Add), rhs = Expression(51, Add) -- expression 50 operands: lhs = Counter(4), rhs = Counter(5) -- expression 51 operands: lhs = Expression(52, Add), rhs = Expression(53, Add) -- expression 52 operands: lhs = Counter(6), rhs = Counter(7) -- expression 53 operands: lhs = Counter(8), rhs = Counter(9) -- expression 54 operands: lhs = Expression(55, Add), rhs = Expression(56, Add) -- expression 55 operands: lhs = Counter(10), rhs = Counter(11) -- expression 56 operands: lhs = Expression(57, Add), rhs = Expression(58, Add) -- expression 57 operands: lhs = Counter(12), rhs = Counter(13) -- expression 58 operands: lhs = Counter(14), rhs = Counter(15) +- expression 3 operands: lhs = Counter(16), rhs = Zero +- expression 4 operands: lhs = Expression(7, Sub), rhs = Zero +- expression 5 operands: lhs = Counter(16), rhs = Zero +- expression 6 operands: lhs = Expression(7, Sub), rhs = Zero +- expression 7 operands: lhs = Counter(16), rhs = Zero +- expression 8 operands: lhs = Expression(18, Sub), rhs = Zero +- expression 9 operands: lhs = Expression(19, Sub), rhs = Zero +- expression 10 operands: lhs = Expression(20, Sub), rhs = Counter(16) +- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(3) +- expression 12 operands: lhs = Expression(20, Sub), rhs = Counter(16) +- expression 13 operands: lhs = Expression(0, Add), rhs = Counter(3) +- expression 14 operands: lhs = Expression(19, Sub), rhs = Zero +- expression 15 operands: lhs = Expression(20, Sub), rhs = Counter(16) +- expression 16 operands: lhs = Expression(0, Add), rhs = Counter(3) +- expression 17 operands: lhs = Expression(18, Sub), rhs = Zero +- expression 18 operands: lhs = Expression(19, Sub), rhs = Zero +- expression 19 operands: lhs = Expression(20, Sub), rhs = Counter(16) +- expression 20 operands: lhs = Expression(0, Add), rhs = Counter(3) +- expression 21 operands: lhs = Expression(25, Sub), rhs = Zero +- expression 22 operands: lhs = Counter(17), rhs = Zero +- expression 23 operands: lhs = Counter(17), rhs = Zero +- expression 24 operands: lhs = Expression(25, Sub), rhs = Zero +- expression 25 operands: lhs = Counter(17), rhs = Zero +- expression 26 operands: lhs = Expression(30, Sub), rhs = Zero +- expression 27 operands: lhs = Counter(19), rhs = Zero +- expression 28 operands: lhs = Counter(19), rhs = Zero +- expression 29 operands: lhs = Expression(30, Sub), rhs = Zero +- expression 30 operands: lhs = Counter(19), rhs = Zero +- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(3) +- expression 32 operands: lhs = Expression(33, Add), rhs = Zero +- expression 33 operands: lhs = Zero, rhs = Expression(34, Add) +- expression 34 operands: lhs = Expression(35, Add), rhs = Zero +- expression 35 operands: lhs = Counter(6), rhs = Zero Number of file 0 mappings: 40 - Code(Counter(0)) at (prev + 60, 1) to (start + 3, 23) - Code(Expression(0, Add)) at (prev + 8, 9) to (start + 0, 14) - = (c0 + (c1 + c2)) -- Code(Expression(36, Sub)) at (prev + 2, 9) to (start + 4, 26) - = ((c0 + (c1 + c2)) - c3) + = (c0 + (Zero + c2)) +- Code(Expression(20, Sub)) at (prev + 2, 9) to (start + 4, 26) + = ((c0 + (Zero + c2)) - c3) - Code(Counter(16)) at (prev + 6, 13) to (start + 0, 47) -- Code(Counter(4)) at (prev + 0, 47) to (start + 0, 48) -- Code(Expression(18, Sub)) at (prev + 0, 49) to (start + 3, 53) - = (c16 - c4) -- Code(Counter(5)) at (prev + 4, 17) to (start + 0, 18) -- Code(Expression(17, Sub)) at (prev + 2, 17) to (start + 4, 18) - = ((c16 - c4) - c5) -- Code(Expression(15, Sub)) at (prev + 5, 17) to (start + 0, 20) - = ((((c16 - c4) - c5) - c6) - c7) -- Code(Expression(17, Sub)) at (prev + 0, 23) to (start + 0, 65) - = ((c16 - c4) - c5) +- Code(Zero) at (prev + 0, 47) to (start + 0, 48) +- Code(Expression(7, Sub)) at (prev + 0, 49) to (start + 3, 53) + = (c16 - Zero) +- Code(Zero) at (prev + 4, 17) to (start + 0, 18) +- Code(Expression(6, Sub)) at (prev + 2, 17) to (start + 4, 18) + = ((c16 - Zero) - Zero) +- Code(Zero) at (prev + 5, 17) to (start + 0, 20) +- Code(Expression(6, Sub)) at (prev + 0, 23) to (start + 0, 65) + = ((c16 - Zero) - Zero) - Code(Counter(6)) at (prev + 0, 65) to (start + 0, 66) -- Code(Expression(16, Sub)) at (prev + 0, 67) to (start + 0, 95) - = (((c16 - c4) - c5) - c6) -- Code(Counter(7)) at (prev + 0, 95) to (start + 0, 96) -- Code(Expression(15, Sub)) at (prev + 1, 13) to (start + 0, 32) - = ((((c16 - c4) - c5) - c6) - c7) -- Code(Expression(22, Sub)) at (prev + 1, 17) to (start + 0, 20) - = ((c18 - c8) - c9) -- Code(Counter(18)) at (prev + 0, 23) to (start + 0, 65) -- Code(Counter(8)) at (prev + 0, 65) to (start + 0, 66) -- Code(Expression(23, Sub)) at (prev + 0, 67) to (start + 0, 96) - = (c18 - c8) -- Code(Counter(9)) at (prev + 0, 96) to (start + 0, 97) -- Code(Expression(22, Sub)) at (prev + 1, 13) to (start + 0, 32) - = ((c18 - c8) - c9) -- Code(Expression(33, Sub)) at (prev + 4, 17) to (start + 0, 20) - = (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11) -- Code(Expression(35, Sub)) at (prev + 0, 23) to (start + 0, 66) - = (((c0 + (c1 + c2)) - c3) - c16) -- Code(Counter(10)) at (prev + 0, 66) to (start + 0, 67) -- Code(Expression(34, Sub)) at (prev + 0, 68) to (start + 0, 97) - = ((((c0 + (c1 + c2)) - c3) - c16) - c10) -- Code(Counter(11)) at (prev + 0, 97) to (start + 0, 98) -- Code(Expression(33, Sub)) at (prev + 1, 13) to (start + 0, 32) - = (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11) -- Code(Expression(40, Sub)) at (prev + 1, 17) to (start + 0, 20) - = ((c17 - c12) - c13) +- Code(Zero) at (prev + 0, 67) to (start + 0, 95) +- Code(Zero) at (prev + 0, 95) to (start + 0, 96) +- Code(Zero) at (prev + 1, 13) to (start + 0, 32) +- Code(Zero) at (prev + 1, 17) to (start + 0, 20) +- Code(Zero) at (prev + 0, 23) to (start + 0, 65) +- Code(Zero) at (prev + 0, 65) to (start + 0, 66) +- Code(Zero) at (prev + 0, 67) to (start + 0, 96) +- Code(Zero) at (prev + 0, 96) to (start + 0, 97) +- Code(Zero) at (prev + 1, 13) to (start + 0, 32) +- Code(Expression(17, Sub)) at (prev + 4, 17) to (start + 0, 20) + = (((((c0 + (Zero + c2)) - c3) - c16) - Zero) - Zero) +- Code(Expression(19, Sub)) at (prev + 0, 23) to (start + 0, 66) + = (((c0 + (Zero + c2)) - c3) - c16) +- Code(Zero) at (prev + 0, 66) to (start + 0, 67) +- Code(Expression(18, Sub)) at (prev + 0, 68) to (start + 0, 97) + = ((((c0 + (Zero + c2)) - c3) - c16) - Zero) +- Code(Zero) at (prev + 0, 97) to (start + 0, 98) +- Code(Expression(17, Sub)) at (prev + 1, 13) to (start + 0, 32) + = (((((c0 + (Zero + c2)) - c3) - c16) - Zero) - Zero) +- Code(Expression(24, Sub)) at (prev + 1, 17) to (start + 0, 20) + = ((c17 - Zero) - Zero) - Code(Counter(17)) at (prev + 0, 23) to (start + 1, 54) -- Code(Counter(12)) at (prev + 1, 54) to (start + 0, 55) -- Code(Expression(41, Sub)) at (prev + 1, 18) to (start + 0, 47) - = (c17 - c12) -- Code(Counter(13)) at (prev + 0, 47) to (start + 0, 48) -- Code(Expression(40, Sub)) at (prev + 1, 13) to (start + 0, 32) - = ((c17 - c12) - c13) -- Code(Expression(45, Sub)) at (prev + 1, 17) to (start + 0, 20) - = ((c19 - c14) - c15) +- Code(Zero) at (prev + 1, 54) to (start + 0, 55) +- Code(Expression(25, Sub)) at (prev + 1, 18) to (start + 0, 47) + = (c17 - Zero) +- Code(Zero) at (prev + 0, 47) to (start + 0, 48) +- Code(Expression(24, Sub)) at (prev + 1, 13) to (start + 0, 32) + = ((c17 - Zero) - Zero) +- Code(Expression(29, Sub)) at (prev + 1, 17) to (start + 0, 20) + = ((c19 - Zero) - Zero) - Code(Counter(19)) at (prev + 0, 23) to (start + 1, 54) -- Code(Counter(14)) at (prev + 2, 17) to (start + 0, 18) -- Code(Expression(46, Sub)) at (prev + 1, 18) to (start + 0, 47) - = (c19 - c14) -- Code(Counter(15)) at (prev + 1, 17) to (start + 0, 18) -- Code(Expression(45, Sub)) at (prev + 2, 13) to (start + 0, 32) - = ((c19 - c14) - c15) +- Code(Zero) at (prev + 2, 17) to (start + 0, 18) +- Code(Expression(30, Sub)) at (prev + 1, 18) to (start + 0, 47) + = (c19 - Zero) +- Code(Zero) at (prev + 1, 17) to (start + 0, 18) +- Code(Expression(29, Sub)) at (prev + 2, 13) to (start + 0, 32) + = ((c19 - Zero) - Zero) - Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11) -- Code(Expression(47, Add)) at (prev + 1, 1) to (start + 0, 2) - = ((((c4 + c5) + ((c6 + c7) + (c8 + c9))) + ((c10 + c11) + ((c12 + c13) + (c14 + c15)))) + c3) +- Code(Expression(31, Add)) at (prev + 1, 1) to (start + 0, 2) + = (((Zero + ((c6 + Zero) + Zero)) + Zero) + c3) diff --git a/tests/coverage/yield.cov-map b/tests/coverage/yield.cov-map index c9c9709fa4f30..9cc67dfe88ac4 100644 --- a/tests/coverage/yield.cov-map +++ b/tests/coverage/yield.cov-map @@ -1,9 +1,9 @@ Function name: yield::main -Raw bytes (106): 0x[01, 01, 0b, 05, 09, 0d, 11, 22, 15, 0d, 11, 11, 15, 22, 15, 0d, 11, 22, 15, 0d, 11, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 06, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 22, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 13, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 07, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02] +Raw bytes (106): 0x[01, 01, 0b, 05, 00, 0d, 11, 22, 15, 0d, 11, 11, 15, 22, 15, 0d, 11, 22, 15, 0d, 11, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 06, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 22, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 13, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 07, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 11 -- expression 0 operands: lhs = Counter(1), rhs = Counter(2) +- expression 0 operands: lhs = Counter(1), rhs = Zero - expression 1 operands: lhs = Counter(3), rhs = Counter(4) - expression 2 operands: lhs = Expression(8, Sub), rhs = Counter(5) - expression 3 operands: lhs = Counter(3), rhs = Counter(4) @@ -19,7 +19,7 @@ Number of file 0 mappings: 16 - Code(Counter(0)) at (prev + 6, 11) to (start + 0, 46) - Code(Counter(3)) at (prev + 1, 39) to (start + 0, 41) - Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 52) - = (c1 + c2) + = (c1 + Zero) - Code(Counter(3)) at (prev + 2, 11) to (start + 0, 46) - Code(Expression(8, Sub)) at (prev + 1, 34) to (start + 0, 39) = (c3 - c4) diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff index c1529dbee13cb..77ddec28bc6e9 100644 --- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff +++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff @@ -11,20 +11,16 @@ let mut _14: u32; let mut _15: u32; scope 1 { -- debug x => _1; -+ debug x => const 1_u8; + debug x => const 1_u8; let _2: u8; scope 2 { -- debug y => _2; -+ debug y => const 2_u8; + debug y => const 2_u8; let _3: u8; scope 3 { -- debug z => _3; -+ debug z => const 3_u8; + debug z => const 3_u8; let _4: u8; scope 4 { -- debug sum => _4; -+ debug sum => const 6_u8; + debug sum => const 6_u8; let _9: &str; scope 5 { - debug s => _9; @@ -34,16 +30,13 @@ debug f => _10; let _11: std::option::Option; scope 7 { -- debug o => _11; -+ debug o => const Option::::Some(99_u16); + debug o => const Option::::Some(99_u16); let _12: Point; scope 8 { -- debug p => _12; -+ debug p => const Point {{ x: 32_u32, y: 32_u32 }}; + debug p => const Point {{ x: 32_u32, y: 32_u32 }}; let _13: u32; scope 9 { -- debug a => _13; -+ debug a => const 64_u32; + debug a => const 64_u32; } } } diff --git a/tests/mir-opt/const_debuginfo.rs b/tests/mir-opt/const_debuginfo.rs index db0c5dbb28fad..9a4f6238707c5 100644 --- a/tests/mir-opt/const_debuginfo.rs +++ b/tests/mir-opt/const_debuginfo.rs @@ -1,5 +1,5 @@ // unit-test: ConstDebugInfo -// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN +// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN -g struct Point { x: u32, diff --git a/tests/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff b/tests/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff deleted file mode 100644 index 43bdb431129e6..0000000000000 --- a/tests/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff +++ /dev/null @@ -1,50 +0,0 @@ -- // MIR for `issue_77355_opt` before ConstGoto -+ // MIR for `issue_77355_opt` after ConstGoto - - fn issue_77355_opt(_1: Foo) -> u64 { - debug num => _1; - let mut _0: u64; -- let mut _2: bool; -- let mut _3: isize; -+ let mut _2: isize; - - bb0: { -- StorageLive(_2); -- _3 = discriminant(_1); -- switchInt(move _3) -> [1: bb2, 2: bb2, otherwise: bb1]; -+ _2 = discriminant(_1); -+ switchInt(move _2) -> [1: bb2, 2: bb2, otherwise: bb1]; - } - - bb1: { -- _2 = const false; -+ _0 = const 42_u64; - goto -> bb3; - } - - bb2: { -- _2 = const true; -+ _0 = const 23_u64; - goto -> bb3; - } - - bb3: { -- switchInt(move _2) -> [0: bb5, otherwise: bb4]; -- } -- -- bb4: { -- _0 = const 23_u64; -- goto -> bb6; -- } -- -- bb5: { -- _0 = const 42_u64; -- goto -> bb6; -- } -- -- bb6: { -- StorageDead(_2); - return; - } - } - diff --git a/tests/mir-opt/const_goto.rs b/tests/mir-opt/const_goto.rs deleted file mode 100644 index 93cb71c3a0f82..0000000000000 --- a/tests/mir-opt/const_goto.rs +++ /dev/null @@ -1,19 +0,0 @@ -// skip-filecheck -// unit-test: ConstGoto - -pub enum Foo { - A, - B, - C, - D, - E, - F, -} - -// EMIT_MIR const_goto.issue_77355_opt.ConstGoto.diff -fn issue_77355_opt(num: Foo) -> u64 { - if matches!(num, Foo::B | Foo::C) { 23 } else { 42 } -} -fn main() { - issue_77355_opt(Foo::A); -} diff --git a/tests/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff b/tests/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff deleted file mode 100644 index 84a13f28a313d..0000000000000 --- a/tests/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff +++ /dev/null @@ -1,51 +0,0 @@ -- // MIR for `f` before ConstGoto -+ // MIR for `f` after ConstGoto - - fn f() -> u64 { - let mut _0: u64; - let mut _1: bool; - let mut _2: i32; - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = const A; - switchInt(_2) -> [1: bb2, 2: bb2, 3: bb2, otherwise: bb1]; - } - - bb1: { - _1 = const true; - goto -> bb3; - } - - bb2: { - _1 = const B; -- goto -> bb3; -+ switchInt(_1) -> [0: bb4, otherwise: bb3]; - } - - bb3: { -- switchInt(_1) -> [0: bb5, otherwise: bb4]; -- } -- -- bb4: { - _0 = const 2_u64; -- goto -> bb6; -+ goto -> bb5; - } - -- bb5: { -+ bb4: { - _0 = const 1_u64; -- goto -> bb6; -+ goto -> bb5; - } - -- bb6: { -+ bb5: { - StorageDead(_2); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/const_goto_const_eval_fail.f.JumpThreading.diff b/tests/mir-opt/const_goto_const_eval_fail.f.JumpThreading.diff new file mode 100644 index 0000000000000..4fc9254b7baed --- /dev/null +++ b/tests/mir-opt/const_goto_const_eval_fail.f.JumpThreading.diff @@ -0,0 +1,47 @@ +- // MIR for `f` before JumpThreading ++ // MIR for `f` after JumpThreading + + fn f() -> u64 { + let mut _0: u64; + let mut _1: bool; + + bb0: { + StorageLive(_1); + switchInt(const A) -> [1: bb2, 2: bb2, 3: bb2, otherwise: bb1]; + } + + bb1: { + _1 = const true; +- goto -> bb3; ++ goto -> bb7; + } + + bb2: { + _1 = const B; + goto -> bb3; + } + + bb3: { + switchInt(_1) -> [0: bb5, otherwise: bb4]; + } + + bb4: { + _0 = const 2_u64; + goto -> bb6; + } + + bb5: { + _0 = const 1_u64; + goto -> bb6; + } + + bb6: { + StorageDead(_1); + return; ++ } ++ ++ bb7: { ++ goto -> bb4; + } + } + diff --git a/tests/mir-opt/const_goto_const_eval_fail.rs b/tests/mir-opt/const_goto_const_eval_fail.rs index 869f916001cd3..c0e8e144b1529 100644 --- a/tests/mir-opt/const_goto_const_eval_fail.rs +++ b/tests/mir-opt/const_goto_const_eval_fail.rs @@ -5,7 +5,7 @@ // compile-flags: -Zunsound-mir-opts // If const eval fails, then don't crash -// EMIT_MIR const_goto_const_eval_fail.f.ConstGoto.diff +// EMIT_MIR const_goto_const_eval_fail.f.JumpThreading.diff pub fn f() -> u64 { match { match A { diff --git a/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff b/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff deleted file mode 100644 index 1768298d52181..0000000000000 --- a/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff +++ /dev/null @@ -1,102 +0,0 @@ -- // MIR for `match_nested_if` before ConstGoto -+ // MIR for `match_nested_if` after ConstGoto - - fn match_nested_if() -> bool { - let mut _0: bool; - let _1: bool; -- let mut _2: (); -- let mut _3: bool; -- let mut _4: bool; -- let mut _5: bool; -- let mut _6: bool; -+ let mut _2: bool; - scope 1 { - debug val => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = (); -- StorageLive(_3); -- StorageLive(_4); -- StorageLive(_5); -- StorageLive(_6); -- _6 = const true; -- switchInt(move _6) -> [0: bb2, otherwise: bb1]; -+ _2 = const true; -+ switchInt(move _2) -> [0: bb2, otherwise: bb1]; - } - - bb1: { -- _5 = const true; -+ StorageDead(_2); -+ _1 = const true; - goto -> bb3; - } - - bb2: { -- _5 = const false; -+ StorageDead(_2); -+ _1 = const false; - goto -> bb3; - } - - bb3: { -- switchInt(move _5) -> [0: bb5, otherwise: bb4]; -- } -- -- bb4: { -- StorageDead(_6); -- _4 = const true; -- goto -> bb6; -- } -- -- bb5: { -- StorageDead(_6); -- _4 = const false; -- goto -> bb6; -- } -- -- bb6: { -- switchInt(move _4) -> [0: bb8, otherwise: bb7]; -- } -- -- bb7: { -- StorageDead(_5); -- _3 = const true; -- goto -> bb9; -- } -- -- bb8: { -- StorageDead(_5); -- _3 = const false; -- goto -> bb9; -- } -- -- bb9: { -- switchInt(move _3) -> [0: bb11, otherwise: bb10]; -- } -- -- bb10: { -- StorageDead(_4); -- StorageDead(_3); -- _1 = const true; -- goto -> bb12; -- } -- -- bb11: { -- StorageDead(_4); -- StorageDead(_3); -- _1 = const false; -- goto -> bb12; -- } -- -- bb12: { -- StorageDead(_2); - _0 = _1; - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/const_goto_storage.rs b/tests/mir-opt/const_goto_storage.rs deleted file mode 100644 index 9d43da23990bc..0000000000000 --- a/tests/mir-opt/const_goto_storage.rs +++ /dev/null @@ -1,22 +0,0 @@ -// skip-filecheck -// unit-test: ConstGoto - -// EMIT_MIR const_goto_storage.match_nested_if.ConstGoto.diff -fn match_nested_if() -> bool { - let val = match () { - () if if if if true { true } else { false } { true } else { false } { - true - } else { - false - } => - { - true - } - _ => false, - }; - val -} - -fn main() { - let _ = match_nested_if(); -} diff --git a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff index 4f0f7fa8fa274..b46c61294f7d7 100644 --- a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff @@ -12,10 +12,12 @@ let mut _8: (u8, i32); let mut _9: u8; scope 1 { - debug first => _2; +- debug first => _2; ++ debug first => const 1_i32; let _6: i32; scope 2 { - debug second => _6; +- debug second => _6; ++ debug second => const 3_i32; } } diff --git a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff index 4f0f7fa8fa274..b46c61294f7d7 100644 --- a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff @@ -12,10 +12,12 @@ let mut _8: (u8, i32); let mut _9: u8; scope 1 { - debug first => _2; +- debug first => _2; ++ debug first => const 1_i32; let _6: i32; scope 2 { - debug second => _6; +- debug second => _6; ++ debug second => const 3_i32; } } diff --git a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff index 854e27445afb9..c3ad75324f94b 100644 --- a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff @@ -9,7 +9,8 @@ let _4: (); let mut _5: u8; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff index f6c4b2c924097..ee374f261e0f3 100644 --- a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff @@ -9,7 +9,8 @@ let _4: (); let mut _5: u8; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs index 3dd37b5910eff..ad5990b010d64 100644 --- a/tests/mir-opt/const_prop/aggregate.rs +++ b/tests/mir-opt/const_prop/aggregate.rs @@ -5,9 +5,7 @@ // EMIT_MIR aggregate.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK-NOT: = Add( - // CHECK: [[x]] = const 1_u8; + // CHECK: debug x => const 1_u8; // CHECK-NOT: = Add( // CHECK: foo(const 1_u8) let x = (0, 1, 2).1 + 0; @@ -18,12 +16,9 @@ fn main() { // EMIT_MIR aggregate.foo.GVN.diff fn foo(x: u8) { // CHECK-LABEL: fn foo( - // CHECK: debug first => [[first:_.*]]; - // CHECK: debug second => [[second:_.*]]; - // CHECK-NOT: = Add( - // CHECK: [[first]] = const 1_i32; + // CHECK: debug first => const 1_i32; + // CHECK: debug second => const 3_i32; // CHECK-NOT: = Add( - // CHECK: [[second]] = const 3_i32; let first = (0, x).0 + 1; let second = (x, 1).1 + 2; } diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff index 6d00dd5b21260..66d62d514b79c 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff @@ -9,7 +9,8 @@ let mut _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff index 7e2f72ab31bce..c8bfa486f5b74 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff @@ -9,7 +9,8 @@ let mut _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff index 6d00dd5b21260..66d62d514b79c 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff @@ -9,7 +9,8 @@ let mut _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff index 7e2f72ab31bce..c8bfa486f5b74 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff @@ -9,7 +9,8 @@ let mut _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs index 2ae5087751f25..58b2e4c281777 100644 --- a/tests/mir-opt/const_prop/array_index.rs +++ b/tests/mir-opt/const_prop/array_index.rs @@ -5,7 +5,6 @@ // EMIT_MIR array_index.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: [[x]] = const 2_u32; + // CHECK: debug x => const 2_u32; let x: u32 = [0, 1, 2, 3][2]; } diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff index 4838efba6f9d1..2c53382a4afca 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff @@ -10,7 +10,8 @@ let mut _6: bool; let mut _7: bool; scope 1 { - debug y => _1; +- debug y => _1; ++ debug y => const 0_i32; let _2: i32; scope 2 { debug _z => _2; diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff index 7f403d6efc103..1932f3278af73 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff @@ -10,7 +10,8 @@ let mut _6: bool; let mut _7: bool; scope 1 { - debug y => _1; +- debug y => _1; ++ debug y => const 0_i32; let _2: i32; scope 2 { debug _z => _2; diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs index 2ba53a80c43d9..de69c952a3d9e 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs @@ -5,7 +5,7 @@ #[allow(unconditional_panic)] fn main() { // CHECK-LABEL: fn main( - // CHECK: debug y => [[y:_.*]]; + // CHECK: debug y => const 0_i32; // CHECK: debug _z => [[z:_.*]]; // CHECK: assert(!const true, "attempt to divide `{}` by zero", const 1_i32) // CHECK: assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff index 59f2eb86f5095..fb733befcb05e 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff @@ -10,7 +10,8 @@ let mut _6: bool; let mut _7: bool; scope 1 { - debug y => _1; +- debug y => _1; ++ debug y => const 0_i32; let _2: i32; scope 2 { debug _z => _2; diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff index 9b866082788cd..973345c906c6c 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff @@ -10,7 +10,8 @@ let mut _6: bool; let mut _7: bool; scope 1 { - debug y => _1; +- debug y => _1; ++ debug y => const 0_i32; let _2: i32; scope 2 { debug _z => _2; diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs index 9ab57750de0bb..f2ce46e68fb90 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs @@ -5,7 +5,7 @@ #[allow(unconditional_panic)] fn main() { // CHECK-LABEL: fn main( - // CHECK: debug y => [[y:_.*]]; + // CHECK: debug y => const 0_i32; // CHECK: debug _z => [[z:_.*]]; // CHECK: assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of // zero", const 1_i32) diff --git a/tests/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs index 3b7ea25ad46eb..1307e2a289d1a 100644 --- a/tests/mir-opt/const_prop/boolean_identities.rs +++ b/tests/mir-opt/const_prop/boolean_identities.rs @@ -3,10 +3,8 @@ // EMIT_MIR boolean_identities.test.GVN.diff pub fn test(x: bool, y: bool) -> bool { // CHECK-LABEL: fn test( - // CHECK: debug a => [[a:_.*]]; - // CHECK: debug b => [[b:_.*]]; - // CHECK: [[a]] = const true; - // CHECK: [[b]] = const false; + // CHECK: debug a => const true; + // CHECK: debug b => const false; // CHECK: _0 = const false; let a = (y | true); let b = (x & false); diff --git a/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff b/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff index 0bd8413289e63..7832892f95128 100644 --- a/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff +++ b/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff @@ -11,10 +11,12 @@ let mut _7: bool; let mut _8: bool; scope 1 { - debug a => _3; +- debug a => _3; ++ debug a => const true; let _5: bool; scope 2 { - debug b => _5; +- debug b => _5; ++ debug b => const false; } } diff --git a/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff index 59ee38f5a2b94..f08a867fa26a6 100644 --- a/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff @@ -13,7 +13,8 @@ let mut _8: *const i32; let mut _9: *const i32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => _2; } scope 2 { } diff --git a/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff index 9d87bd809d1f3..57c20dcc10cbb 100644 --- a/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff @@ -13,7 +13,8 @@ let mut _8: *const i32; let mut _9: *const i32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => _2; } scope 2 { } diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs index d2d61f86d5eb4..393a300fff3f6 100644 --- a/tests/mir-opt/const_prop/boxes.rs +++ b/tests/mir-opt/const_prop/boxes.rs @@ -11,8 +11,7 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: debug x => [[x:_.*]]; // CHECK: (*{{_.*}}) = const 42_i32; - // CHECK: [[tmp:_.*]] = (*{{_.*}}); - // CHECK: [[x]] = [[tmp]]; + // CHECK: [[x]] = (*{{_.*}}); let x = *(#[rustc_box] Box::new(42)) + 0; diff --git a/tests/mir-opt/const_prop/cast.main.GVN.diff b/tests/mir-opt/const_prop/cast.main.GVN.diff index bc442c4e4468b..c4a84e1733bc5 100644 --- a/tests/mir-opt/const_prop/cast.main.GVN.diff +++ b/tests/mir-opt/const_prop/cast.main.GVN.diff @@ -5,10 +5,12 @@ let mut _0: (); let _1: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; let _2: u8; scope 2 { - debug y => _2; +- debug y => _2; ++ debug y => const 42_u8; } } diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs index 00a8bcd1adbe8..e07a11ab93b78 100644 --- a/tests/mir-opt/const_prop/cast.rs +++ b/tests/mir-opt/const_prop/cast.rs @@ -3,10 +3,8 @@ fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: debug y => [[y:_.*]]; - // CHECK: [[x]] = const 42_u32; - // CHECK: [[y]] = const 42_u8; + // CHECK: debug x => const 42_u32; + // CHECK: debug y => const 42_u8; let x = 42u8 as u32; let y = 42u32 as u8; } diff --git a/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff index d5117b2f63846..d7f975e1ea53e 100644 --- a/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff @@ -6,7 +6,8 @@ let _1: u32; let mut _2: (u32, bool); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff index 2118d37672c0b..70929f44b2d1a 100644 --- a/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff @@ -6,7 +6,8 @@ let _1: u32; let mut _2: (u32, bool); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs index 0abcb5dd3d42a..94329edc5a9c1 100644 --- a/tests/mir-opt/const_prop/checked_add.rs +++ b/tests/mir-opt/const_prop/checked_add.rs @@ -5,8 +5,7 @@ // EMIT_MIR checked_add.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; + // CHECK: debug x => const 2_u32; // CHECK: assert(!const false, - // CHECK: [[x]] = const 2_u32; let x: u32 = 1 + 1; } diff --git a/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff index 8301a4c1aa864..963dd6fb970da 100644 --- a/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff @@ -7,7 +7,8 @@ let mut _2: u8; let mut _3: (u8, bool); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 3_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff index 8dcbfd2c2c11e..7745555904c36 100644 --- a/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff @@ -7,7 +7,8 @@ let mut _2: u8; let mut _3: (u8, bool); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 3_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs index d089418e89844..8e6d7a0d8cbe8 100644 --- a/tests/mir-opt/const_prop/indirect.rs +++ b/tests/mir-opt/const_prop/indirect.rs @@ -5,7 +5,6 @@ // EMIT_MIR indirect.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: [[x]] = const 3_u8; + // CHECK: debug x => const 3_u8; let x = (2u32 as u8) + 1; } diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff index 4c2df228eb853..2e684e8cffccc 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff @@ -9,8 +9,10 @@ scope 1 { } scope 2 (inlined #[track_caller] ::add) { - debug self => _2; - debug other => _3; +- debug self => _2; +- debug other => _3; ++ debug self => const u8::MAX; ++ debug other => const 1_u8; let mut _4: (u8, bool); } diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff index c4e666b489e0b..8e35480128656 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff @@ -9,8 +9,10 @@ scope 1 { } scope 2 (inlined #[track_caller] ::add) { - debug self => _2; - debug other => _3; +- debug self => _2; +- debug other => _3; ++ debug self => const u8::MAX; ++ debug other => const 1_u8; let mut _4: (u8, bool); } diff --git a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff index da5bf1cf42ca9..95200845cbb8b 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff @@ -10,7 +10,8 @@ let mut _7: Empty; let mut _8: main::NoVariants; scope 1 { - debug _invalid_char => _1; +- debug _invalid_char => _1; ++ debug _invalid_char => (_2.1: char); let _3: [E; 1]; scope 3 { debug _invalid_tag => _3; diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff index bd987c01ab16f..4069060a418ff 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff @@ -9,7 +9,8 @@ let mut _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 0_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff index e9ebef84ae048..cb0939901d411 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff @@ -9,7 +9,8 @@ let mut _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 0_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff index bd987c01ab16f..4069060a418ff 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff @@ -9,7 +9,8 @@ let mut _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 0_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff index e9ebef84ae048..cb0939901d411 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff @@ -9,7 +9,8 @@ let mut _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 0_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff b/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff index 38f235052303f..cefbb11d23951 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff +++ b/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff @@ -9,7 +9,8 @@ let mut _4: u8; let mut _5: &u8; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs index a3d8fee65d745..436e29bc5a872 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.rs +++ b/tests/mir-opt/const_prop/read_immutable_static.rs @@ -5,7 +5,6 @@ static FOO: u8 = 2; // EMIT_MIR read_immutable_static.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: [[x]] = const 4_u8; + // CHECK: debug x => const 4_u8; let x = FOO + FOO; } diff --git a/tests/mir-opt/const_prop/ref_deref.main.GVN.diff b/tests/mir-opt/const_prop/ref_deref.main.GVN.diff index 56cbd00025ed4..9f5ba72e6acf5 100644 --- a/tests/mir-opt/const_prop/ref_deref.main.GVN.diff +++ b/tests/mir-opt/const_prop/ref_deref.main.GVN.diff @@ -8,7 +8,8 @@ let _3: i32; let mut _4: &i32; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 4_i32; } bb0: { diff --git a/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs index 67de110d8bb55..dedd6378bb568 100644 --- a/tests/mir-opt/const_prop/ref_deref.rs +++ b/tests/mir-opt/const_prop/ref_deref.rs @@ -3,7 +3,6 @@ // EMIT_MIR ref_deref.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug a => [[a:_.*]]; - // CHECK: [[a]] = const 4_i32; + // CHECK: debug a => const 4_i32; let a = *(&4); } diff --git a/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff b/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff index d75c0c3b286b4..0752b2ade1dfa 100644 --- a/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff +++ b/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff @@ -8,7 +8,8 @@ let _3: (i32, i32); let mut _4: &(i32, i32); scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 5_i32; } bb0: { diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs index 0f706b91b3869..3af2f61079850 100644 --- a/tests/mir-opt/const_prop/ref_deref_project.rs +++ b/tests/mir-opt/const_prop/ref_deref_project.rs @@ -4,7 +4,6 @@ // EMIT_MIR ref_deref_project.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug a => [[a:_.*]]; - // CHECK: [[a]] = const 5_i32; + // CHECK: debug a => const 5_i32; let a = *(&(4, 5).1); } diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff index 71635b8e9c3e7..1648513bbc087 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff @@ -10,7 +10,8 @@ let mut _5: usize; let mut _6: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff index 84205028d6d2b..83d1f77c6f56a 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff @@ -10,7 +10,8 @@ let mut _5: usize; let mut _6: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff index 71635b8e9c3e7..1648513bbc087 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff @@ -10,7 +10,8 @@ let mut _5: usize; let mut _6: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff index 84205028d6d2b..83d1f77c6f56a 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff @@ -10,7 +10,8 @@ let mut _5: usize; let mut _6: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs index 2c8717d25bb57..2ccbfbff6755c 100644 --- a/tests/mir-opt/const_prop/repeat.rs +++ b/tests/mir-opt/const_prop/repeat.rs @@ -5,7 +5,6 @@ // EMIT_MIR repeat.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: [[x]] = const 42_u32; + // CHECK: debug x => const 42_u32; let x: u32 = [42; 8][2] + 0; } diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff index 0a20fb0e59ef0..e473fabdb4cca 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff @@ -7,7 +7,8 @@ let _2: (); let mut _3: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff index 8b9519d3adc49..9fd74d5098541 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff @@ -7,7 +7,8 @@ let _2: (); let mut _3: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff index 803be994d9aeb..5612910371047 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff @@ -13,7 +13,8 @@ let mut _8: bool; let mut _9: &[u32; 3]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 2_u32; } bb0: { @@ -22,25 +23,23 @@ StorageLive(_3); StorageLive(_4); _9 = const _; -- _4 = _9; -- _3 = _4; -- _2 = move _3 as &[u32] (PointerCoercion(Unsize)); -+ _4 = const {ALLOC0: &[u32; 3]}; -+ _3 = const {ALLOC0: &[u32; 3]}; -+ _2 = const {ALLOC0: &[u32; 3]} as &[u32] (PointerCoercion(Unsize)); + _4 = &(*_9); + _3 = &(*_4); + _2 = move _3 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); +- _7 = Len((*_2)); - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; -+ _8 = Lt(const 1_usize, _7); -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind unreachable]; ++ _7 = const 3_usize; ++ _8 = const true; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable]; } bb1: { - _1 = (*_2)[_6]; -+ _1 = (*_2)[1 of 2]; ++ _1 = const 2_u32; StorageDead(_6); StorageDead(_4); StorageDead(_2); @@ -48,9 +47,5 @@ StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 12, align: 4) { -+ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............ } diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff index 2a20e3eca599b..f1102da4590c5 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff @@ -13,7 +13,8 @@ let mut _8: bool; let mut _9: &[u32; 3]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 2_u32; } bb0: { @@ -22,25 +23,23 @@ StorageLive(_3); StorageLive(_4); _9 = const _; -- _4 = _9; -- _3 = _4; -- _2 = move _3 as &[u32] (PointerCoercion(Unsize)); -+ _4 = const {ALLOC0: &[u32; 3]}; -+ _3 = const {ALLOC0: &[u32; 3]}; -+ _2 = const {ALLOC0: &[u32; 3]} as &[u32] (PointerCoercion(Unsize)); + _4 = &(*_9); + _3 = &(*_4); + _2 = move _3 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); +- _7 = Len((*_2)); - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; -+ _8 = Lt(const 1_usize, _7); -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind continue]; ++ _7 = const 3_usize; ++ _8 = const true; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue]; } bb1: { - _1 = (*_2)[_6]; -+ _1 = (*_2)[1 of 2]; ++ _1 = const 2_u32; StorageDead(_6); StorageDead(_4); StorageDead(_2); @@ -48,9 +47,5 @@ StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 12, align: 4) { -+ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............ } diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff index 803be994d9aeb..5612910371047 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff @@ -13,7 +13,8 @@ let mut _8: bool; let mut _9: &[u32; 3]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 2_u32; } bb0: { @@ -22,25 +23,23 @@ StorageLive(_3); StorageLive(_4); _9 = const _; -- _4 = _9; -- _3 = _4; -- _2 = move _3 as &[u32] (PointerCoercion(Unsize)); -+ _4 = const {ALLOC0: &[u32; 3]}; -+ _3 = const {ALLOC0: &[u32; 3]}; -+ _2 = const {ALLOC0: &[u32; 3]} as &[u32] (PointerCoercion(Unsize)); + _4 = &(*_9); + _3 = &(*_4); + _2 = move _3 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); +- _7 = Len((*_2)); - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; -+ _8 = Lt(const 1_usize, _7); -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind unreachable]; ++ _7 = const 3_usize; ++ _8 = const true; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable]; } bb1: { - _1 = (*_2)[_6]; -+ _1 = (*_2)[1 of 2]; ++ _1 = const 2_u32; StorageDead(_6); StorageDead(_4); StorageDead(_2); @@ -48,9 +47,5 @@ StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 12, align: 4) { -+ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............ } diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff index 2a20e3eca599b..f1102da4590c5 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff @@ -13,7 +13,8 @@ let mut _8: bool; let mut _9: &[u32; 3]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 2_u32; } bb0: { @@ -22,25 +23,23 @@ StorageLive(_3); StorageLive(_4); _9 = const _; -- _4 = _9; -- _3 = _4; -- _2 = move _3 as &[u32] (PointerCoercion(Unsize)); -+ _4 = const {ALLOC0: &[u32; 3]}; -+ _3 = const {ALLOC0: &[u32; 3]}; -+ _2 = const {ALLOC0: &[u32; 3]} as &[u32] (PointerCoercion(Unsize)); + _4 = &(*_9); + _3 = &(*_4); + _2 = move _3 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); +- _7 = Len((*_2)); - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; -+ _8 = Lt(const 1_usize, _7); -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind continue]; ++ _7 = const 3_usize; ++ _8 = const true; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue]; } bb1: { - _1 = (*_2)[_6]; -+ _1 = (*_2)[1 of 2]; ++ _1 = const 2_u32; StorageDead(_6); StorageDead(_4); StorageDead(_2); @@ -48,9 +47,5 @@ StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 12, align: 4) { -+ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............ } diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 79cd926df2144..a92ce1ac20531 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -6,11 +6,7 @@ // EMIT_MIR slice_len.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug a => [[a:_.*]]; - // CHECK: [[slice:_.*]] = const {{.*}} as &[u32] (PointerCoercion(Unsize)); - // FIXME(cjgillot) simplify Len and projection into unsized slice. - // CHECK-NOT: assert(const true, - // CHECK: [[a]] = (*[[slice]])[1 of 2]; - // CHECK-NOT: [[a]] = const 2_u32; + // CHECK: debug a => const 2_u32; + // CHECK: assert(const true, let a = (&[1u32, 2, 3] as &[u32])[1]; } diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-gvn.panic-abort.diff similarity index 78% rename from tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff rename to tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-gvn.panic-abort.diff index ced5e500d946b..37f5e4fc24dd8 100644 --- a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff +++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-gvn.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before SimplifyConstCondition-after-const-prop -+ // MIR for `main` after SimplifyConstCondition-after-const-prop +- // MIR for `main` before SimplifyConstCondition-after-gvn ++ // MIR for `main` after SimplifyConstCondition-after-gvn fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-gvn.panic-unwind.diff similarity index 78% rename from tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff rename to tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-gvn.panic-unwind.diff index e598a0d3df007..a6c6e528e0865 100644 --- a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff +++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-gvn.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before SimplifyConstCondition-after-const-prop -+ // MIR for `main` after SimplifyConstCondition-after-const-prop +- // MIR for `main` before SimplifyConstCondition-after-gvn ++ // MIR for `main` after SimplifyConstCondition-after-gvn fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs index c81b574d15009..9843c72754e61 100644 --- a/tests/mir-opt/const_prop/switch_int.rs +++ b/tests/mir-opt/const_prop/switch_int.rs @@ -1,12 +1,12 @@ // unit-test: GVN -// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop +// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-gvn // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #[inline(never)] fn foo(_: i32) { } // EMIT_MIR switch_int.main.GVN.diff -// EMIT_MIR switch_int.main.SimplifyConstCondition-after-const-prop.diff +// EMIT_MIR switch_int.main.SimplifyConstCondition-after-gvn.diff fn main() { // CHECK-LABEL: fn main( // CHECK: bb0: { diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff index c6a428019d81a..78b107b232460 100644 --- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff @@ -12,8 +12,9 @@ StorageLive(_1); StorageLive(_2); - _2 = (); +- _1 = Union32 { value: move _2 }; + _2 = const (); - _1 = Union32 { value: move _2 }; ++ _1 = Union32 { value: const () }; StorageDead(_2); _0 = move _1 as u32 (Transmute); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff index c6a428019d81a..78b107b232460 100644 --- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff @@ -12,8 +12,9 @@ StorageLive(_1); StorageLive(_2); - _2 = (); +- _1 = Union32 { value: move _2 }; + _2 = const (); - _1 = Union32 { value: move _2 }; ++ _1 = Union32 { value: const () }; StorageDead(_2); _0 = move _1 as u32 (Transmute); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff index 2ef83abfac0a3..378de15f628fa 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff @@ -6,7 +6,8 @@ let _1: std::boxed::Box; let mut _2: *const Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); } scope 2 { } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff index 2ef83abfac0a3..378de15f628fa 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff @@ -6,7 +6,8 @@ let _1: std::boxed::Box; let mut _2: *const Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); } scope 2 { } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff index 0ff31b1a98186..c5135ea820f30 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff @@ -6,7 +6,8 @@ let _1: &mut Never; let mut _2: &mut Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const {0x1 as &mut Never}; } scope 2 { } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff index 0ff31b1a98186..c5135ea820f30 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff @@ -6,7 +6,8 @@ let _1: &mut Never; let mut _2: &mut Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const {0x1 as &mut Never}; } scope 2 { } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff index 430d16c97a6c5..95db6e7b5da67 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff @@ -5,7 +5,8 @@ let mut _0: !; let _1: &Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const {0x1 as &Never}; } scope 2 { } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff index 430d16c97a6c5..95db6e7b5da67 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff @@ -5,7 +5,8 @@ let mut _0: !; let _1: &Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const {0x1 as &Never}; } scope 2 { } diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff index c2f3fb1b3b575..e0f032ba29ec7 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff @@ -7,7 +7,8 @@ let _2: (); let mut _3: (u32, u32); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const (1_u32, 2_u32); } bb0: { diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff index 55d9a3b0cac67..f5a1ed74aa80c 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff @@ -7,7 +7,8 @@ let _2: (); let mut _3: (u32, u32); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const (1_u32, 2_u32); } bb0: { diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff index ffbd97bb5452f..d7b8170ad2393 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff @@ -12,7 +12,7 @@ let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; scope 3 { - debug ptr => _3; + debug ptr => const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; @@ -21,25 +21,24 @@ scope 6 { let _6: *mut [bool; 0]; scope 7 { - debug ptr => _6; + debug ptr => const {0x1 as *mut [bool; 0]}; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; + debug ptr => const {0x1 as *mut [bool; 0]}; let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; + debug ptr => const {0x1 as *mut [bool; 0]}; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; + debug self => const {0x1 as *mut [bool; 0]}; + let mut _9: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; + debug ptr => _9; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; + debug self => _9; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; + debug self => _9; } } } @@ -53,7 +52,7 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; + debug addr => const 1_usize; scope 10 { } } @@ -75,20 +74,18 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - StorageLive(_10); - _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); + _8 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_9); StorageDead(_8); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; + _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); + _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(_3, const std::alloc::Global); + _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; + _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; @@ -100,3 +97,15 @@ } } + ALLOC2 (size: 8, align: 4) { + 01 00 00 00 00 00 00 00 │ ........ + } + + ALLOC1 (size: 8, align: 4) { + 01 00 00 00 00 00 00 00 │ ........ + } + + ALLOC0 (size: 8, align: 4) { + 01 00 00 00 00 00 00 00 │ ........ + } + diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff index 7b6dcf1972b2e..45feca6a73409 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff @@ -12,7 +12,7 @@ let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; scope 3 { - debug ptr => _3; + debug ptr => const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; @@ -21,25 +21,24 @@ scope 6 { let _6: *mut [bool; 0]; scope 7 { - debug ptr => _6; + debug ptr => const {0x1 as *mut [bool; 0]}; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; + debug ptr => const {0x1 as *mut [bool; 0]}; let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; + debug ptr => const {0x1 as *mut [bool; 0]}; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; + debug self => const {0x1 as *mut [bool; 0]}; + let mut _9: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; + debug ptr => _9; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; + debug self => _9; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; + debug self => _9; } } } @@ -53,7 +52,7 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; + debug addr => const 1_usize; scope 10 { } } @@ -75,20 +74,18 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - StorageLive(_10); - _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); + _8 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_9); StorageDead(_8); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; + _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); + _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(_3, const std::alloc::Global); + _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; + _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; @@ -104,3 +101,15 @@ } } + ALLOC2 (size: 8, align: 4) { + 01 00 00 00 00 00 00 00 │ ........ + } + + ALLOC1 (size: 8, align: 4) { + 01 00 00 00 00 00 00 00 │ ........ + } + + ALLOC0 (size: 8, align: 4) { + 01 00 00 00 00 00 00 00 │ ........ + } + diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff index ffbd97bb5452f..5993b3acac7f8 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff @@ -12,7 +12,7 @@ let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; scope 3 { - debug ptr => _3; + debug ptr => const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; @@ -21,25 +21,24 @@ scope 6 { let _6: *mut [bool; 0]; scope 7 { - debug ptr => _6; + debug ptr => const {0x1 as *mut [bool; 0]}; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; + debug ptr => const {0x1 as *mut [bool; 0]}; let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; + debug ptr => const {0x1 as *mut [bool; 0]}; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; + debug self => const {0x1 as *mut [bool; 0]}; + let mut _9: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; + debug ptr => _9; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; + debug self => _9; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; + debug self => _9; } } } @@ -53,7 +52,7 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; + debug addr => const 1_usize; scope 10 { } } @@ -75,20 +74,18 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - StorageLive(_10); - _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); + _8 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_9); StorageDead(_8); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; + _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); + _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(_3, const std::alloc::Global); + _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; + _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; @@ -100,3 +97,15 @@ } } + ALLOC2 (size: 16, align: 8) { + 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + + ALLOC1 (size: 16, align: 8) { + 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + + ALLOC0 (size: 16, align: 8) { + 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff index 7b6dcf1972b2e..592bc4cd9a3d9 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff @@ -12,7 +12,7 @@ let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; scope 3 { - debug ptr => _3; + debug ptr => const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; @@ -21,25 +21,24 @@ scope 6 { let _6: *mut [bool; 0]; scope 7 { - debug ptr => _6; + debug ptr => const {0x1 as *mut [bool; 0]}; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; + debug ptr => const {0x1 as *mut [bool; 0]}; let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; + debug ptr => const {0x1 as *mut [bool; 0]}; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; + debug self => const {0x1 as *mut [bool; 0]}; + let mut _9: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; + debug ptr => _9; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; + debug self => _9; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; + debug self => _9; } } } @@ -53,7 +52,7 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; + debug addr => const 1_usize; scope 10 { } } @@ -75,20 +74,18 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - StorageLive(_10); - _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); + _8 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_9); StorageDead(_8); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; + _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); + _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(_3, const std::alloc::Global); + _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; + _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; @@ -104,3 +101,15 @@ } } + ALLOC2 (size: 16, align: 8) { + 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + + ALLOC1 (size: 16, align: 8) { + 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + + ALLOC0 (size: 16, align: 8) { + 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff index df68ce496fd8c..f0c652bdbd5b5 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff @@ -12,7 +12,8 @@ let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; scope 3 { - debug ptr => _3; +- debug ptr => _3; ++ debug ptr => const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; @@ -21,25 +22,28 @@ scope 6 { let _6: *mut [bool; 0]; scope 7 { - debug ptr => _6; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; +- debug self => _6; ++ debug self => const {0x1 as *mut [bool; 0]}; + let mut _9: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; + debug ptr => _9; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; + debug self => _9; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; + debug self => _9; } } } @@ -53,7 +57,8 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; +- debug addr => _7; ++ debug addr => const 1_usize; scope 10 { } } @@ -77,21 +82,24 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - StorageLive(_10); - _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); +- _5 = NonNull::<[bool; 0]> { pointer: _8 }; ++ _8 = const {0x1 as *const [bool; 0]}; ++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_9); StorageDead(_8); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; +- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; ++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); +- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); ++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(_3, const std::alloc::Global); +- _2 = Box::<[bool]>(_3, const std::alloc::Global); ++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; +- _1 = A { foo: move _2 }; ++ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; @@ -101,5 +109,17 @@ StorageDead(_1); return; } ++ } ++ ++ ALLOC2 (size: 8, align: 4) { ++ 01 00 00 00 00 00 00 00 │ ........ ++ } ++ ++ ALLOC1 (size: 8, align: 4) { ++ 01 00 00 00 00 00 00 00 │ ........ ++ } ++ ++ ALLOC0 (size: 8, align: 4) { ++ 01 00 00 00 00 00 00 00 │ ........ } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff index e16ea22091ee2..160c968479cce 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff @@ -12,7 +12,8 @@ let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; scope 3 { - debug ptr => _3; +- debug ptr => _3; ++ debug ptr => const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; @@ -21,25 +22,28 @@ scope 6 { let _6: *mut [bool; 0]; scope 7 { - debug ptr => _6; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; +- debug self => _6; ++ debug self => const {0x1 as *mut [bool; 0]}; + let mut _9: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; + debug ptr => _9; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; + debug self => _9; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; + debug self => _9; } } } @@ -53,7 +57,8 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; +- debug addr => _7; ++ debug addr => const 1_usize; scope 10 { } } @@ -77,21 +82,24 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - StorageLive(_10); - _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); +- _5 = NonNull::<[bool; 0]> { pointer: _8 }; ++ _8 = const {0x1 as *const [bool; 0]}; ++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_9); StorageDead(_8); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; +- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; ++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); +- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); ++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(_3, const std::alloc::Global); +- _2 = Box::<[bool]>(_3, const std::alloc::Global); ++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; +- _1 = A { foo: move _2 }; ++ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; @@ -105,5 +113,17 @@ bb2 (cleanup): { resume; } ++ } ++ ++ ALLOC2 (size: 8, align: 4) { ++ 01 00 00 00 00 00 00 00 │ ........ ++ } ++ ++ ALLOC1 (size: 8, align: 4) { ++ 01 00 00 00 00 00 00 00 │ ........ ++ } ++ ++ ALLOC0 (size: 8, align: 4) { ++ 01 00 00 00 00 00 00 00 │ ........ } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff index df68ce496fd8c..9805969b8e308 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff @@ -12,7 +12,8 @@ let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; scope 3 { - debug ptr => _3; +- debug ptr => _3; ++ debug ptr => const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; @@ -21,25 +22,28 @@ scope 6 { let _6: *mut [bool; 0]; scope 7 { - debug ptr => _6; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; +- debug self => _6; ++ debug self => const {0x1 as *mut [bool; 0]}; + let mut _9: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; + debug ptr => _9; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; + debug self => _9; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; + debug self => _9; } } } @@ -53,7 +57,8 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; +- debug addr => _7; ++ debug addr => const 1_usize; scope 10 { } } @@ -77,21 +82,24 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - StorageLive(_10); - _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); +- _5 = NonNull::<[bool; 0]> { pointer: _8 }; ++ _8 = const {0x1 as *const [bool; 0]}; ++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_9); StorageDead(_8); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; +- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; ++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); +- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); ++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(_3, const std::alloc::Global); +- _2 = Box::<[bool]>(_3, const std::alloc::Global); ++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; +- _1 = A { foo: move _2 }; ++ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; @@ -101,5 +109,17 @@ StorageDead(_1); return; } ++ } ++ ++ ALLOC2 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ ++ } ++ ++ ALLOC1 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ ++ } ++ ++ ALLOC0 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff index e16ea22091ee2..d794b1e3a4d31 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff @@ -12,7 +12,8 @@ let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; scope 3 { - debug ptr => _3; +- debug ptr => _3; ++ debug ptr => const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; @@ -21,25 +22,28 @@ scope 6 { let _6: *mut [bool; 0]; scope 7 { - debug ptr => _6; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; +- debug ptr => _6; ++ debug ptr => const {0x1 as *mut [bool; 0]}; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; +- debug self => _6; ++ debug self => const {0x1 as *mut [bool; 0]}; + let mut _9: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; + debug ptr => _9; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; + debug self => _9; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; + debug self => _9; } } } @@ -53,7 +57,8 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; +- debug addr => _7; ++ debug addr => const 1_usize; scope 10 { } } @@ -77,21 +82,24 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - StorageLive(_10); - _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); +- _5 = NonNull::<[bool; 0]> { pointer: _8 }; ++ _8 = const {0x1 as *const [bool; 0]}; ++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_9); StorageDead(_8); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; +- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; ++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); +- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); ++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(_3, const std::alloc::Global); +- _2 = Box::<[bool]>(_3, const std::alloc::Global); ++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; +- _1 = A { foo: move _2 }; ++ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; @@ -105,5 +113,17 @@ bb2 (cleanup): { resume; } ++ } ++ ++ ALLOC2 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ ++ } ++ ++ ALLOC1 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ ++ } ++ ++ ALLOC0 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ } diff --git a/tests/mir-opt/dest-prop/move.move_simple.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/move.move_simple.DestinationPropagation.panic-abort.diff new file mode 100644 index 0000000000000..fb09c168fe026 --- /dev/null +++ b/tests/mir-opt/dest-prop/move.move_simple.DestinationPropagation.panic-abort.diff @@ -0,0 +1,35 @@ +- // MIR for `move_simple` before DestinationPropagation ++ // MIR for `move_simple` after DestinationPropagation + + fn move_simple(_1: i32) -> () { + debug x => _1; + let mut _0: (); + let _2: (); + let mut _3: i32; + let mut _4: i32; + + bb0: { + StorageLive(_2); +- StorageLive(_3); +- _3 = _1; +- StorageLive(_4); +- _4 = _1; +- _2 = use_both(move _3, move _4) -> [return: bb1, unwind unreachable]; ++ nop; ++ nop; ++ nop; ++ nop; ++ _2 = use_both(_1, _1) -> [return: bb1, unwind unreachable]; + } + + bb1: { +- StorageDead(_4); +- StorageDead(_3); ++ nop; ++ nop; + StorageDead(_2); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/move.move_simple.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/move.move_simple.DestinationPropagation.panic-unwind.diff new file mode 100644 index 0000000000000..b3718e5440356 --- /dev/null +++ b/tests/mir-opt/dest-prop/move.move_simple.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,35 @@ +- // MIR for `move_simple` before DestinationPropagation ++ // MIR for `move_simple` after DestinationPropagation + + fn move_simple(_1: i32) -> () { + debug x => _1; + let mut _0: (); + let _2: (); + let mut _3: i32; + let mut _4: i32; + + bb0: { + StorageLive(_2); +- StorageLive(_3); +- _3 = _1; +- StorageLive(_4); +- _4 = _1; +- _2 = use_both(move _3, move _4) -> [return: bb1, unwind continue]; ++ nop; ++ nop; ++ nop; ++ nop; ++ _2 = use_both(_1, _1) -> [return: bb1, unwind continue]; + } + + bb1: { +- StorageDead(_4); +- StorageDead(_3); ++ nop; ++ nop; + StorageDead(_2); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/dest-prop/move.rs b/tests/mir-opt/dest-prop/move.rs new file mode 100644 index 0000000000000..701951de72cd8 --- /dev/null +++ b/tests/mir-opt/dest-prop/move.rs @@ -0,0 +1,16 @@ +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// unit-test: DestinationPropagation + +#[inline(never)] +fn use_both(_: i32, _: i32) {} + +// EMIT_MIR move.move_simple.DestinationPropagation.diff +fn move_simple(x: i32) { + // CHECK-LABEL: fn move_simple( + // CHECK: use_both(_1, _1) + use_both(x, x); +} + +fn main() { + move_simple(1); +} diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff b/tests/mir-opt/dest-prop/nrvo_borrowed.nrvo.DestinationPropagation.panic-abort.diff similarity index 53% rename from tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff rename to tests/mir-opt/dest-prop/nrvo_borrowed.nrvo.DestinationPropagation.panic-abort.diff index f7bc5559ab7b4..4d34f43fd5ce6 100644 --- a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff +++ b/tests/mir-opt/dest-prop/nrvo_borrowed.nrvo.DestinationPropagation.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `nrvo` before RenameReturnPlace -+ // MIR for `nrvo` after RenameReturnPlace +- // MIR for `nrvo` before DestinationPropagation ++ // MIR for `nrvo` after DestinationPropagation fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] { debug init => _1; @@ -10,32 +10,33 @@ let mut _5: &mut [u8; 1024]; let mut _6: &mut [u8; 1024]; scope 1 { -- debug buf => _2; -+ debug buf => _0; + debug buf => _2; } bb0: { -- StorageLive(_2); -- _2 = [const 0_u8; 1024]; -+ _0 = [const 0_u8; 1024]; + StorageLive(_2); + _2 = [const 0_u8; 1024]; StorageLive(_3); - StorageLive(_4); - _4 = _1; +- StorageLive(_4); +- _4 = _1; ++ nop; ++ nop; StorageLive(_5); StorageLive(_6); -- _6 = &mut _2; -+ _6 = &mut _0; + _6 = &mut _2; _5 = &mut (*_6); - _3 = move _4(move _5) -> [return: bb1, unwind unreachable]; +- _3 = move _4(move _5) -> [return: bb1, unwind unreachable]; ++ _3 = move _1(move _5) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_5); - StorageDead(_4); +- StorageDead(_4); ++ nop; StorageDead(_6); StorageDead(_3); -- _0 = _2; -- StorageDead(_2); + _0 = _2; + StorageDead(_2); return; } } diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff b/tests/mir-opt/dest-prop/nrvo_borrowed.nrvo.DestinationPropagation.panic-unwind.diff similarity index 53% rename from tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff rename to tests/mir-opt/dest-prop/nrvo_borrowed.nrvo.DestinationPropagation.panic-unwind.diff index 3df8e567f1fe0..9c3cbef38d698 100644 --- a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/nrvo_borrowed.nrvo.DestinationPropagation.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `nrvo` before RenameReturnPlace -+ // MIR for `nrvo` after RenameReturnPlace +- // MIR for `nrvo` before DestinationPropagation ++ // MIR for `nrvo` after DestinationPropagation fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] { debug init => _1; @@ -10,32 +10,33 @@ let mut _5: &mut [u8; 1024]; let mut _6: &mut [u8; 1024]; scope 1 { -- debug buf => _2; -+ debug buf => _0; + debug buf => _2; } bb0: { -- StorageLive(_2); -- _2 = [const 0_u8; 1024]; -+ _0 = [const 0_u8; 1024]; + StorageLive(_2); + _2 = [const 0_u8; 1024]; StorageLive(_3); - StorageLive(_4); - _4 = _1; +- StorageLive(_4); +- _4 = _1; ++ nop; ++ nop; StorageLive(_5); StorageLive(_6); -- _6 = &mut _2; -+ _6 = &mut _0; + _6 = &mut _2; _5 = &mut (*_6); - _3 = move _4(move _5) -> [return: bb1, unwind continue]; +- _3 = move _4(move _5) -> [return: bb1, unwind continue]; ++ _3 = move _1(move _5) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_5); - StorageDead(_4); +- StorageDead(_4); ++ nop; StorageDead(_6); StorageDead(_3); -- _0 = _2; -- StorageDead(_2); + _0 = _2; + StorageDead(_2); return; } } diff --git a/tests/mir-opt/nrvo_simple.rs b/tests/mir-opt/dest-prop/nrvo_borrowed.rs similarity index 69% rename from tests/mir-opt/nrvo_simple.rs rename to tests/mir-opt/dest-prop/nrvo_borrowed.rs index 5b403c560a7e1..1c5184324032a 100644 --- a/tests/mir-opt/nrvo_simple.rs +++ b/tests/mir-opt/dest-prop/nrvo_borrowed.rs @@ -1,8 +1,8 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: RenameReturnPlace +// unit-test: DestinationPropagation -// EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff +// EMIT_MIR nrvo_borrowed.nrvo.DestinationPropagation.diff fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { let mut buf = [0; 1024]; init(&mut buf); diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff index 0af3faf28f076..ac393868514b9 100644 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff @@ -4,14 +4,12 @@ fn main() -> () { let mut _0: (); let _1: main::Un; - let mut _2: u32; - let mut _3: u32; scope 1 { debug un => _1; scope 2 { } scope 4 (inlined std::mem::drop::) { - debug _x => _3; + debug _x => (_1.0: u32); } } scope 3 (inlined val) { @@ -19,13 +17,7 @@ bb0: { StorageLive(_1); - StorageLive(_2); - _2 = const 1_u32; _1 = Un { us: const 1_u32 }; - StorageDead(_2); - StorageLive(_3); - _3 = (_1.0: u32); - StorageDead(_3); StorageDead(_1); return; } diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff index 0af3faf28f076..ac393868514b9 100644 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff @@ -4,14 +4,12 @@ fn main() -> () { let mut _0: (); let _1: main::Un; - let mut _2: u32; - let mut _3: u32; scope 1 { debug un => _1; scope 2 { } scope 4 (inlined std::mem::drop::) { - debug _x => _3; + debug _x => (_1.0: u32); } } scope 3 (inlined val) { @@ -19,13 +17,7 @@ bb0: { StorageLive(_1); - StorageLive(_2); - _2 = const 1_u32; _1 = Un { us: const 1_u32 }; - StorageDead(_2); - StorageLive(_3); - _3 = (_1.0: u32); - StorageDead(_3); StorageDead(_1); return; } diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff index 080478ea88419..206b6dedb7181 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff @@ -7,27 +7,29 @@ debug upper => _3; let mut _0: std::result::Result<(), std::fmt::Error>; let _4: bool; - let mut _6: std::option::Option; - let mut _7: isize; - let mut _9: &mut std::fmt::Formatter<'_>; - let mut _10: &T; - let mut _11: core::num::flt2dec::Sign; - let mut _12: u32; - let mut _13: u32; - let mut _14: usize; - let mut _15: bool; - let mut _16: &mut std::fmt::Formatter<'_>; - let mut _17: &T; - let mut _18: core::num::flt2dec::Sign; - let mut _19: bool; + let mut _5: &std::fmt::Formatter<'_>; + let mut _7: std::option::Option; + let mut _8: &std::fmt::Formatter<'_>; + let mut _9: isize; + let mut _11: &mut std::fmt::Formatter<'_>; + let mut _12: &T; + let mut _13: core::num::flt2dec::Sign; + let mut _14: u32; + let mut _15: u32; + let mut _16: usize; + let mut _17: bool; + let mut _18: &mut std::fmt::Formatter<'_>; + let mut _19: &T; + let mut _20: core::num::flt2dec::Sign; + let mut _21: bool; scope 1 { debug force_sign => _4; - let _5: core::num::flt2dec::Sign; + let _6: core::num::flt2dec::Sign; scope 2 { - debug sign => _5; + debug sign => _6; scope 3 { - debug precision => _8; - let _8: usize; + debug precision => _10; + let _10: usize; scope 5 (inlined Formatter::<'_>::precision) { debug self => _1; } @@ -36,103 +38,103 @@ } scope 4 (inlined Formatter::<'_>::sign_plus) { debug self => _1; - let mut _20: u32; - let mut _21: u32; + let mut _22: u32; + let mut _23: u32; } bb0: { StorageLive(_4); - StorageLive(_20); - StorageLive(_21); - _21 = ((*_1).0: u32); - _20 = BitAnd(move _21, const 1_u32); - StorageDead(_21); - _4 = Ne(move _20, const 0_u32); - StorageDead(_20); - StorageLive(_5); + StorageLive(_22); + StorageLive(_23); + _23 = ((*_1).0: u32); + _22 = BitAnd(move _23, const 1_u32); + StorageDead(_23); + _4 = Ne(move _22, const 0_u32); + StorageDead(_22); + StorageLive(_6); switchInt(_4) -> [0: bb2, otherwise: bb1]; } bb1: { -- _5 = MinusPlus; -+ _5 = const MinusPlus; +- _6 = MinusPlus; ++ _6 = const MinusPlus; goto -> bb3; } bb2: { -- _5 = Minus; -+ _5 = const Minus; +- _6 = Minus; ++ _6 = const Minus; goto -> bb3; } bb3: { - StorageLive(_6); - _6 = ((*_1).4: std::option::Option); - _7 = discriminant(_6); - switchInt(move _7) -> [1: bb4, otherwise: bb6]; + StorageLive(_7); + _7 = ((*_1).4: std::option::Option); + _9 = discriminant(_7); + switchInt(move _9) -> [1: bb4, otherwise: bb6]; } bb4: { -- StorageLive(_8); +- StorageLive(_10); + nop; - _8 = ((_6 as Some).0: usize); - StorageLive(_9); - _9 = _1; - StorageLive(_10); - _10 = _2; + _10 = ((_7 as Some).0: usize); StorageLive(_11); - _11 = _5; + _11 = &mut (*_1); StorageLive(_12); + _12 = &(*_2); StorageLive(_13); + _13 = _6; StorageLive(_14); - _14 = _8; -- _13 = move _14 as u32 (IntToInt); -+ _13 = _8 as u32 (IntToInt); - StorageDead(_14); - _12 = Add(move _13, const 1_u32); - StorageDead(_13); StorageLive(_15); - _15 = _3; -- _0 = float_to_exponential_common_exact::(move _9, move _10, move _11, move _12, move _15) -> [return: bb5, unwind unreachable]; -+ _0 = float_to_exponential_common_exact::(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind unreachable]; + StorageLive(_16); + _16 = _10; +- _15 = move _16 as u32 (IntToInt); ++ _15 = _10 as u32 (IntToInt); + StorageDead(_16); + _14 = Add(move _15, const 1_u32); + StorageDead(_15); + StorageLive(_17); + _17 = _3; +- _0 = float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, move _17) -> [return: bb5, unwind unreachable]; ++ _0 = float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, _3) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_15); + StorageDead(_17); + StorageDead(_14); + StorageDead(_13); StorageDead(_12); StorageDead(_11); - StorageDead(_10); - StorageDead(_9); -- StorageDead(_8); +- StorageDead(_10); + nop; goto -> bb8; } bb6: { - StorageLive(_16); - _16 = _1; - StorageLive(_17); - _17 = _2; StorageLive(_18); - _18 = _5; + _18 = &mut (*_1); StorageLive(_19); - _19 = _3; -- _0 = float_to_exponential_common_shortest::(move _16, move _17, move _18, move _19) -> [return: bb7, unwind unreachable]; -+ _0 = float_to_exponential_common_shortest::(_1, _2, move _18, _3) -> [return: bb7, unwind unreachable]; + _19 = &(*_2); + StorageLive(_20); + _20 = _6; + StorageLive(_21); + _21 = _3; +- _0 = float_to_exponential_common_shortest::(move _18, move _19, move _20, move _21) -> [return: bb7, unwind unreachable]; ++ _0 = float_to_exponential_common_shortest::(move _18, move _19, move _20, _3) -> [return: bb7, unwind unreachable]; } bb7: { + StorageDead(_21); + StorageDead(_20); StorageDead(_19); StorageDead(_18); - StorageDead(_17); - StorageDead(_16); goto -> bb8; } bb8: { - StorageDead(_5); - StorageDead(_4); StorageDead(_6); + StorageDead(_4); + StorageDead(_7); return; } } diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff index ff8933fca8b2c..5a80d67a46a8c 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff @@ -7,27 +7,29 @@ debug upper => _3; let mut _0: std::result::Result<(), std::fmt::Error>; let _4: bool; - let mut _6: std::option::Option; - let mut _7: isize; - let mut _9: &mut std::fmt::Formatter<'_>; - let mut _10: &T; - let mut _11: core::num::flt2dec::Sign; - let mut _12: u32; - let mut _13: u32; - let mut _14: usize; - let mut _15: bool; - let mut _16: &mut std::fmt::Formatter<'_>; - let mut _17: &T; - let mut _18: core::num::flt2dec::Sign; - let mut _19: bool; + let mut _5: &std::fmt::Formatter<'_>; + let mut _7: std::option::Option; + let mut _8: &std::fmt::Formatter<'_>; + let mut _9: isize; + let mut _11: &mut std::fmt::Formatter<'_>; + let mut _12: &T; + let mut _13: core::num::flt2dec::Sign; + let mut _14: u32; + let mut _15: u32; + let mut _16: usize; + let mut _17: bool; + let mut _18: &mut std::fmt::Formatter<'_>; + let mut _19: &T; + let mut _20: core::num::flt2dec::Sign; + let mut _21: bool; scope 1 { debug force_sign => _4; - let _5: core::num::flt2dec::Sign; + let _6: core::num::flt2dec::Sign; scope 2 { - debug sign => _5; + debug sign => _6; scope 3 { - debug precision => _8; - let _8: usize; + debug precision => _10; + let _10: usize; scope 5 (inlined Formatter::<'_>::precision) { debug self => _1; } @@ -36,103 +38,103 @@ } scope 4 (inlined Formatter::<'_>::sign_plus) { debug self => _1; - let mut _20: u32; - let mut _21: u32; + let mut _22: u32; + let mut _23: u32; } bb0: { StorageLive(_4); - StorageLive(_20); - StorageLive(_21); - _21 = ((*_1).0: u32); - _20 = BitAnd(move _21, const 1_u32); - StorageDead(_21); - _4 = Ne(move _20, const 0_u32); - StorageDead(_20); - StorageLive(_5); + StorageLive(_22); + StorageLive(_23); + _23 = ((*_1).0: u32); + _22 = BitAnd(move _23, const 1_u32); + StorageDead(_23); + _4 = Ne(move _22, const 0_u32); + StorageDead(_22); + StorageLive(_6); switchInt(_4) -> [0: bb2, otherwise: bb1]; } bb1: { -- _5 = MinusPlus; -+ _5 = const MinusPlus; +- _6 = MinusPlus; ++ _6 = const MinusPlus; goto -> bb3; } bb2: { -- _5 = Minus; -+ _5 = const Minus; +- _6 = Minus; ++ _6 = const Minus; goto -> bb3; } bb3: { - StorageLive(_6); - _6 = ((*_1).4: std::option::Option); - _7 = discriminant(_6); - switchInt(move _7) -> [1: bb4, otherwise: bb6]; + StorageLive(_7); + _7 = ((*_1).4: std::option::Option); + _9 = discriminant(_7); + switchInt(move _9) -> [1: bb4, otherwise: bb6]; } bb4: { -- StorageLive(_8); +- StorageLive(_10); + nop; - _8 = ((_6 as Some).0: usize); - StorageLive(_9); - _9 = _1; - StorageLive(_10); - _10 = _2; + _10 = ((_7 as Some).0: usize); StorageLive(_11); - _11 = _5; + _11 = &mut (*_1); StorageLive(_12); + _12 = &(*_2); StorageLive(_13); + _13 = _6; StorageLive(_14); - _14 = _8; -- _13 = move _14 as u32 (IntToInt); -+ _13 = _8 as u32 (IntToInt); - StorageDead(_14); - _12 = Add(move _13, const 1_u32); - StorageDead(_13); StorageLive(_15); - _15 = _3; -- _0 = float_to_exponential_common_exact::(move _9, move _10, move _11, move _12, move _15) -> [return: bb5, unwind continue]; -+ _0 = float_to_exponential_common_exact::(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind continue]; + StorageLive(_16); + _16 = _10; +- _15 = move _16 as u32 (IntToInt); ++ _15 = _10 as u32 (IntToInt); + StorageDead(_16); + _14 = Add(move _15, const 1_u32); + StorageDead(_15); + StorageLive(_17); + _17 = _3; +- _0 = float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, move _17) -> [return: bb5, unwind continue]; ++ _0 = float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, _3) -> [return: bb5, unwind continue]; } bb5: { - StorageDead(_15); + StorageDead(_17); + StorageDead(_14); + StorageDead(_13); StorageDead(_12); StorageDead(_11); - StorageDead(_10); - StorageDead(_9); -- StorageDead(_8); +- StorageDead(_10); + nop; goto -> bb8; } bb6: { - StorageLive(_16); - _16 = _1; - StorageLive(_17); - _17 = _2; StorageLive(_18); - _18 = _5; + _18 = &mut (*_1); StorageLive(_19); - _19 = _3; -- _0 = float_to_exponential_common_shortest::(move _16, move _17, move _18, move _19) -> [return: bb7, unwind continue]; -+ _0 = float_to_exponential_common_shortest::(_1, _2, move _18, _3) -> [return: bb7, unwind continue]; + _19 = &(*_2); + StorageLive(_20); + _20 = _6; + StorageLive(_21); + _21 = _3; +- _0 = float_to_exponential_common_shortest::(move _18, move _19, move _20, move _21) -> [return: bb7, unwind continue]; ++ _0 = float_to_exponential_common_shortest::(move _18, move _19, move _20, _3) -> [return: bb7, unwind continue]; } bb7: { + StorageDead(_21); + StorageDead(_20); StorageDead(_19); StorageDead(_18); - StorageDead(_17); - StorageDead(_16); goto -> bb8; } bb8: { - StorageDead(_5); - StorageDead(_4); StorageDead(_6); + StorageDead(_4); + StorageDead(_7); return; } } diff --git a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff index d43198c99110d..a76033adc45f3 100644 --- a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff @@ -92,13 +92,16 @@ let _89: (); let mut _90: f64; scope 1 { - debug i => _1; +- debug i => _1; ++ debug i => const 1_i64; let _2: u64; scope 2 { - debug u => _2; +- debug u => _2; ++ debug u => const 1_u64; let _3: f64; scope 3 { - debug f => _3; +- debug f => _3; ++ debug f => const 1f64; } } } diff --git a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff index 08b97e13aa0ba..f576f70f80cb0 100644 --- a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff @@ -92,13 +92,16 @@ let _89: (); let mut _90: f64; scope 1 { - debug i => _1; +- debug i => _1; ++ debug i => const 1_i64; let _2: u64; scope 2 { - debug u => _2; +- debug u => _2; ++ debug u => const 1_u64; let _3: f64; scope 3 { - debug f => _3; +- debug f => _3; ++ debug f => const 1f64; } } } diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff index 4b1e337911468..1a3e4ff0617a6 100644 --- a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff @@ -17,7 +17,8 @@ let mut _13: bool; let mut _14: T; scope 1 { - debug a => _2; +- debug a => _2; ++ debug a => const usize::MAX; let _3: T; scope 2 { debug b => _3; diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff index 8abcd7e9387fe..441a1d84eada1 100644 --- a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff @@ -17,7 +17,8 @@ let mut _13: bool; let mut _14: T; scope 1 { - debug a => _2; +- debug a => _2; ++ debug a => const usize::MAX; let _3: T; scope 2 { debug b => _3; diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff index 02bf95840dafb..58f7896d8d2dc 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff @@ -21,7 +21,8 @@ debug g => _4; let _7: {closure@$DIR/gvn.rs:610:19: 610:21}; scope 3 { - debug closure => _7; +- debug closure => _7; ++ debug closure => const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21}; let _8: fn(); scope 4 { debug cf => _8; diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff index c5dcc8a8ec9d8..769687510bdf9 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff @@ -21,7 +21,8 @@ debug g => _4; let _7: {closure@$DIR/gvn.rs:610:19: 610:21}; scope 3 { - debug closure => _7; +- debug closure => _7; ++ debug closure => const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21}; let _8: fn(); scope 4 { debug cf => _8; diff --git a/tests/mir-opt/gvn.references.GVN.panic-abort.diff b/tests/mir-opt/gvn.references.GVN.panic-abort.diff index 7799c61144526..902a3ecbf746a 100644 --- a/tests/mir-opt/gvn.references.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.references.GVN.panic-abort.diff @@ -35,7 +35,8 @@ debug r => _18; let _19: &mut impl Sized; scope 2 { - debug s => _19; +- debug s => _19; ++ debug s => _18; } } diff --git a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff index 880e7913fa94c..e25a3a7d296bd 100644 --- a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff @@ -35,7 +35,8 @@ debug r => _18; let _19: &mut impl Sized; scope 2 { - debug s => _19; +- debug s => _19; ++ debug s => _18; } } diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff index 37915f8578d21..a043d398e94cc 100644 --- a/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff @@ -15,7 +15,8 @@ let mut _11: i32; let mut _12: i32; scope 1 { - debug val => _1; +- debug val => _1; ++ debug val => const 5_i32; let _2: [i32; 10]; scope 2 { debug array => _2; diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff index 37915f8578d21..a043d398e94cc 100644 --- a/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff @@ -15,7 +15,8 @@ let mut _11: i32; let mut _12: i32; scope 1 { - debug val => _1; +- debug val => _1; ++ debug val => const 5_i32; let _2: [i32; 10]; scope 2 { debug array => _2; diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index 31ea237cbec8a..d864726847213 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -631,9 +631,9 @@ fn indirect_static() { /// Verify that having constant index `u64::MAX` does not yield to an overflow in rustc. fn constant_index_overflow(x: &[T]) { // CHECK-LABEL: fn constant_index_overflow( - // CHECK: debug a => [[a:_.*]]; + // CHECK: debug a => const usize::MAX; // CHECK: debug b => [[b:_.*]]; - // CHECK: [[a]] = const usize::MAX; + // CHECK: [[a:_.*]] = const usize::MAX; // CHECK-NOT: = (*_1)[{{.*}} of 0]; // CHECK: [[b]] = (*_1)[[[a]]]; // CHECK-NOT: = (*_1)[{{.*}} of 0]; @@ -644,25 +644,53 @@ fn constant_index_overflow(x: &[T]) { opaque(b) } -fn wide_ptr_ops() { +/// Check that we do not attempt to simplify anything when there is provenance. +fn wide_ptr_provenance() { + // CHECK-LABEL: fn wide_ptr_provenance( let a: *const dyn Send = &1 as &dyn Send; let b: *const dyn Send = &1 as &dyn Send; - let _val = a == b; - let _val = a != b; - let _val = a < b; - let _val = a <= b; - let _val = a > b; - let _val = a >= b; + + // CHECK: [[eqp:_.*]] = Eq([[a:_.*]], [[b:_.*]]); + // CHECK: opaque::(move [[eqp]]) + opaque(a == b); + // CHECK: [[nep:_.*]] = Ne([[a]], [[b]]); + // CHECK: opaque::(move [[nep]]) + opaque(a != b); + // CHECK: [[ltp:_.*]] = Lt([[a]], [[b]]); + // CHECK: opaque::(move [[ltp]]) + opaque(a < b); + // CHECK: [[lep:_.*]] = Le([[a]], [[b]]); + // CHECK: opaque::(move [[lep]]) + opaque(a <= b); + // CHECK: [[gtp:_.*]] = Gt([[a]], [[b]]); + // CHECK: opaque::(move [[gtp]]) + opaque(a > b); + // CHECK: [[gep:_.*]] = Ge([[a]], [[b]]); + // CHECK: opaque::(move [[gep]]) + opaque(a >= b); +} + +/// Check that we do simplify when there is no provenance, and do not ICE. +fn wide_ptr_integer() { + // CHECK-LABEL: fn wide_ptr_integer( + // CHECK: debug a => const + // CHECK: debug b => const let a: *const [u8] = unsafe { transmute((1usize, 1usize)) }; let b: *const [u8] = unsafe { transmute((1usize, 2usize)) }; - opaque(!(a == b)); + // CHECK: opaque::(const false) + opaque(a == b); + // CHECK: opaque::(const true) opaque(a != b); - opaque(a <= b); + // CHECK: opaque::(const true) opaque(a < b); - opaque(!(a >= b)); - opaque(!(a > b)); + // CHECK: opaque::(const true) + opaque(a <= b); + // CHECK: opaque::(const false) + opaque(a > b); + // CHECK: opaque::(const false) + opaque(a >= b); } fn main() { @@ -685,7 +713,8 @@ fn main() { fn_pointers(); indirect_static(); constant_index_overflow(&[5, 3]); - wide_ptr_ops(); + wide_ptr_provenance(); + wide_ptr_integer(); } #[inline(never)] @@ -714,4 +743,5 @@ fn identity(x: T) -> T { // EMIT_MIR gvn.fn_pointers.GVN.diff // EMIT_MIR gvn.indirect_static.GVN.diff // EMIT_MIR gvn.constant_index_overflow.GVN.diff -// EMIT_MIR gvn.wide_ptr_ops.GVN.diff +// EMIT_MIR gvn.wide_ptr_provenance.GVN.diff +// EMIT_MIR gvn.wide_ptr_integer.GVN.diff diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff index f3f9073909e3c..f8f9b2489d70f 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff @@ -53,16 +53,20 @@ debug s => _1; let _4: &str; scope 2 { - debug t => _4; +- debug t => _4; ++ debug t => _1; let _15: &*const u8; let _16: &*const u8; let _29: &[u8]; scope 3 { - debug left_val => _15; - debug right_val => _16; +- debug left_val => _15; +- debug right_val => _16; ++ debug left_val => _9; ++ debug right_val => _12; let _21: core::panicking::AssertKind; scope 4 { - debug kind => _21; +- debug kind => _21; ++ debug kind => const core::panicking::AssertKind::Eq; } } scope 5 { @@ -70,11 +74,14 @@ let _41: &*const u8; let _42: &*const u8; scope 7 { - debug left_val => _41; - debug right_val => _42; +- debug left_val => _41; +- debug right_val => _42; ++ debug left_val => _35; ++ debug right_val => _38; let _47: core::panicking::AssertKind; scope 8 { - debug kind => _47; +- debug kind => _47; ++ debug kind => const core::panicking::AssertKind::Eq; } } } @@ -113,8 +120,9 @@ StorageLive(_7); StorageLive(_8); - StorageLive(_9); +- StorageLive(_10); ++ nop; + nop; - StorageLive(_10); StorageLive(_11); _11 = &(*_1); _10 = core::str::::as_ptr(move _11) -> [return: bb3, unwind unreachable]; @@ -124,8 +132,9 @@ StorageDead(_11); _9 = &_10; - StorageLive(_12); +- StorageLive(_13); ++ nop; + nop; - StorageLive(_13); StorageLive(_14); - _14 = &(*_4); + _14 = &(*_1); @@ -150,11 +159,12 @@ StorageLive(_17); StorageLive(_18); - _18 = (*_15); -+ _18 = (*_9); ++ _18 = _10; StorageLive(_19); - _19 = (*_16); -+ _19 = (*_12); - _17 = Eq(move _18, move _19); +- _17 = Eq(move _18, move _19); ++ _19 = _13; ++ _17 = Eq(_10, _13); switchInt(move _17) -> [0: bb6, otherwise: bb5]; } @@ -165,8 +175,10 @@ StorageDead(_17); StorageDead(_16); StorageDead(_15); - StorageDead(_13); - StorageDead(_10); +- StorageDead(_13); +- StorageDead(_10); ++ nop; ++ nop; StorageDead(_8); StorageDead(_7); - StorageLive(_29); @@ -215,8 +227,9 @@ StorageLive(_33); StorageLive(_34); - StorageLive(_35); +- StorageLive(_36); ++ nop; + nop; - StorageLive(_36); StorageLive(_37); _37 = &(*_1); _36 = core::str::::as_ptr(move _37) -> [return: bb8, unwind unreachable]; @@ -226,8 +239,9 @@ StorageDead(_37); _35 = &_36; - StorageLive(_38); +- StorageLive(_39); ++ nop; + nop; - StorageLive(_39); StorageLive(_40); _40 = &(*_29); _39 = core::slice::::as_ptr(move _40) -> [return: bb9, unwind unreachable]; @@ -251,11 +265,12 @@ StorageLive(_43); StorageLive(_44); - _44 = (*_41); -+ _44 = (*_35); ++ _44 = _36; StorageLive(_45); - _45 = (*_42); -+ _45 = (*_38); - _43 = Eq(move _44, move _45); +- _43 = Eq(move _44, move _45); ++ _45 = _39; ++ _43 = Eq(_36, _39); switchInt(move _43) -> [0: bb11, otherwise: bb10]; } @@ -266,8 +281,10 @@ StorageDead(_43); StorageDead(_42); StorageDead(_41); - StorageDead(_39); - StorageDead(_36); +- StorageDead(_39); +- StorageDead(_36); ++ nop; ++ nop; StorageDead(_34); StorageDead(_33); _0 = const (); diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff index 383152cce5e29..79156774fe14d 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff @@ -53,16 +53,20 @@ debug s => _1; let _4: &str; scope 2 { - debug t => _4; +- debug t => _4; ++ debug t => _1; let _15: &*const u8; let _16: &*const u8; let _29: &[u8]; scope 3 { - debug left_val => _15; - debug right_val => _16; +- debug left_val => _15; +- debug right_val => _16; ++ debug left_val => _9; ++ debug right_val => _12; let _21: core::panicking::AssertKind; scope 4 { - debug kind => _21; +- debug kind => _21; ++ debug kind => const core::panicking::AssertKind::Eq; } } scope 5 { @@ -70,11 +74,14 @@ let _41: &*const u8; let _42: &*const u8; scope 7 { - debug left_val => _41; - debug right_val => _42; +- debug left_val => _41; +- debug right_val => _42; ++ debug left_val => _35; ++ debug right_val => _38; let _47: core::panicking::AssertKind; scope 8 { - debug kind => _47; +- debug kind => _47; ++ debug kind => const core::panicking::AssertKind::Eq; } } } @@ -113,8 +120,9 @@ StorageLive(_7); StorageLive(_8); - StorageLive(_9); +- StorageLive(_10); ++ nop; + nop; - StorageLive(_10); StorageLive(_11); _11 = &(*_1); _10 = core::str::::as_ptr(move _11) -> [return: bb3, unwind continue]; @@ -124,8 +132,9 @@ StorageDead(_11); _9 = &_10; - StorageLive(_12); +- StorageLive(_13); ++ nop; + nop; - StorageLive(_13); StorageLive(_14); - _14 = &(*_4); + _14 = &(*_1); @@ -150,11 +159,12 @@ StorageLive(_17); StorageLive(_18); - _18 = (*_15); -+ _18 = (*_9); ++ _18 = _10; StorageLive(_19); - _19 = (*_16); -+ _19 = (*_12); - _17 = Eq(move _18, move _19); +- _17 = Eq(move _18, move _19); ++ _19 = _13; ++ _17 = Eq(_10, _13); switchInt(move _17) -> [0: bb6, otherwise: bb5]; } @@ -165,8 +175,10 @@ StorageDead(_17); StorageDead(_16); StorageDead(_15); - StorageDead(_13); - StorageDead(_10); +- StorageDead(_13); +- StorageDead(_10); ++ nop; ++ nop; StorageDead(_8); StorageDead(_7); - StorageLive(_29); @@ -215,8 +227,9 @@ StorageLive(_33); StorageLive(_34); - StorageLive(_35); +- StorageLive(_36); ++ nop; + nop; - StorageLive(_36); StorageLive(_37); _37 = &(*_1); _36 = core::str::::as_ptr(move _37) -> [return: bb8, unwind continue]; @@ -226,8 +239,9 @@ StorageDead(_37); _35 = &_36; - StorageLive(_38); +- StorageLive(_39); ++ nop; + nop; - StorageLive(_39); StorageLive(_40); _40 = &(*_29); _39 = core::slice::::as_ptr(move _40) -> [return: bb9, unwind continue]; @@ -251,11 +265,12 @@ StorageLive(_43); StorageLive(_44); - _44 = (*_41); -+ _44 = (*_35); ++ _44 = _36; StorageLive(_45); - _45 = (*_42); -+ _45 = (*_38); - _43 = Eq(move _44, move _45); +- _43 = Eq(move _44, move _45); ++ _45 = _39; ++ _43 = Eq(_36, _39); switchInt(move _43) -> [0: bb11, otherwise: bb10]; } @@ -266,8 +281,10 @@ StorageDead(_43); StorageDead(_42); StorageDead(_41); - StorageDead(_39); - StorageDead(_36); +- StorageDead(_39); +- StorageDead(_36); ++ nop; ++ nop; StorageDead(_34); StorageDead(_33); _0 = const (); diff --git a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff new file mode 100644 index 0000000000000..47ed90b49be14 --- /dev/null +++ b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff @@ -0,0 +1,194 @@ +- // MIR for `wide_ptr_integer` before GVN ++ // MIR for `wide_ptr_integer` after GVN + + fn wide_ptr_integer() -> () { + let mut _0: (); + let _1: *const [u8]; + let mut _2: (usize, usize); + let mut _4: (usize, usize); + let _5: (); + let mut _6: bool; + let mut _7: *const [u8]; + let mut _8: *const [u8]; + let _9: (); + let mut _10: bool; + let mut _11: *const [u8]; + let mut _12: *const [u8]; + let _13: (); + let mut _14: bool; + let mut _15: *const [u8]; + let mut _16: *const [u8]; + let _17: (); + let mut _18: bool; + let mut _19: *const [u8]; + let mut _20: *const [u8]; + let _21: (); + let mut _22: bool; + let mut _23: *const [u8]; + let mut _24: *const [u8]; + let _25: (); + let mut _26: bool; + let mut _27: *const [u8]; + let mut _28: *const [u8]; + scope 1 { +- debug a => _1; ++ debug a => const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + let _3: *const [u8]; + scope 3 { +- debug b => _3; ++ debug b => const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + } + scope 4 { + } + } + scope 2 { + } + + bb0: { +- StorageLive(_1); ++ nop; + StorageLive(_2); +- _2 = (const 1_usize, const 1_usize); +- _1 = move _2 as *const [u8] (Transmute); ++ _2 = const (1_usize, 1_usize); ++ _1 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageDead(_2); +- StorageLive(_3); ++ nop; + StorageLive(_4); +- _4 = (const 1_usize, const 2_usize); +- _3 = move _4 as *const [u8] (Transmute); ++ _4 = const (1_usize, 2_usize); ++ _3 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + StorageDead(_4); + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); +- _7 = _1; ++ _7 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_8); +- _8 = _3; +- _6 = Eq(move _7, move _8); ++ _8 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _6 = const false; + StorageDead(_8); + StorageDead(_7); +- _5 = opaque::(move _6) -> [return: bb1, unwind unreachable]; ++ _5 = opaque::(const false) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_6); + StorageDead(_5); + StorageLive(_9); + StorageLive(_10); + StorageLive(_11); +- _11 = _1; ++ _11 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_12); +- _12 = _3; +- _10 = Ne(move _11, move _12); ++ _12 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _10 = const true; + StorageDead(_12); + StorageDead(_11); +- _9 = opaque::(move _10) -> [return: bb2, unwind unreachable]; ++ _9 = opaque::(const true) -> [return: bb2, unwind unreachable]; + } + + bb2: { + StorageDead(_10); + StorageDead(_9); + StorageLive(_13); + StorageLive(_14); + StorageLive(_15); +- _15 = _1; ++ _15 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_16); +- _16 = _3; +- _14 = Lt(move _15, move _16); ++ _16 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _14 = const true; + StorageDead(_16); + StorageDead(_15); +- _13 = opaque::(move _14) -> [return: bb3, unwind unreachable]; ++ _13 = opaque::(const true) -> [return: bb3, unwind unreachable]; + } + + bb3: { + StorageDead(_14); + StorageDead(_13); + StorageLive(_17); + StorageLive(_18); + StorageLive(_19); +- _19 = _1; ++ _19 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_20); +- _20 = _3; +- _18 = Le(move _19, move _20); ++ _20 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _18 = const true; + StorageDead(_20); + StorageDead(_19); +- _17 = opaque::(move _18) -> [return: bb4, unwind unreachable]; ++ _17 = opaque::(const true) -> [return: bb4, unwind unreachable]; + } + + bb4: { + StorageDead(_18); + StorageDead(_17); + StorageLive(_21); + StorageLive(_22); + StorageLive(_23); +- _23 = _1; ++ _23 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_24); +- _24 = _3; +- _22 = Gt(move _23, move _24); ++ _24 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _22 = const false; + StorageDead(_24); + StorageDead(_23); +- _21 = opaque::(move _22) -> [return: bb5, unwind unreachable]; ++ _21 = opaque::(const false) -> [return: bb5, unwind unreachable]; + } + + bb5: { + StorageDead(_22); + StorageDead(_21); + StorageLive(_25); + StorageLive(_26); + StorageLive(_27); +- _27 = _1; ++ _27 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_28); +- _28 = _3; +- _26 = Ge(move _27, move _28); ++ _28 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _26 = const false; + StorageDead(_28); + StorageDead(_27); +- _25 = opaque::(move _26) -> [return: bb6, unwind unreachable]; ++ _25 = opaque::(const false) -> [return: bb6, unwind unreachable]; + } + + bb6: { + StorageDead(_26); + StorageDead(_25); + _0 = const (); +- StorageDead(_3); +- StorageDead(_1); ++ nop; ++ nop; + return; + } ++ } ++ ++ ALLOC1 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................ ++ } ++ ++ ALLOC0 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................ + } + diff --git a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff new file mode 100644 index 0000000000000..dcc1b2bcd564d --- /dev/null +++ b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff @@ -0,0 +1,194 @@ +- // MIR for `wide_ptr_integer` before GVN ++ // MIR for `wide_ptr_integer` after GVN + + fn wide_ptr_integer() -> () { + let mut _0: (); + let _1: *const [u8]; + let mut _2: (usize, usize); + let mut _4: (usize, usize); + let _5: (); + let mut _6: bool; + let mut _7: *const [u8]; + let mut _8: *const [u8]; + let _9: (); + let mut _10: bool; + let mut _11: *const [u8]; + let mut _12: *const [u8]; + let _13: (); + let mut _14: bool; + let mut _15: *const [u8]; + let mut _16: *const [u8]; + let _17: (); + let mut _18: bool; + let mut _19: *const [u8]; + let mut _20: *const [u8]; + let _21: (); + let mut _22: bool; + let mut _23: *const [u8]; + let mut _24: *const [u8]; + let _25: (); + let mut _26: bool; + let mut _27: *const [u8]; + let mut _28: *const [u8]; + scope 1 { +- debug a => _1; ++ debug a => const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + let _3: *const [u8]; + scope 3 { +- debug b => _3; ++ debug b => const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + } + scope 4 { + } + } + scope 2 { + } + + bb0: { +- StorageLive(_1); ++ nop; + StorageLive(_2); +- _2 = (const 1_usize, const 1_usize); +- _1 = move _2 as *const [u8] (Transmute); ++ _2 = const (1_usize, 1_usize); ++ _1 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageDead(_2); +- StorageLive(_3); ++ nop; + StorageLive(_4); +- _4 = (const 1_usize, const 2_usize); +- _3 = move _4 as *const [u8] (Transmute); ++ _4 = const (1_usize, 2_usize); ++ _3 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + StorageDead(_4); + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); +- _7 = _1; ++ _7 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_8); +- _8 = _3; +- _6 = Eq(move _7, move _8); ++ _8 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _6 = const false; + StorageDead(_8); + StorageDead(_7); +- _5 = opaque::(move _6) -> [return: bb1, unwind continue]; ++ _5 = opaque::(const false) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_6); + StorageDead(_5); + StorageLive(_9); + StorageLive(_10); + StorageLive(_11); +- _11 = _1; ++ _11 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_12); +- _12 = _3; +- _10 = Ne(move _11, move _12); ++ _12 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _10 = const true; + StorageDead(_12); + StorageDead(_11); +- _9 = opaque::(move _10) -> [return: bb2, unwind continue]; ++ _9 = opaque::(const true) -> [return: bb2, unwind continue]; + } + + bb2: { + StorageDead(_10); + StorageDead(_9); + StorageLive(_13); + StorageLive(_14); + StorageLive(_15); +- _15 = _1; ++ _15 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_16); +- _16 = _3; +- _14 = Lt(move _15, move _16); ++ _16 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _14 = const true; + StorageDead(_16); + StorageDead(_15); +- _13 = opaque::(move _14) -> [return: bb3, unwind continue]; ++ _13 = opaque::(const true) -> [return: bb3, unwind continue]; + } + + bb3: { + StorageDead(_14); + StorageDead(_13); + StorageLive(_17); + StorageLive(_18); + StorageLive(_19); +- _19 = _1; ++ _19 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_20); +- _20 = _3; +- _18 = Le(move _19, move _20); ++ _20 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _18 = const true; + StorageDead(_20); + StorageDead(_19); +- _17 = opaque::(move _18) -> [return: bb4, unwind continue]; ++ _17 = opaque::(const true) -> [return: bb4, unwind continue]; + } + + bb4: { + StorageDead(_18); + StorageDead(_17); + StorageLive(_21); + StorageLive(_22); + StorageLive(_23); +- _23 = _1; ++ _23 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_24); +- _24 = _3; +- _22 = Gt(move _23, move _24); ++ _24 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _22 = const false; + StorageDead(_24); + StorageDead(_23); +- _21 = opaque::(move _22) -> [return: bb5, unwind continue]; ++ _21 = opaque::(const false) -> [return: bb5, unwind continue]; + } + + bb5: { + StorageDead(_22); + StorageDead(_21); + StorageLive(_25); + StorageLive(_26); + StorageLive(_27); +- _27 = _1; ++ _27 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; + StorageLive(_28); +- _28 = _3; +- _26 = Ge(move _27, move _28); ++ _28 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; ++ _26 = const false; + StorageDead(_28); + StorageDead(_27); +- _25 = opaque::(move _26) -> [return: bb6, unwind continue]; ++ _25 = opaque::(const false) -> [return: bb6, unwind continue]; + } + + bb6: { + StorageDead(_26); + StorageDead(_25); + _0 = const (); +- StorageDead(_3); +- StorageDead(_1); ++ nop; ++ nop; + return; + } ++ } ++ ++ ALLOC1 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................ ++ } ++ ++ ALLOC0 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................ + } + diff --git a/tests/mir-opt/gvn.wide_ptr_ops.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_ops.GVN.panic-abort.diff deleted file mode 100644 index e49d759b8fc31..0000000000000 --- a/tests/mir-opt/gvn.wide_ptr_ops.GVN.panic-abort.diff +++ /dev/null @@ -1,386 +0,0 @@ -- // MIR for `wide_ptr_ops` before GVN -+ // MIR for `wide_ptr_ops` after GVN - - fn wide_ptr_ops() -> () { - let mut _0: (); - let _1: *const dyn std::marker::Send; - let mut _2: *const dyn std::marker::Send; - let _3: &dyn std::marker::Send; - let mut _4: &i32; - let _5: &i32; - let _6: i32; - let mut _8: *const dyn std::marker::Send; - let _9: &dyn std::marker::Send; - let mut _10: &i32; - let _11: &i32; - let _12: i32; - let mut _14: *const dyn std::marker::Send; - let mut _15: *const dyn std::marker::Send; - let mut _16: *const dyn std::marker::Send; - let mut _18: *const dyn std::marker::Send; - let mut _19: *const dyn std::marker::Send; - let mut _20: *const dyn std::marker::Send; - let mut _22: *const dyn std::marker::Send; - let mut _23: *const dyn std::marker::Send; - let mut _24: *const dyn std::marker::Send; - let mut _26: *const dyn std::marker::Send; - let mut _27: *const dyn std::marker::Send; - let mut _28: *const dyn std::marker::Send; - let mut _30: *const dyn std::marker::Send; - let mut _31: *const dyn std::marker::Send; - let mut _32: *const dyn std::marker::Send; - let mut _34: *const dyn std::marker::Send; - let mut _35: *const dyn std::marker::Send; - let mut _36: *const dyn std::marker::Send; - let mut _38: (usize, usize); - let mut _40: (usize, usize); - let _41: (); - let mut _42: bool; - let mut _43: bool; - let mut _44: *const [u8]; - let mut _45: *const [u8]; - let _46: (); - let mut _47: bool; - let mut _48: *const [u8]; - let mut _49: *const [u8]; - let _50: (); - let mut _51: bool; - let mut _52: *const [u8]; - let mut _53: *const [u8]; - let _54: (); - let mut _55: bool; - let mut _56: *const [u8]; - let mut _57: *const [u8]; - let _58: (); - let mut _59: bool; - let mut _60: bool; - let mut _61: *const [u8]; - let mut _62: *const [u8]; - let _63: (); - let mut _64: bool; - let mut _65: bool; - let mut _66: *const [u8]; - let mut _67: *const [u8]; - let mut _69: &i32; - scope 1 { - debug a => _1; - let _7: *const dyn std::marker::Send; - let mut _68: &i32; - scope 2 { - debug b => _7; - let _13: bool; - scope 3 { - debug _val => _13; - let _17: bool; - scope 4 { - debug _val => _17; - let _21: bool; - scope 5 { - debug _val => _21; - let _25: bool; - scope 6 { - debug _val => _25; - let _29: bool; - scope 7 { - debug _val => _29; - let _33: bool; - scope 8 { - debug _val => _33; - let _37: *const [u8]; - scope 9 { - debug a => _37; - let _39: *const [u8]; - scope 11 { - debug b => _39; - } - scope 12 { - } - } - scope 10 { - } - } - } - } - } - } - } - } - } - - bb0: { -- StorageLive(_1); -+ nop; - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); - _69 = const _; - _5 = &(*_69); - _4 = &(*_5); - _3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_4); - _2 = &raw const (*_3); - _1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_2); - StorageDead(_5); - StorageDead(_3); -- StorageLive(_7); -+ nop; - StorageLive(_8); - StorageLive(_9); - StorageLive(_10); - StorageLive(_11); - _68 = const _; - _11 = &(*_68); - _10 = &(*_11); - _9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_10); - _8 = &raw const (*_9); - _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_8); - StorageDead(_11); - StorageDead(_9); - StorageLive(_13); - StorageLive(_14); - _14 = _1; -- StorageLive(_15); -+ nop; - StorageLive(_16); - _16 = _7; -- _15 = move _16 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _15 = _7 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_16); -- _13 = Eq(move _14, move _15); -- StorageDead(_15); -+ _13 = Eq(_1, _15); -+ nop; - StorageDead(_14); - StorageLive(_17); - StorageLive(_18); - _18 = _1; - StorageLive(_19); - StorageLive(_20); - _20 = _7; -- _19 = move _20 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _19 = _15; - StorageDead(_20); -- _17 = Ne(move _18, move _19); -+ _17 = Ne(_1, _15); - StorageDead(_19); - StorageDead(_18); - StorageLive(_21); - StorageLive(_22); - _22 = _1; - StorageLive(_23); - StorageLive(_24); - _24 = _7; -- _23 = move _24 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _23 = _15; - StorageDead(_24); -- _21 = Lt(move _22, move _23); -+ _21 = Lt(_1, _15); - StorageDead(_23); - StorageDead(_22); - StorageLive(_25); - StorageLive(_26); - _26 = _1; - StorageLive(_27); - StorageLive(_28); - _28 = _7; -- _27 = move _28 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _27 = _15; - StorageDead(_28); -- _25 = Le(move _26, move _27); -+ _25 = Le(_1, _15); - StorageDead(_27); - StorageDead(_26); - StorageLive(_29); - StorageLive(_30); - _30 = _1; - StorageLive(_31); - StorageLive(_32); - _32 = _7; -- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _31 = _15; - StorageDead(_32); -- _29 = Gt(move _30, move _31); -+ _29 = Gt(_1, _15); - StorageDead(_31); - StorageDead(_30); - StorageLive(_33); - StorageLive(_34); - _34 = _1; - StorageLive(_35); - StorageLive(_36); - _36 = _7; -- _35 = move _36 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _35 = _15; - StorageDead(_36); -- _33 = Ge(move _34, move _35); -+ _33 = Ge(_1, _15); - StorageDead(_35); - StorageDead(_34); -- StorageLive(_37); -+ nop; - StorageLive(_38); -- _38 = (const 1_usize, const 1_usize); -- _37 = move _38 as *const [u8] (Transmute); -+ _38 = const (1_usize, 1_usize); -+ _37 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageDead(_38); -- StorageLive(_39); -+ nop; - StorageLive(_40); -- _40 = (const 1_usize, const 2_usize); -- _39 = move _40 as *const [u8] (Transmute); -+ _40 = const (1_usize, 2_usize); -+ _39 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; - StorageDead(_40); - StorageLive(_41); -- StorageLive(_42); -+ nop; - StorageLive(_43); - StorageLive(_44); -- _44 = _37; -+ _44 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_45); -- _45 = _39; -- _43 = Eq(move _44, move _45); -+ _45 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _43 = Eq(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_45); - StorageDead(_44); - _42 = Not(move _43); - StorageDead(_43); -- _41 = opaque::(move _42) -> [return: bb1, unwind unreachable]; -+ _41 = opaque::(_42) -> [return: bb1, unwind unreachable]; - } - - bb1: { -- StorageDead(_42); -+ nop; - StorageDead(_41); - StorageLive(_46); - StorageLive(_47); - StorageLive(_48); -- _48 = _37; -+ _48 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_49); -- _49 = _39; -- _47 = Ne(move _48, move _49); -+ _49 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _47 = _42; - StorageDead(_49); - StorageDead(_48); -- _46 = opaque::(move _47) -> [return: bb2, unwind unreachable]; -+ _46 = opaque::(_42) -> [return: bb2, unwind unreachable]; - } - - bb2: { - StorageDead(_47); - StorageDead(_46); - StorageLive(_50); - StorageLive(_51); - StorageLive(_52); -- _52 = _37; -+ _52 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_53); -- _53 = _39; -- _51 = Le(move _52, move _53); -+ _53 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _51 = Le(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_53); - StorageDead(_52); - _50 = opaque::(move _51) -> [return: bb3, unwind unreachable]; - } - - bb3: { - StorageDead(_51); - StorageDead(_50); - StorageLive(_54); - StorageLive(_55); - StorageLive(_56); -- _56 = _37; -+ _56 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_57); -- _57 = _39; -- _55 = Lt(move _56, move _57); -+ _57 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _55 = Lt(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_57); - StorageDead(_56); - _54 = opaque::(move _55) -> [return: bb4, unwind unreachable]; - } - - bb4: { - StorageDead(_55); - StorageDead(_54); - StorageLive(_58); - StorageLive(_59); - StorageLive(_60); - StorageLive(_61); -- _61 = _37; -+ _61 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_62); -- _62 = _39; -- _60 = Ge(move _61, move _62); -+ _62 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _60 = Ge(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_62); - StorageDead(_61); - _59 = Not(move _60); - StorageDead(_60); - _58 = opaque::(move _59) -> [return: bb5, unwind unreachable]; - } - - bb5: { - StorageDead(_59); - StorageDead(_58); - StorageLive(_63); - StorageLive(_64); - StorageLive(_65); - StorageLive(_66); -- _66 = _37; -+ _66 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_67); -- _67 = _39; -- _65 = Gt(move _66, move _67); -+ _67 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _65 = Gt(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_67); - StorageDead(_66); - _64 = Not(move _65); - StorageDead(_65); - _63 = opaque::(move _64) -> [return: bb6, unwind unreachable]; - } - - bb6: { - StorageDead(_64); - StorageDead(_63); - _0 = const (); -- StorageDead(_39); -- StorageDead(_37); -+ nop; -+ nop; - StorageDead(_33); - StorageDead(_29); - StorageDead(_25); - StorageDead(_21); - StorageDead(_17); - StorageDead(_13); -- StorageDead(_7); -- StorageDead(_1); -+ nop; -+ nop; - return; - } -+ } -+ -+ ALLOC1 (size: 16, align: 8) { -+ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................ -+ } -+ -+ ALLOC0 (size: 16, align: 8) { -+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................ - } - diff --git a/tests/mir-opt/gvn.wide_ptr_ops.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_ops.GVN.panic-unwind.diff deleted file mode 100644 index 4e5608a4425f7..0000000000000 --- a/tests/mir-opt/gvn.wide_ptr_ops.GVN.panic-unwind.diff +++ /dev/null @@ -1,386 +0,0 @@ -- // MIR for `wide_ptr_ops` before GVN -+ // MIR for `wide_ptr_ops` after GVN - - fn wide_ptr_ops() -> () { - let mut _0: (); - let _1: *const dyn std::marker::Send; - let mut _2: *const dyn std::marker::Send; - let _3: &dyn std::marker::Send; - let mut _4: &i32; - let _5: &i32; - let _6: i32; - let mut _8: *const dyn std::marker::Send; - let _9: &dyn std::marker::Send; - let mut _10: &i32; - let _11: &i32; - let _12: i32; - let mut _14: *const dyn std::marker::Send; - let mut _15: *const dyn std::marker::Send; - let mut _16: *const dyn std::marker::Send; - let mut _18: *const dyn std::marker::Send; - let mut _19: *const dyn std::marker::Send; - let mut _20: *const dyn std::marker::Send; - let mut _22: *const dyn std::marker::Send; - let mut _23: *const dyn std::marker::Send; - let mut _24: *const dyn std::marker::Send; - let mut _26: *const dyn std::marker::Send; - let mut _27: *const dyn std::marker::Send; - let mut _28: *const dyn std::marker::Send; - let mut _30: *const dyn std::marker::Send; - let mut _31: *const dyn std::marker::Send; - let mut _32: *const dyn std::marker::Send; - let mut _34: *const dyn std::marker::Send; - let mut _35: *const dyn std::marker::Send; - let mut _36: *const dyn std::marker::Send; - let mut _38: (usize, usize); - let mut _40: (usize, usize); - let _41: (); - let mut _42: bool; - let mut _43: bool; - let mut _44: *const [u8]; - let mut _45: *const [u8]; - let _46: (); - let mut _47: bool; - let mut _48: *const [u8]; - let mut _49: *const [u8]; - let _50: (); - let mut _51: bool; - let mut _52: *const [u8]; - let mut _53: *const [u8]; - let _54: (); - let mut _55: bool; - let mut _56: *const [u8]; - let mut _57: *const [u8]; - let _58: (); - let mut _59: bool; - let mut _60: bool; - let mut _61: *const [u8]; - let mut _62: *const [u8]; - let _63: (); - let mut _64: bool; - let mut _65: bool; - let mut _66: *const [u8]; - let mut _67: *const [u8]; - let mut _69: &i32; - scope 1 { - debug a => _1; - let _7: *const dyn std::marker::Send; - let mut _68: &i32; - scope 2 { - debug b => _7; - let _13: bool; - scope 3 { - debug _val => _13; - let _17: bool; - scope 4 { - debug _val => _17; - let _21: bool; - scope 5 { - debug _val => _21; - let _25: bool; - scope 6 { - debug _val => _25; - let _29: bool; - scope 7 { - debug _val => _29; - let _33: bool; - scope 8 { - debug _val => _33; - let _37: *const [u8]; - scope 9 { - debug a => _37; - let _39: *const [u8]; - scope 11 { - debug b => _39; - } - scope 12 { - } - } - scope 10 { - } - } - } - } - } - } - } - } - } - - bb0: { -- StorageLive(_1); -+ nop; - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); - _69 = const _; - _5 = &(*_69); - _4 = &(*_5); - _3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_4); - _2 = &raw const (*_3); - _1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_2); - StorageDead(_5); - StorageDead(_3); -- StorageLive(_7); -+ nop; - StorageLive(_8); - StorageLive(_9); - StorageLive(_10); - StorageLive(_11); - _68 = const _; - _11 = &(*_68); - _10 = &(*_11); - _9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_10); - _8 = &raw const (*_9); - _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_8); - StorageDead(_11); - StorageDead(_9); - StorageLive(_13); - StorageLive(_14); - _14 = _1; -- StorageLive(_15); -+ nop; - StorageLive(_16); - _16 = _7; -- _15 = move _16 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _15 = _7 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_16); -- _13 = Eq(move _14, move _15); -- StorageDead(_15); -+ _13 = Eq(_1, _15); -+ nop; - StorageDead(_14); - StorageLive(_17); - StorageLive(_18); - _18 = _1; - StorageLive(_19); - StorageLive(_20); - _20 = _7; -- _19 = move _20 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _19 = _15; - StorageDead(_20); -- _17 = Ne(move _18, move _19); -+ _17 = Ne(_1, _15); - StorageDead(_19); - StorageDead(_18); - StorageLive(_21); - StorageLive(_22); - _22 = _1; - StorageLive(_23); - StorageLive(_24); - _24 = _7; -- _23 = move _24 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _23 = _15; - StorageDead(_24); -- _21 = Lt(move _22, move _23); -+ _21 = Lt(_1, _15); - StorageDead(_23); - StorageDead(_22); - StorageLive(_25); - StorageLive(_26); - _26 = _1; - StorageLive(_27); - StorageLive(_28); - _28 = _7; -- _27 = move _28 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _27 = _15; - StorageDead(_28); -- _25 = Le(move _26, move _27); -+ _25 = Le(_1, _15); - StorageDead(_27); - StorageDead(_26); - StorageLive(_29); - StorageLive(_30); - _30 = _1; - StorageLive(_31); - StorageLive(_32); - _32 = _7; -- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _31 = _15; - StorageDead(_32); -- _29 = Gt(move _30, move _31); -+ _29 = Gt(_1, _15); - StorageDead(_31); - StorageDead(_30); - StorageLive(_33); - StorageLive(_34); - _34 = _1; - StorageLive(_35); - StorageLive(_36); - _36 = _7; -- _35 = move _36 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _35 = _15; - StorageDead(_36); -- _33 = Ge(move _34, move _35); -+ _33 = Ge(_1, _15); - StorageDead(_35); - StorageDead(_34); -- StorageLive(_37); -+ nop; - StorageLive(_38); -- _38 = (const 1_usize, const 1_usize); -- _37 = move _38 as *const [u8] (Transmute); -+ _38 = const (1_usize, 1_usize); -+ _37 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageDead(_38); -- StorageLive(_39); -+ nop; - StorageLive(_40); -- _40 = (const 1_usize, const 2_usize); -- _39 = move _40 as *const [u8] (Transmute); -+ _40 = const (1_usize, 2_usize); -+ _39 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; - StorageDead(_40); - StorageLive(_41); -- StorageLive(_42); -+ nop; - StorageLive(_43); - StorageLive(_44); -- _44 = _37; -+ _44 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_45); -- _45 = _39; -- _43 = Eq(move _44, move _45); -+ _45 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _43 = Eq(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_45); - StorageDead(_44); - _42 = Not(move _43); - StorageDead(_43); -- _41 = opaque::(move _42) -> [return: bb1, unwind continue]; -+ _41 = opaque::(_42) -> [return: bb1, unwind continue]; - } - - bb1: { -- StorageDead(_42); -+ nop; - StorageDead(_41); - StorageLive(_46); - StorageLive(_47); - StorageLive(_48); -- _48 = _37; -+ _48 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_49); -- _49 = _39; -- _47 = Ne(move _48, move _49); -+ _49 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _47 = _42; - StorageDead(_49); - StorageDead(_48); -- _46 = opaque::(move _47) -> [return: bb2, unwind continue]; -+ _46 = opaque::(_42) -> [return: bb2, unwind continue]; - } - - bb2: { - StorageDead(_47); - StorageDead(_46); - StorageLive(_50); - StorageLive(_51); - StorageLive(_52); -- _52 = _37; -+ _52 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_53); -- _53 = _39; -- _51 = Le(move _52, move _53); -+ _53 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _51 = Le(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_53); - StorageDead(_52); - _50 = opaque::(move _51) -> [return: bb3, unwind continue]; - } - - bb3: { - StorageDead(_51); - StorageDead(_50); - StorageLive(_54); - StorageLive(_55); - StorageLive(_56); -- _56 = _37; -+ _56 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_57); -- _57 = _39; -- _55 = Lt(move _56, move _57); -+ _57 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _55 = Lt(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_57); - StorageDead(_56); - _54 = opaque::(move _55) -> [return: bb4, unwind continue]; - } - - bb4: { - StorageDead(_55); - StorageDead(_54); - StorageLive(_58); - StorageLive(_59); - StorageLive(_60); - StorageLive(_61); -- _61 = _37; -+ _61 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_62); -- _62 = _39; -- _60 = Ge(move _61, move _62); -+ _62 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _60 = Ge(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_62); - StorageDead(_61); - _59 = Not(move _60); - StorageDead(_60); - _58 = opaque::(move _59) -> [return: bb5, unwind continue]; - } - - bb5: { - StorageDead(_59); - StorageDead(_58); - StorageLive(_63); - StorageLive(_64); - StorageLive(_65); - StorageLive(_66); -- _66 = _37; -+ _66 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; - StorageLive(_67); -- _67 = _39; -- _65 = Gt(move _66, move _67); -+ _67 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; -+ _65 = Gt(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]); - StorageDead(_67); - StorageDead(_66); - _64 = Not(move _65); - StorageDead(_65); - _63 = opaque::(move _64) -> [return: bb6, unwind continue]; - } - - bb6: { - StorageDead(_64); - StorageDead(_63); - _0 = const (); -- StorageDead(_39); -- StorageDead(_37); -+ nop; -+ nop; - StorageDead(_33); - StorageDead(_29); - StorageDead(_25); - StorageDead(_21); - StorageDead(_17); - StorageDead(_13); -- StorageDead(_7); -- StorageDead(_1); -+ nop; -+ nop; - return; - } -+ } -+ -+ ALLOC1 (size: 16, align: 8) { -+ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................ -+ } -+ -+ ALLOC0 (size: 16, align: 8) { -+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................ - } - diff --git a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff new file mode 100644 index 0000000000000..d61c4282787e1 --- /dev/null +++ b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff @@ -0,0 +1,234 @@ +- // MIR for `wide_ptr_provenance` before GVN ++ // MIR for `wide_ptr_provenance` after GVN + + fn wide_ptr_provenance() -> () { + let mut _0: (); + let _1: *const dyn std::marker::Send; + let mut _2: *const dyn std::marker::Send; + let _3: &dyn std::marker::Send; + let mut _4: &i32; + let _5: &i32; + let _6: i32; + let mut _8: *const dyn std::marker::Send; + let _9: &dyn std::marker::Send; + let mut _10: &i32; + let _11: &i32; + let _12: i32; + let _13: (); + let mut _14: bool; + let mut _15: *const dyn std::marker::Send; + let mut _16: *const dyn std::marker::Send; + let mut _17: *const dyn std::marker::Send; + let _18: (); + let mut _19: bool; + let mut _20: *const dyn std::marker::Send; + let mut _21: *const dyn std::marker::Send; + let mut _22: *const dyn std::marker::Send; + let _23: (); + let mut _24: bool; + let mut _25: *const dyn std::marker::Send; + let mut _26: *const dyn std::marker::Send; + let mut _27: *const dyn std::marker::Send; + let _28: (); + let mut _29: bool; + let mut _30: *const dyn std::marker::Send; + let mut _31: *const dyn std::marker::Send; + let mut _32: *const dyn std::marker::Send; + let _33: (); + let mut _34: bool; + let mut _35: *const dyn std::marker::Send; + let mut _36: *const dyn std::marker::Send; + let mut _37: *const dyn std::marker::Send; + let _38: (); + let mut _39: bool; + let mut _40: *const dyn std::marker::Send; + let mut _41: *const dyn std::marker::Send; + let mut _42: *const dyn std::marker::Send; + let mut _44: &i32; + scope 1 { +- debug a => _1; ++ debug a => _2; + let _7: *const dyn std::marker::Send; + let mut _43: &i32; + scope 2 { +- debug b => _7; ++ debug b => _8; + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + _44 = const _; + _5 = &(*_44); + _4 = &(*_5); + _3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize)); + StorageDead(_4); + _2 = &raw const (*_3); +- _1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize)); +- StorageDead(_2); ++ _1 = _2; ++ nop; + StorageDead(_5); + StorageDead(_3); + StorageLive(_7); +- StorageLive(_8); ++ nop; + StorageLive(_9); + StorageLive(_10); + StorageLive(_11); + _43 = const _; + _11 = &(*_43); + _10 = &(*_11); + _9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize)); + StorageDead(_10); + _8 = &raw const (*_9); +- _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize)); +- StorageDead(_8); ++ _7 = _8; ++ nop; + StorageDead(_11); + StorageDead(_9); + StorageLive(_13); + StorageLive(_14); + StorageLive(_15); +- _15 = _1; ++ _15 = _2; + StorageLive(_16); + StorageLive(_17); +- _17 = _7; +- _16 = move _17 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _17 = _8; ++ _16 = _8; + StorageDead(_17); +- _14 = Eq(move _15, move _16); ++ _14 = Eq(_2, _8); + StorageDead(_16); + StorageDead(_15); + _13 = opaque::(move _14) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_14); + StorageDead(_13); + StorageLive(_18); + StorageLive(_19); + StorageLive(_20); +- _20 = _1; ++ _20 = _2; + StorageLive(_21); + StorageLive(_22); +- _22 = _7; +- _21 = move _22 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _22 = _8; ++ _21 = _8; + StorageDead(_22); +- _19 = Ne(move _20, move _21); ++ _19 = Ne(_2, _8); + StorageDead(_21); + StorageDead(_20); + _18 = opaque::(move _19) -> [return: bb2, unwind unreachable]; + } + + bb2: { + StorageDead(_19); + StorageDead(_18); + StorageLive(_23); + StorageLive(_24); + StorageLive(_25); +- _25 = _1; ++ _25 = _2; + StorageLive(_26); + StorageLive(_27); +- _27 = _7; +- _26 = move _27 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _27 = _8; ++ _26 = _8; + StorageDead(_27); +- _24 = Lt(move _25, move _26); ++ _24 = Lt(_2, _8); + StorageDead(_26); + StorageDead(_25); + _23 = opaque::(move _24) -> [return: bb3, unwind unreachable]; + } + + bb3: { + StorageDead(_24); + StorageDead(_23); + StorageLive(_28); + StorageLive(_29); + StorageLive(_30); +- _30 = _1; ++ _30 = _2; + StorageLive(_31); + StorageLive(_32); +- _32 = _7; +- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _32 = _8; ++ _31 = _8; + StorageDead(_32); +- _29 = Le(move _30, move _31); ++ _29 = Le(_2, _8); + StorageDead(_31); + StorageDead(_30); + _28 = opaque::(move _29) -> [return: bb4, unwind unreachable]; + } + + bb4: { + StorageDead(_29); + StorageDead(_28); + StorageLive(_33); + StorageLive(_34); + StorageLive(_35); +- _35 = _1; ++ _35 = _2; + StorageLive(_36); + StorageLive(_37); +- _37 = _7; +- _36 = move _37 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _37 = _8; ++ _36 = _8; + StorageDead(_37); +- _34 = Gt(move _35, move _36); ++ _34 = Gt(_2, _8); + StorageDead(_36); + StorageDead(_35); + _33 = opaque::(move _34) -> [return: bb5, unwind unreachable]; + } + + bb5: { + StorageDead(_34); + StorageDead(_33); + StorageLive(_38); + StorageLive(_39); + StorageLive(_40); +- _40 = _1; ++ _40 = _2; + StorageLive(_41); + StorageLive(_42); +- _42 = _7; +- _41 = move _42 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _42 = _8; ++ _41 = _8; + StorageDead(_42); +- _39 = Ge(move _40, move _41); ++ _39 = Ge(_2, _8); + StorageDead(_41); + StorageDead(_40); + _38 = opaque::(move _39) -> [return: bb6, unwind unreachable]; + } + + bb6: { + StorageDead(_39); + StorageDead(_38); + _0 = const (); + StorageDead(_7); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff new file mode 100644 index 0000000000000..9b2b32a649f44 --- /dev/null +++ b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff @@ -0,0 +1,234 @@ +- // MIR for `wide_ptr_provenance` before GVN ++ // MIR for `wide_ptr_provenance` after GVN + + fn wide_ptr_provenance() -> () { + let mut _0: (); + let _1: *const dyn std::marker::Send; + let mut _2: *const dyn std::marker::Send; + let _3: &dyn std::marker::Send; + let mut _4: &i32; + let _5: &i32; + let _6: i32; + let mut _8: *const dyn std::marker::Send; + let _9: &dyn std::marker::Send; + let mut _10: &i32; + let _11: &i32; + let _12: i32; + let _13: (); + let mut _14: bool; + let mut _15: *const dyn std::marker::Send; + let mut _16: *const dyn std::marker::Send; + let mut _17: *const dyn std::marker::Send; + let _18: (); + let mut _19: bool; + let mut _20: *const dyn std::marker::Send; + let mut _21: *const dyn std::marker::Send; + let mut _22: *const dyn std::marker::Send; + let _23: (); + let mut _24: bool; + let mut _25: *const dyn std::marker::Send; + let mut _26: *const dyn std::marker::Send; + let mut _27: *const dyn std::marker::Send; + let _28: (); + let mut _29: bool; + let mut _30: *const dyn std::marker::Send; + let mut _31: *const dyn std::marker::Send; + let mut _32: *const dyn std::marker::Send; + let _33: (); + let mut _34: bool; + let mut _35: *const dyn std::marker::Send; + let mut _36: *const dyn std::marker::Send; + let mut _37: *const dyn std::marker::Send; + let _38: (); + let mut _39: bool; + let mut _40: *const dyn std::marker::Send; + let mut _41: *const dyn std::marker::Send; + let mut _42: *const dyn std::marker::Send; + let mut _44: &i32; + scope 1 { +- debug a => _1; ++ debug a => _2; + let _7: *const dyn std::marker::Send; + let mut _43: &i32; + scope 2 { +- debug b => _7; ++ debug b => _8; + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + _44 = const _; + _5 = &(*_44); + _4 = &(*_5); + _3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize)); + StorageDead(_4); + _2 = &raw const (*_3); +- _1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize)); +- StorageDead(_2); ++ _1 = _2; ++ nop; + StorageDead(_5); + StorageDead(_3); + StorageLive(_7); +- StorageLive(_8); ++ nop; + StorageLive(_9); + StorageLive(_10); + StorageLive(_11); + _43 = const _; + _11 = &(*_43); + _10 = &(*_11); + _9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize)); + StorageDead(_10); + _8 = &raw const (*_9); +- _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize)); +- StorageDead(_8); ++ _7 = _8; ++ nop; + StorageDead(_11); + StorageDead(_9); + StorageLive(_13); + StorageLive(_14); + StorageLive(_15); +- _15 = _1; ++ _15 = _2; + StorageLive(_16); + StorageLive(_17); +- _17 = _7; +- _16 = move _17 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _17 = _8; ++ _16 = _8; + StorageDead(_17); +- _14 = Eq(move _15, move _16); ++ _14 = Eq(_2, _8); + StorageDead(_16); + StorageDead(_15); + _13 = opaque::(move _14) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageDead(_14); + StorageDead(_13); + StorageLive(_18); + StorageLive(_19); + StorageLive(_20); +- _20 = _1; ++ _20 = _2; + StorageLive(_21); + StorageLive(_22); +- _22 = _7; +- _21 = move _22 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _22 = _8; ++ _21 = _8; + StorageDead(_22); +- _19 = Ne(move _20, move _21); ++ _19 = Ne(_2, _8); + StorageDead(_21); + StorageDead(_20); + _18 = opaque::(move _19) -> [return: bb2, unwind continue]; + } + + bb2: { + StorageDead(_19); + StorageDead(_18); + StorageLive(_23); + StorageLive(_24); + StorageLive(_25); +- _25 = _1; ++ _25 = _2; + StorageLive(_26); + StorageLive(_27); +- _27 = _7; +- _26 = move _27 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _27 = _8; ++ _26 = _8; + StorageDead(_27); +- _24 = Lt(move _25, move _26); ++ _24 = Lt(_2, _8); + StorageDead(_26); + StorageDead(_25); + _23 = opaque::(move _24) -> [return: bb3, unwind continue]; + } + + bb3: { + StorageDead(_24); + StorageDead(_23); + StorageLive(_28); + StorageLive(_29); + StorageLive(_30); +- _30 = _1; ++ _30 = _2; + StorageLive(_31); + StorageLive(_32); +- _32 = _7; +- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _32 = _8; ++ _31 = _8; + StorageDead(_32); +- _29 = Le(move _30, move _31); ++ _29 = Le(_2, _8); + StorageDead(_31); + StorageDead(_30); + _28 = opaque::(move _29) -> [return: bb4, unwind continue]; + } + + bb4: { + StorageDead(_29); + StorageDead(_28); + StorageLive(_33); + StorageLive(_34); + StorageLive(_35); +- _35 = _1; ++ _35 = _2; + StorageLive(_36); + StorageLive(_37); +- _37 = _7; +- _36 = move _37 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _37 = _8; ++ _36 = _8; + StorageDead(_37); +- _34 = Gt(move _35, move _36); ++ _34 = Gt(_2, _8); + StorageDead(_36); + StorageDead(_35); + _33 = opaque::(move _34) -> [return: bb5, unwind continue]; + } + + bb5: { + StorageDead(_34); + StorageDead(_33); + StorageLive(_38); + StorageLive(_39); + StorageLive(_40); +- _40 = _1; ++ _40 = _2; + StorageLive(_41); + StorageLive(_42); +- _42 = _7; +- _41 = move _42 as *const dyn std::marker::Send (PointerCoercion(Unsize)); ++ _42 = _8; ++ _41 = _8; + StorageDead(_42); +- _39 = Ge(move _40, move _41); ++ _39 = Ge(_2, _8); + StorageDead(_41); + StorageDead(_40); + _38 = opaque::(move _39) -> [return: bb6, unwind continue]; + } + + bb6: { + StorageDead(_39); + StorageDead(_38); + _0 = const (); + StorageDead(_7); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff index 62710ba8fbf5f..6387962e02349 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff @@ -10,7 +10,8 @@ let _5: T; let mut _6: !; scope 1 { - debug y => _5; +- debug y => _5; ++ debug y => _1; } bb0: { diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff index ad46a065b1e3d..391c1338347c1 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff @@ -10,7 +10,8 @@ let _5: T; let mut _6: !; scope 1 { - debug y => _5; +- debug y => _5; ++ debug y => _1; } bb0: { diff --git a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir index 10b81e59b5f4b..a105e08c95260 100644 --- a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir @@ -15,8 +15,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) { debug x => _3; scope 2 (inlined foo::::{closure#0}) { debug _q => _9; - debug q => (*((*_6).0: &i32)); - debug t => (*((*_6).1: &T)); + debug q => (*_10); + debug t => (*_12); let mut _10: &i32; let mut _11: i32; let mut _12: &T; diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff index 4fcd49994f0d7..d49f0ad78fe3c 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff @@ -12,12 +12,80 @@ + scope 3 (inlined std::ptr::drop_in_place::> - shim(Some(Vec))) { + let mut _6: &mut std::vec::Vec; + let mut _7: (); ++ scope 4 (inlined as Drop>::drop) { ++ debug self => _6; ++ let mut _8: *mut [A]; ++ let mut _9: *mut A; ++ let mut _10: usize; ++ scope 5 { ++ scope 6 (inlined Vec::::as_mut_ptr) { ++ debug self => _6; ++ scope 7 (inlined alloc::raw_vec::RawVec::::ptr) { ++ debug (*(self: &alloc::raw_vec::RawVec)) => ((*_6).0: alloc::raw_vec::RawVec); ++ let mut _17: std::ptr::NonNull; ++ scope 8 (inlined Unique::::as_ptr) { ++ debug ((self: Unique).0: std::ptr::NonNull) => _17; ++ debug ((self: Unique).1: std::marker::PhantomData) => const ZeroSized: PhantomData; ++ scope 9 (inlined NonNull::::as_ptr) { ++ debug self => _17; ++ let mut _11: bool; ++ let mut _12: bool; ++ let mut _13: *const A; ++ scope 10 { ++ scope 11 (inlined std::ptr::const_ptr::::is_null) { ++ debug self => _13; ++ let mut _14: *const u8; ++ scope 12 { ++ scope 13 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { ++ debug ptr => _14; ++ let mut _15: usize; ++ scope 14 (inlined std::ptr::const_ptr::::addr) { ++ debug self => _14; ++ let mut _16: *const (); ++ scope 15 { ++ scope 16 (inlined std::ptr::const_ptr::::cast::<()>) { ++ debug self => _14; ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ scope 17 (inlined slice_from_raw_parts_mut::) { ++ debug data => _9; ++ debug len => _10; ++ let mut _18: *mut (); ++ scope 18 (inlined std::ptr::mut_ptr::::cast::<()>) { ++ debug self => _9; ++ } ++ scope 19 (inlined std::ptr::from_raw_parts_mut::<[A]>) { ++ debug data_address => _18; ++ debug metadata => _10; ++ let mut _19: std::ptr::metadata::PtrRepr<[A]>; ++ let mut _20: std::ptr::metadata::PtrComponents<[A]>; ++ scope 20 { ++ } ++ } ++ } ++ scope 21 (inlined std::ptr::drop_in_place::<[A]> - shim(Some([A]))) { ++ let mut _21: usize; ++ let mut _22: usize; ++ let mut _23: *mut A; ++ let mut _24: bool; ++ } ++ } ++ } + } } scope 2 { -+ scope 4 (inlined std::ptr::drop_in_place::> - shim(Some(Option))) { -+ let mut _8: isize; -+ let mut _9: isize; ++ scope 22 (inlined std::ptr::drop_in_place::> - shim(Some(Option))) { ++ let mut _25: isize; ++ let mut _26: isize; + } } @@ -29,7 +97,50 @@ + StorageLive(_6); + StorageLive(_7); + _6 = &mut (*_4); -+ _7 = as Drop>::drop(move _6) -> [return: bb2, unwind unreachable]; ++ StorageLive(_13); ++ StorageLive(_16); ++ StorageLive(_8); ++ StorageLive(_9); ++ StorageLive(_17); ++ _17 = ((((*_6).0: alloc::raw_vec::RawVec).0: std::ptr::Unique).0: std::ptr::NonNull); ++ StorageLive(_11); ++ StorageLive(_12); ++ _13 = (_17.0: *const A); ++ StorageLive(_14); ++ _14 = _13 as *const u8 (PtrToPtr); ++ StorageLive(_15); ++ _16 = _13 as *const () (PtrToPtr); ++ _15 = _16 as usize (Transmute); ++ _12 = Eq(move _15, const 0_usize); ++ StorageDead(_15); ++ StorageDead(_14); ++ _11 = Not(move _12); ++ StorageDead(_12); ++ assume(move _11); ++ StorageDead(_11); ++ _9 = _13 as *mut A (PtrToPtr); ++ StorageDead(_17); ++ StorageLive(_10); ++ _10 = ((*_6).1: usize); ++ StorageLive(_18); ++ _18 = _13 as *mut () (PtrToPtr); ++ StorageLive(_19); ++ StorageLive(_20); ++ _20 = std::ptr::metadata::PtrComponents::<[A]> { data_address: _16, metadata: _10 }; ++ _19 = std::ptr::metadata::PtrRepr::<[A]> { const_ptr: move _20 }; ++ StorageDead(_20); ++ _8 = (_19.1: *mut [A]); ++ StorageDead(_19); ++ StorageDead(_18); ++ StorageDead(_10); ++ StorageDead(_9); ++ StorageLive(_21); ++ StorageLive(_22); ++ StorageLive(_23); ++ StorageLive(_24); ++ _21 = Len((*_8)); ++ _22 = const 0_usize; ++ goto -> bb4; } bb1: { @@ -40,25 +151,43 @@ StorageLive(_5); _5 = _2; - _0 = std::ptr::drop_in_place::>(move _5) -> [return: bb2, unwind unreachable]; -+ StorageLive(_8); -+ StorageLive(_9); -+ _8 = discriminant((*_5)); -+ switchInt(move _8) -> [0: bb3, otherwise: bb4]; ++ StorageLive(_25); ++ StorageLive(_26); ++ _25 = discriminant((*_5)); ++ switchInt(move _25) -> [0: bb5, otherwise: bb6]; } bb2: { ++ StorageDead(_24); ++ StorageDead(_23); ++ StorageDead(_22); ++ StorageDead(_21); ++ StorageDead(_8); ++ StorageDead(_16); ++ StorageDead(_13); + drop(((*_4).0: alloc::raw_vec::RawVec)) -> [return: bb1, unwind unreachable]; + } + + bb3: { -+ StorageDead(_9); -+ StorageDead(_8); ++ _23 = &raw mut (*_8)[_22]; ++ _22 = Add(move _22, const 1_usize); ++ drop((*_23)) -> [return: bb4, unwind unreachable]; ++ } ++ ++ bb4: { ++ _24 = Eq(_22, _21); ++ switchInt(move _24) -> [0: bb3, otherwise: bb2]; ++ } ++ ++ bb5: { ++ StorageDead(_26); ++ StorageDead(_25); StorageDead(_5); return; + } + -+ bb4: { -+ drop((((*_5) as Some).0: B)) -> [return: bb3, unwind unreachable]; ++ bb6: { ++ drop((((*_5) as Some).0: B)) -> [return: bb5, unwind unreachable]; } } diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff index 688ab9c563a7a..691d95cd2da56 100644 --- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff @@ -8,7 +8,7 @@ + let mut _2: bool; + let mut _3: bool; + scope 2 { -+ debug buffer => const _; ++ debug buffer => const {ALLOC0: &[bool; 1]}; + scope 3 { + debug index => _0; + } @@ -45,5 +45,9 @@ + StorageDead(_1); return; } ++ } ++ ++ ALLOC0 (size: 1, align: 1) { ++ 01 │ . } diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff index e4d2b1a7ffbdd..d8c3cb4907479 100644 --- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff @@ -8,7 +8,7 @@ + let mut _2: bool; + let mut _3: bool; + scope 2 { -+ debug buffer => const _; ++ debug buffer => const {ALLOC0: &[bool; 1]}; + scope 3 { + debug index => _0; + } @@ -45,5 +45,9 @@ + StorageDead(_1); return; } ++ } ++ ++ ALLOC0 (size: 1, align: 1) { ++ 01 │ . } diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index 408cc5bb3419a..d6c5ef1e336ef 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -8,8 +8,8 @@ fn b(_1: &mut Box) -> &mut T { let mut _4: &mut std::boxed::Box; scope 1 (inlined as AsMut>::as_mut) { debug self => _4; - let mut _5: std::boxed::Box; - let mut _6: *const T; + let mut _5: *const T; + let mut _6: std::ptr::NonNull; } bb0: { @@ -19,9 +19,9 @@ fn b(_1: &mut Box) -> &mut T { _4 = &mut (*_1); StorageLive(_5); StorageLive(_6); - _5 = (*_4); - _6 = (((_5.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); - _3 = &mut (*_6); + _6 = (((*_4).0: std::ptr::Unique).0: std::ptr::NonNull); + _5 = (_6.0: *const T); + _3 = &mut (*_5); StorageDead(_6); StorageDead(_5); _2 = &mut (*_3); diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index 4d20f6c441993..b24a351795403 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -7,8 +7,8 @@ fn d(_1: &Box) -> &T { let mut _3: &std::boxed::Box; scope 1 (inlined as AsRef>::as_ref) { debug self => _3; - let mut _4: std::boxed::Box; - let mut _5: *const T; + let mut _4: *const T; + let mut _5: std::ptr::NonNull; } bb0: { @@ -17,9 +17,9 @@ fn d(_1: &Box) -> &T { _3 = &(*_1); StorageLive(_4); StorageLive(_5); - _4 = (*_3); - _5 = (((_4.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); - _2 = &(*_5); + _5 = (((*_3).0: std::ptr::Unique).0: std::ptr::NonNull); + _4 = (_5.0: *const T); + _2 = &(*_4); StorageDead(_5); StorageDead(_4); _0 = &(*_2); diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff index 2a36ad9230e4b..b12ee5cf6128e 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff @@ -7,9 +7,8 @@ let mut _2: std::option::Option; + scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { + debug self => _2; -+ let mut _3: &std::option::Option; -+ let mut _4: isize; -+ let mut _5: bool; ++ let mut _3: isize; ++ let mut _4: bool; + scope 2 { + debug val => _0; + } @@ -22,7 +21,7 @@ + } + } + scope 4 (inlined Option::::is_some) { -+ debug self => _3; ++ debug (*(self: &Option)) => _2; + } + } @@ -35,12 +34,10 @@ - bb1: { + StorageLive(_3); + StorageLive(_4); -+ StorageLive(_5); -+ _4 = discriminant(_2); -+ _5 = Eq(_4, const 1_isize); -+ assume(move _5); ++ _3 = discriminant(_2); ++ _4 = Eq(_3, const 1_isize); ++ assume(move _4); + _0 = move ((_2 as Some).0: T); -+ StorageDead(_5); + StorageDead(_4); + StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff index 14c8c671d3fe2..84315f57faf55 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff @@ -7,9 +7,8 @@ let mut _2: std::option::Option; + scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { + debug self => _2; -+ let mut _3: &std::option::Option; -+ let mut _4: isize; -+ let mut _5: bool; ++ let mut _3: isize; ++ let mut _4: bool; + scope 2 { + debug val => _0; + } @@ -22,7 +21,7 @@ + } + } + scope 4 (inlined Option::::is_some) { -+ debug self => _3; ++ debug (*(self: &Option)) => _2; + } + } @@ -35,12 +34,10 @@ - bb1: { + StorageLive(_3); + StorageLive(_4); -+ StorageLive(_5); -+ _4 = discriminant(_2); -+ _5 = Eq(_4, const 1_isize); -+ assume(move _5); ++ _3 = discriminant(_2); ++ _4 = Eq(_3, const 1_isize); ++ assume(move _4); + _0 = move ((_2 as Some).0: T); -+ StorageDead(_5); + StorageDead(_4); + StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir index d6a608476df9c..0a50cd5add397 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir @@ -7,7 +7,6 @@ fn unwrap_unchecked(_1: Option) -> T { debug self => _1; let mut _2: isize; let mut _3: bool; - let mut _4: &std::option::Option; scope 2 { debug val => _0; } @@ -20,21 +19,19 @@ fn unwrap_unchecked(_1: Option) -> T { } } scope 4 (inlined Option::::is_some) { - debug self => _4; + debug (*(self: &Option)) => _1; } } bb0: { - StorageLive(_4); StorageLive(_2); StorageLive(_3); _2 = discriminant(_1); _3 = Eq(_2, const 1_isize); assume(move _3); - _0 = ((_1 as Some).0: T); + _0 = move ((_1 as Some).0: T); StorageDead(_3); StorageDead(_2); - StorageDead(_4); return; } } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir index d6a608476df9c..0a50cd5add397 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir @@ -7,7 +7,6 @@ fn unwrap_unchecked(_1: Option) -> T { debug self => _1; let mut _2: isize; let mut _3: bool; - let mut _4: &std::option::Option; scope 2 { debug val => _0; } @@ -20,21 +19,19 @@ fn unwrap_unchecked(_1: Option) -> T { } } scope 4 (inlined Option::::is_some) { - debug self => _4; + debug (*(self: &Option)) => _1; } } bb0: { - StorageLive(_4); StorageLive(_2); StorageLive(_3); _2 = discriminant(_1); _3 = Eq(_2, const 1_isize); assume(move _3); - _0 = ((_1 as Some).0: T); + _0 = move ((_1 as Some).0: T); StorageDead(_3); StorageDead(_2); - StorageDead(_4); return; } } diff --git a/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff b/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff index 187290785c032..81afe7c51dddc 100644 --- a/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff +++ b/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff @@ -17,8 +17,8 @@ let mut _12: u32; let mut _13: bool; scope 1 (inlined imm8) { - debug x => _5; - let mut _14: u32; +- debug x => _5; ++ debug x => _1; scope 2 { debug out => _4; } @@ -35,14 +35,8 @@ StorageLive(_5); _5 = _1; _4 = const 0_u32; -- StorageLive(_14); -- _14 = BitAnd(_5, const 255_u32); -- _4 = BitOr(const 0_u32, move _14); -- StorageDead(_14); -+ nop; -+ _14 = BitAnd(_1, const 255_u32); -+ _4 = _14; -+ nop; +- _4 = BitAnd(_5, const 255_u32); ++ _4 = BitAnd(_1, const 255_u32); StorageDead(_5); StorageLive(_6); StorageLive(_7); diff --git a/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff index 99350bac478d9..b16fad9a68837 100644 --- a/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff +++ b/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff @@ -17,8 +17,8 @@ let mut _12: u32; let mut _13: bool; scope 1 (inlined imm8) { - debug x => _5; - let mut _14: u32; +- debug x => _5; ++ debug x => _1; scope 2 { debug out => _4; } @@ -35,14 +35,8 @@ StorageLive(_5); _5 = _1; _4 = const 0_u32; -- StorageLive(_14); -- _14 = BitAnd(_5, const 255_u32); -- _4 = BitOr(const 0_u32, move _14); -- StorageDead(_14); -+ nop; -+ _14 = BitAnd(_1, const 255_u32); -+ _4 = _14; -+ nop; +- _4 = BitAnd(_5, const 255_u32); ++ _4 = BitAnd(_1, const 255_u32); StorageDead(_5); StorageLive(_6); StorageLive(_7); diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff index b2539f391d1a5..77dc1901c141e 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -9,16 +9,13 @@ let _4: [T; 3]; let mut _5: usize; let mut _6: bool; - let mut _10: !; + let mut _7: !; scope 1 { debug v => _2; - let _7: &T; - let _8: &T; - let _9: &T; scope 2 { - debug v1 => _7; - debug v2 => _8; - debug v3 => _9; + debug (*(v1: &T)) => (*_2)[0 of 3]; + debug (*(v2: &T)) => (*_2)[1 of 3]; + debug (*(v3: &T)) => (*_2)[2 of 3]; } } @@ -29,25 +26,18 @@ _3 = &_4; _2 = move _3 as &[T] (PointerCoercion(Unsize)); StorageDead(_3); - _5 = const 3_usize; - _6 = const true; - goto -> bb2; + _5 = Len((*_2)); +- _6 = Eq(move _5, const 3_usize); +- switchInt(move _6) -> [0: bb1, otherwise: bb2]; ++ nop; ++ switchInt(move _5) -> [3: bb2, otherwise: bb1]; } bb1: { - _10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable; + _7 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable; } bb2: { - StorageLive(_7); - _7 = &(*_2)[0 of 3]; - StorageLive(_8); - _8 = &(*_2)[1 of 3]; - StorageLive(_9); - _9 = &(*_2)[2 of 3]; - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); StorageDead(_4); return; } diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index ff7f12c093ce4..75fbfa10683e0 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -9,16 +9,13 @@ let _4: [T; 3]; let mut _5: usize; let mut _6: bool; - let mut _10: !; + let mut _7: !; scope 1 { debug v => _2; - let _7: &T; - let _8: &T; - let _9: &T; scope 2 { - debug v1 => _7; - debug v2 => _8; - debug v3 => _9; + debug (*(v1: &T)) => (*_2)[0 of 3]; + debug (*(v2: &T)) => (*_2)[1 of 3]; + debug (*(v3: &T)) => (*_2)[2 of 3]; } } @@ -29,25 +26,18 @@ _3 = &_4; _2 = move _3 as &[T] (PointerCoercion(Unsize)); StorageDead(_3); - _5 = const 3_usize; - _6 = const true; - goto -> bb2; + _5 = Len((*_2)); +- _6 = Eq(move _5, const 3_usize); +- switchInt(move _6) -> [0: bb1, otherwise: bb2]; ++ nop; ++ switchInt(move _5) -> [3: bb2, otherwise: bb1]; } bb1: { - _10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue; + _7 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue; } bb2: { - StorageLive(_7); - _7 = &(*_2)[0 of 3]; - StorageLive(_8); - _8 = &(*_2)[1 of 3]; - StorageLive(_9); - _9 = &(*_2)[2 of 3]; - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); StorageDead(_4); return; } diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir index f7be8b75db7b8..8a9b267e45fa9 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir @@ -3,75 +3,112 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; let mut _0: u32; - let mut _5: std::option::Option; + let mut _6: std::option::Option; scope 1 (inlined char::methods::::is_digit) { debug self => _1; debug radix => const 8_u32; - let _2: std::option::Option; - let mut _3: &std::option::Option; - scope 2 (inlined Option::::is_some) { - debug self => _3; - let mut _4: isize; + let _5: std::option::Option; + scope 2 (inlined char::methods::::to_digit) { + debug self => _1; + debug radix => const 8_u32; + let mut _2: u32; + let mut _3: u32; + let mut _4: bool; + let mut _8: &[&str]; + let mut _9: u32; + let mut _10: u32; + scope 3 { + debug digit => _3; + scope 5 (inlined Arguments::<'_>::new_const) { + debug pieces => _8; + } + scope 6 (inlined core::num::::wrapping_sub) { + debug self => _10; + debug rhs => const 97_u32; + } + scope 7 (inlined core::num::::saturating_add) { + debug self => _9; + debug rhs => const 10_u32; + } + } + scope 4 (inlined core::num::::wrapping_sub) { + debug self => _2; + debug rhs => const 48_u32; + } + } + scope 8 (inlined Option::::is_some) { + debug (*(self: &Option)) => _5; } } - scope 3 (inlined #[track_caller] Option::::unwrap) { - debug self => _5; - let mut _6: isize; + scope 9 (inlined char::methods::::to_digit) { + debug self => _1; + debug radix => const 8_u32; + scope 10 { + debug digit => _3; + scope 12 (inlined Arguments::<'_>::new_const) { + debug pieces => _8; + } + scope 13 (inlined core::num::::wrapping_sub) { + debug self => _10; + debug rhs => const 97_u32; + } + scope 14 (inlined core::num::::saturating_add) { + debug self => _9; + debug rhs => const 10_u32; + } + } + scope 11 (inlined core::num::::wrapping_sub) { + debug self => _2; + debug rhs => const 48_u32; + } + } + scope 15 (inlined #[track_caller] Option::::unwrap) { + debug self => _6; let mut _7: !; - scope 4 { + scope 16 { debug val => _0; } } bb0: { - StorageLive(_3); - StorageLive(_2); - _2 = char::methods::::to_digit(_1, const 8_u32) -> [return: bb1, unwind unreachable]; + StorageLive(_5); + _2 = _1 as u32 (IntToInt); + _3 = Sub(_2, const 48_u32); + _4 = Lt(_3, const 8_u32); + switchInt(_4) -> [0: bb1, otherwise: bb2]; } bb1: { - _3 = &_2; - StorageLive(_4); - _4 = discriminant(_2); - StorageDead(_3); - StorageDead(_2); - switchInt(move _4) -> [1: bb2, otherwise: bb7]; + _5 = const Option::::None; + StorageDead(_5); + _0 = const 0_u32; + goto -> bb5; } bb2: { - StorageDead(_4); - StorageLive(_5); - _5 = char::methods::::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable]; - } - - bb3: { + _5 = Option::::Some(_3); + StorageDead(_5); StorageLive(_6); - _6 = discriminant(_5); - switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6]; + switchInt(_4) -> [0: bb3, otherwise: bb4]; } - bb4: { + bb3: { + _6 = const Option::::None; _7 = option::unwrap_failed() -> unwind unreachable; } - bb5: { - _0 = move ((_5 as Some).0: u32); + bb4: { + _6 = Option::::Some(_3); + _0 = move ((_6 as Some).0: u32); StorageDead(_6); - StorageDead(_5); - goto -> bb8; - } - - bb6: { - unreachable; + goto -> bb5; } - bb7: { - StorageDead(_4); - _0 = const 0_u32; - goto -> bb8; - } - - bb8: { + bb5: { return; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir index e76fe992ac7d3..15284833b9bf9 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir @@ -3,75 +3,112 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; let mut _0: u32; - let mut _5: std::option::Option; + let mut _6: std::option::Option; scope 1 (inlined char::methods::::is_digit) { debug self => _1; debug radix => const 8_u32; - let _2: std::option::Option; - let mut _3: &std::option::Option; - scope 2 (inlined Option::::is_some) { - debug self => _3; - let mut _4: isize; + let _5: std::option::Option; + scope 2 (inlined char::methods::::to_digit) { + debug self => _1; + debug radix => const 8_u32; + let mut _2: u32; + let mut _3: u32; + let mut _4: bool; + let mut _8: &[&str]; + let mut _9: u32; + let mut _10: u32; + scope 3 { + debug digit => _3; + scope 5 (inlined Arguments::<'_>::new_const) { + debug pieces => _8; + } + scope 6 (inlined core::num::::wrapping_sub) { + debug self => _10; + debug rhs => const 97_u32; + } + scope 7 (inlined core::num::::saturating_add) { + debug self => _9; + debug rhs => const 10_u32; + } + } + scope 4 (inlined core::num::::wrapping_sub) { + debug self => _2; + debug rhs => const 48_u32; + } + } + scope 8 (inlined Option::::is_some) { + debug (*(self: &Option)) => _5; } } - scope 3 (inlined #[track_caller] Option::::unwrap) { - debug self => _5; - let mut _6: isize; + scope 9 (inlined char::methods::::to_digit) { + debug self => _1; + debug radix => const 8_u32; + scope 10 { + debug digit => _3; + scope 12 (inlined Arguments::<'_>::new_const) { + debug pieces => _8; + } + scope 13 (inlined core::num::::wrapping_sub) { + debug self => _10; + debug rhs => const 97_u32; + } + scope 14 (inlined core::num::::saturating_add) { + debug self => _9; + debug rhs => const 10_u32; + } + } + scope 11 (inlined core::num::::wrapping_sub) { + debug self => _2; + debug rhs => const 48_u32; + } + } + scope 15 (inlined #[track_caller] Option::::unwrap) { + debug self => _6; let mut _7: !; - scope 4 { + scope 16 { debug val => _0; } } bb0: { - StorageLive(_3); - StorageLive(_2); - _2 = char::methods::::to_digit(_1, const 8_u32) -> [return: bb1, unwind continue]; + StorageLive(_5); + _2 = _1 as u32 (IntToInt); + _3 = Sub(_2, const 48_u32); + _4 = Lt(_3, const 8_u32); + switchInt(_4) -> [0: bb1, otherwise: bb2]; } bb1: { - _3 = &_2; - StorageLive(_4); - _4 = discriminant(_2); - StorageDead(_3); - StorageDead(_2); - switchInt(move _4) -> [1: bb2, otherwise: bb7]; + _5 = const Option::::None; + StorageDead(_5); + _0 = const 0_u32; + goto -> bb5; } bb2: { - StorageDead(_4); - StorageLive(_5); - _5 = char::methods::::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue]; - } - - bb3: { + _5 = Option::::Some(_3); + StorageDead(_5); StorageLive(_6); - _6 = discriminant(_5); - switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6]; + switchInt(_4) -> [0: bb3, otherwise: bb4]; } - bb4: { + bb3: { + _6 = const Option::::None; _7 = option::unwrap_failed() -> unwind continue; } - bb5: { - _0 = move ((_5 as Some).0: u32); + bb4: { + _6 = Option::::Some(_3); + _0 = move ((_6 as Some).0: u32); StorageDead(_6); - StorageDead(_5); - goto -> bb8; - } - - bb6: { - unreachable; + goto -> bb5; } - bb7: { - StorageDead(_4); - _0 = const 0_u32; - goto -> bb8; - } - - bb8: { + bb5: { return; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index f1d18b0f7ff9c..d69f96fa829c7 100644 --- a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -24,7 +24,7 @@ StorageLive(_2); StorageLive(_3); _3 = _1; - _2 = move _3 as [u32; 4] (Transmute); + _2 = _1 as [u32; 4] (Transmute); StorageDead(_3); switchInt(_2[0 of 4]) -> [0: bb1, otherwise: bb6]; } diff --git a/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-abort.diff new file mode 100644 index 0000000000000..66aa892c6f331 --- /dev/null +++ b/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-abort.diff @@ -0,0 +1,52 @@ +- // MIR for `aggregate` before JumpThreading ++ // MIR for `aggregate` after JumpThreading + + fn aggregate(_1: u8) -> u8 { + debug x => _1; + let mut _0: u8; + let _2: u8; + let _3: u8; + let mut _4: (u8, u8); + let mut _5: bool; + let mut _6: u8; + scope 1 { + debug a => _2; + debug b => _3; + } + + bb0: { + StorageLive(_4); + _4 = const _; + StorageLive(_2); + _2 = (_4.0: u8); + StorageLive(_3); + _3 = (_4.1: u8); + StorageDead(_4); + StorageLive(_5); + StorageLive(_6); + _6 = _2; + _5 = Eq(move _6, const 7_u8); +- switchInt(move _5) -> [0: bb2, otherwise: bb1]; ++ goto -> bb2; + } + + bb1: { + StorageDead(_6); + _0 = _3; + goto -> bb3; + } + + bb2: { + StorageDead(_6); + _0 = _2; + goto -> bb3; + } + + bb3: { + StorageDead(_5); + StorageDead(_3); + StorageDead(_2); + return; + } + } + diff --git a/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-unwind.diff new file mode 100644 index 0000000000000..66aa892c6f331 --- /dev/null +++ b/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-unwind.diff @@ -0,0 +1,52 @@ +- // MIR for `aggregate` before JumpThreading ++ // MIR for `aggregate` after JumpThreading + + fn aggregate(_1: u8) -> u8 { + debug x => _1; + let mut _0: u8; + let _2: u8; + let _3: u8; + let mut _4: (u8, u8); + let mut _5: bool; + let mut _6: u8; + scope 1 { + debug a => _2; + debug b => _3; + } + + bb0: { + StorageLive(_4); + _4 = const _; + StorageLive(_2); + _2 = (_4.0: u8); + StorageLive(_3); + _3 = (_4.1: u8); + StorageDead(_4); + StorageLive(_5); + StorageLive(_6); + _6 = _2; + _5 = Eq(move _6, const 7_u8); +- switchInt(move _5) -> [0: bb2, otherwise: bb1]; ++ goto -> bb2; + } + + bb1: { + StorageDead(_6); + _0 = _3; + goto -> bb3; + } + + bb2: { + StorageDead(_6); + _0 = _2; + goto -> bb3; + } + + bb3: { + StorageDead(_5); + StorageDead(_3); + StorageDead(_2); + return; + } + } + diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index 0cbdaa085bc97..7c2fa42828be6 100644 --- a/tests/mir-opt/jump_threading.rs +++ b/tests/mir-opt/jump_threading.rs @@ -453,7 +453,23 @@ fn disappearing_bb(x: u8) -> u8 { ) } +/// Verify that we can thread jumps when we assign from an aggregate constant. +fn aggregate(x: u8) -> u8 { + // CHECK-LABEL: fn aggregate( + // CHECK-NOT: switchInt( + + const FOO: (u8, u8) = (5, 13); + + let (a, b) = FOO; + if a == 7 { + b + } else { + a + } +} + fn main() { + // CHECK-LABEL: fn main( too_complex(Ok(0)); identity(Ok(0)); custom_discr(false); @@ -464,6 +480,7 @@ fn main() { mutable_ref(); renumbered_bb(true); disappearing_bb(7); + aggregate(7); } // EMIT_MIR jump_threading.too_complex.JumpThreading.diff @@ -476,3 +493,4 @@ fn main() { // EMIT_MIR jump_threading.mutable_ref.JumpThreading.diff // EMIT_MIR jump_threading.renumbered_bb.JumpThreading.diff // EMIT_MIR jump_threading.disappearing_bb.JumpThreading.diff +// EMIT_MIR jump_threading.aggregate.JumpThreading.diff diff --git a/tests/mir-opt/nrvo_miscompile_111005.rs b/tests/mir-opt/nrvo_miscompile_111005.rs index aff037ae4f297..7ea69b648ffbe 100644 --- a/tests/mir-opt/nrvo_miscompile_111005.rs +++ b/tests/mir-opt/nrvo_miscompile_111005.rs @@ -1,13 +1,13 @@ // skip-filecheck // This is a miscompilation, #111005 to track -// unit-test: RenameReturnPlace +// unit-test: DestinationPropagation #![feature(custom_mir, core_intrinsics)] extern crate core; use core::intrinsics::mir::*; -// EMIT_MIR nrvo_miscompile_111005.wrong.RenameReturnPlace.diff +// EMIT_MIR nrvo_miscompile_111005.wrong.DestinationPropagation.diff #[custom_mir(dialect = "runtime", phase = "initial")] pub fn wrong(arg: char) -> char { mir!({ diff --git a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff b/tests/mir-opt/nrvo_miscompile_111005.wrong.DestinationPropagation.diff similarity index 60% rename from tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff rename to tests/mir-opt/nrvo_miscompile_111005.wrong.DestinationPropagation.diff index 260b472daa92a..afacf5c149662 100644 --- a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff +++ b/tests/mir-opt/nrvo_miscompile_111005.wrong.DestinationPropagation.diff @@ -1,5 +1,5 @@ -- // MIR for `wrong` before RenameReturnPlace -+ // MIR for `wrong` after RenameReturnPlace +- // MIR for `wrong` before DestinationPropagation ++ // MIR for `wrong` after DestinationPropagation fn wrong(_1: char) -> char { let mut _0: char; @@ -9,8 +9,9 @@ - _2 = _1; - _0 = _2; - _2 = const 'b'; ++ nop; + _0 = _1; -+ _0 = const 'b'; ++ _1 = const 'b'; return; } } diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir index cf7feef00514a..f175b7249c761 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir @@ -7,63 +7,124 @@ fn step_forward(_1: u32, _2: usize) -> u32 { scope 1 (inlined ::forward) { debug start => _1; debug n => _2; - let _3: std::option::Option; - let mut _4: &std::option::Option; - let mut _7: bool; - let mut _8: u32; + let _9: std::option::Option; + let mut _10: u32; scope 2 { } - scope 3 (inlined Option::::is_none) { - debug self => _4; - let mut _6: bool; - scope 4 (inlined Option::::is_some) { - debug self => _4; - let mut _5: isize; + scope 3 (inlined ::forward_checked) { + debug start => _1; + debug n => _2; + scope 4 { + debug n => _4; + scope 6 (inlined core::num::::checked_add) { + debug self => _1; + debug rhs => _4; + let mut _8: bool; + scope 7 { + debug a => _6; + debug b => _7; + } + scope 8 (inlined core::num::::overflowing_add) { + debug self => _1; + debug rhs => _4; + let mut _5: (u32, bool); + let _6: u32; + let _7: bool; + scope 9 { + debug a => _6; + debug b => _7; + } + } + } + } + scope 5 (inlined convert::num::ptr_try_from_impls:: for u32>::try_from) { + debug u => _2; + let mut _3: bool; + let mut _4: u32; + } + } + scope 10 (inlined Option::::is_none) { + debug (*(self: &Option)) => _9; + scope 11 (inlined Option::::is_some) { + debug (*(self: &Option)) => _9; } } - scope 5 (inlined core::num::::wrapping_add) { + scope 12 (inlined core::num::::wrapping_add) { debug self => _1; - debug rhs => _8; + debug rhs => _4; } } bb0: { - StorageLive(_7); + StorageLive(_9); StorageLive(_4); StorageLive(_3); - _3 = ::forward_checked(_1, _2) -> [return: bb1, unwind continue]; + _3 = Gt(_2, const 4294967295_usize); + switchInt(move _3) -> [0: bb1, otherwise: bb5]; } bb1: { - _4 = &_3; + _4 = _2 as u32 (IntToInt); + StorageDead(_3); StorageLive(_6); + StorageLive(_7); StorageLive(_5); - _5 = discriminant(_3); - _6 = Eq(_5, const 1_isize); + _5 = CheckedAdd(_1, _4); + _6 = (_5.0: u32); + _7 = (_5.1: bool); StorageDead(_5); - _7 = Not(move _6); - StorageDead(_6); - switchInt(move _7) -> [0: bb2, otherwise: bb3]; + StorageLive(_8); + _8 = unlikely(move _7) -> [return: bb2, unwind unreachable]; } bb2: { - StorageDead(_3); - StorageDead(_4); - goto -> bb4; + switchInt(move _8) -> [0: bb3, otherwise: bb4]; } bb3: { - StorageDead(_3); + _9 = Option::::Some(_6); + StorageDead(_8); + StorageDead(_7); + StorageDead(_6); StorageDead(_4); - assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue]; + StorageDead(_9); + goto -> bb7; } bb4: { - StorageDead(_7); - StorageLive(_8); - _8 = _2 as u32 (IntToInt); - _0 = Add(_1, _8); + _9 = const Option::::None; StorageDead(_8); + StorageDead(_7); + StorageDead(_6); + StorageDead(_4); + goto -> bb6; + } + + bb5: { + StorageDead(_3); + _9 = const Option::::None; + StorageDead(_4); + goto -> bb6; + } + + bb6: { + StorageDead(_9); + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb7, unwind continue]; + } + + bb7: { + StorageLive(_10); + _10 = _2 as u32 (IntToInt); + _0 = Add(_1, _10); + StorageDead(_10); return; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} + +ALLOC1 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff index de9a1a075ad56..a009fd8f77a7e 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff @@ -5,48 +5,78 @@ let mut _0: (); let _1: std::alloc::Layout; let mut _2: std::option::Option; - let mut _3: *mut u8; - let mut _4: *mut [u8]; - let mut _5: std::ptr::NonNull<[u8]>; - let mut _6: std::result::Result, std::alloc::AllocError>; - let mut _7: &std::alloc::Global; - let mut _8: std::alloc::Layout; + let mut _4: *mut u8; + let mut _5: *mut [u8]; + let mut _6: std::ptr::NonNull<[u8]>; + let mut _7: std::result::Result, std::alloc::AllocError>; + let mut _8: &std::alloc::Global; + let _9: std::alloc::Global; + let mut _10: std::alloc::Layout; scope 1 { - debug layout => _1; - let mut _9: &std::alloc::Global; +- debug layout => _1; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; + let _3: *mut u8; + let mut _11: &std::alloc::Global; scope 2 { - debug ptr => _3; + debug ptr => _4; } scope 5 (inlined ::allocate) { - debug self => _9; - debug layout => _8; +- debug self => _11; +- debug layout => _10; ++ debug self => const {ALLOC1: &std::alloc::Global}; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; } scope 6 (inlined #[track_caller] Result::, std::alloc::AllocError>::unwrap) { - debug self => _6; - let mut _12: isize; - let _13: std::alloc::AllocError; - let mut _14: !; - let _15: &str; - let mut _16: &dyn std::fmt::Debug; - let mut _17: &std::alloc::AllocError; + debug self => _7; + let mut _14: isize; + let _15: std::alloc::AllocError; + let mut _16: !; + let _17: &str; + let mut _18: &dyn std::fmt::Debug; + let mut _19: &std::alloc::AllocError; scope 7 { - debug t => _5; + debug t => _6; } scope 8 { debug e => const std::alloc::AllocError; } } scope 9 (inlined NonNull::<[u8]>::as_ptr) { - debug self => _5; - let mut _18: *const [u8]; + debug self => _6; + let mut _20: bool; + let mut _21: bool; + let mut _22: *const [u8]; + scope 10 { + scope 11 (inlined std::ptr::const_ptr::::is_null) { + debug self => _22; + let mut _23: *const u8; + scope 12 { + scope 13 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _23; + let mut _24: usize; + scope 14 (inlined std::ptr::const_ptr::::addr) { + debug self => _23; + let mut _25: *const (); + scope 15 { + scope 16 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _23; + } + } + } + } + } + } + } } } scope 3 (inlined #[track_caller] Option::::unwrap) { - debug self => _2; - let mut _10: isize; - let mut _11: !; +- debug self => _2; ++ debug self => const Option::::None; + let mut _12: isize; + let mut _13: !; scope 4 { - debug val => _1; +- debug val => _1; ++ debug val => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; } } @@ -56,69 +86,87 @@ StorageLive(_2); - _2 = Option::::None; + _2 = const Option::::None; - StorageLive(_10); -- _10 = discriminant(_2); -- switchInt(move _10) -> [0: bb1, 1: bb2, otherwise: bb6]; -+ _10 = const 0_isize; + StorageLive(_12); +- _12 = discriminant(_2); +- switchInt(move _12) -> [0: bb1, 1: bb2, otherwise: bb6]; ++ _12 = const 0_isize; + switchInt(const 0_isize) -> [0: bb1, 1: bb2, otherwise: bb6]; } bb1: { - _11 = option::unwrap_failed() -> unwind unreachable; + _13 = option::unwrap_failed() -> unwind unreachable; } bb2: { - _1 = move ((_2 as Some).0: std::alloc::Layout); + _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; - StorageDead(_10); + StorageDead(_12); StorageDead(_2); - StorageLive(_3); StorageLive(_4); StorageLive(_5); StorageLive(_6); StorageLive(_7); - _9 = const _; -- _7 = _9; -+ _7 = const {ALLOC1: &std::alloc::Global}; StorageLive(_8); -- _8 = _1; -- _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb3, unwind unreachable]; -+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; -+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb3, unwind unreachable]; + _11 = const _; + _8 = &(*_11); + StorageLive(_10); +- _10 = _1; +- _7 = std::alloc::Global::alloc_impl(move _8, move _10, const false) -> [return: bb3, unwind unreachable]; ++ _10 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; ++ _7 = std::alloc::Global::alloc_impl(move _8, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb3, unwind unreachable]; } bb3: { + StorageDead(_10); StorageDead(_8); - StorageDead(_7); - StorageLive(_12); - StorageLive(_15); - _12 = discriminant(_6); - switchInt(move _12) -> [0: bb5, 1: bb4, otherwise: bb6]; + StorageLive(_14); + StorageLive(_17); + _14 = discriminant(_7); + switchInt(move _14) -> [0: bb5, 1: bb4, otherwise: bb6]; } bb4: { - _15 = const "called `Result::unwrap()` on an `Err` value"; - StorageLive(_16); - StorageLive(_17); - _17 = &_13; - _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); - StorageDead(_17); - _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable; + _17 = const "called `Result::unwrap()` on an `Err` value"; + StorageLive(_18); + StorageLive(_19); + _19 = &_15; + _18 = move _19 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); + StorageDead(_19); + _16 = result::unwrap_failed(move _17, move _18) -> unwind unreachable; } bb5: { - _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); - StorageDead(_15); - StorageDead(_12); + _6 = move ((_7 as Ok).0: std::ptr::NonNull<[u8]>); + StorageDead(_17); + StorageDead(_14); + StorageDead(_7); +- StorageLive(_22); ++ nop; + StorageLive(_20); + StorageLive(_21); + _22 = (_6.0: *const [u8]); + StorageLive(_23); + _23 = _22 as *const u8 (PtrToPtr); + StorageLive(_24); + StorageLive(_25); + _25 = _22 as *const () (PtrToPtr); + _24 = move _25 as usize (Transmute); + StorageDead(_25); + _21 = Eq(move _24, const 0_usize); + StorageDead(_24); + StorageDead(_23); + _20 = Not(move _21); + StorageDead(_21); + assume(move _20); + StorageDead(_20); + _5 = _22 as *mut [u8] (PtrToPtr); +- StorageDead(_22); ++ nop; StorageDead(_6); - StorageLive(_18); - _18 = (_5.0: *const [u8]); - _4 = move _18 as *mut [u8] (PtrToPtr); - StorageDead(_18); +- _4 = move _5 as *mut u8 (PtrToPtr); ++ _4 = _22 as *mut u8 (PtrToPtr); StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); StorageDead(_4); - StorageDead(_3); - StorageDead(_1); + nop; return; diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff index f784db0f40948..8f0c0435e2425 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff @@ -5,33 +5,63 @@ let mut _0: (); let _1: std::alloc::Layout; let mut _2: std::option::Option; - let mut _3: *mut u8; - let mut _4: *mut [u8]; - let mut _5: std::ptr::NonNull<[u8]>; - let mut _6: std::result::Result, std::alloc::AllocError>; - let mut _7: &std::alloc::Global; - let mut _8: std::alloc::Layout; + let mut _4: *mut u8; + let mut _5: *mut [u8]; + let mut _6: std::ptr::NonNull<[u8]>; + let mut _7: std::result::Result, std::alloc::AllocError>; + let mut _8: &std::alloc::Global; + let _9: std::alloc::Global; + let mut _10: std::alloc::Layout; scope 1 { - debug layout => _1; - let mut _9: &std::alloc::Global; +- debug layout => _1; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; + let _3: *mut u8; + let mut _11: &std::alloc::Global; scope 2 { - debug ptr => _3; + debug ptr => _4; } scope 5 (inlined ::allocate) { - debug self => _9; - debug layout => _8; +- debug self => _11; +- debug layout => _10; ++ debug self => const {ALLOC1: &std::alloc::Global}; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; } scope 6 (inlined NonNull::<[u8]>::as_ptr) { - debug self => _5; - let mut _12: *const [u8]; + debug self => _6; + let mut _14: bool; + let mut _15: bool; + let mut _16: *const [u8]; + scope 7 { + scope 8 (inlined std::ptr::const_ptr::::is_null) { + debug self => _16; + let mut _17: *const u8; + scope 9 { + scope 10 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _17; + let mut _18: usize; + scope 11 (inlined std::ptr::const_ptr::::addr) { + debug self => _17; + let mut _19: *const (); + scope 12 { + scope 13 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _17; + } + } + } + } + } + } + } } } scope 3 (inlined #[track_caller] Option::::unwrap) { - debug self => _2; - let mut _10: isize; - let mut _11: !; +- debug self => _2; ++ debug self => const Option::::None; + let mut _12: isize; + let mut _13: !; scope 4 { - debug val => _1; +- debug val => _1; ++ debug val => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; } } @@ -41,56 +71,74 @@ StorageLive(_2); - _2 = Option::::None; + _2 = const Option::::None; - StorageLive(_10); -- _10 = discriminant(_2); -- switchInt(move _10) -> [0: bb2, 1: bb3, otherwise: bb5]; -+ _10 = const 0_isize; + StorageLive(_12); +- _12 = discriminant(_2); +- switchInt(move _12) -> [0: bb2, 1: bb3, otherwise: bb5]; ++ _12 = const 0_isize; + switchInt(const 0_isize) -> [0: bb2, 1: bb3, otherwise: bb5]; } bb1: { + StorageDead(_7); +- StorageLive(_16); ++ nop; + StorageLive(_14); + StorageLive(_15); + _16 = (_6.0: *const [u8]); + StorageLive(_17); + _17 = _16 as *const u8 (PtrToPtr); + StorageLive(_18); + StorageLive(_19); + _19 = _16 as *const () (PtrToPtr); + _18 = move _19 as usize (Transmute); + StorageDead(_19); + _15 = Eq(move _18, const 0_usize); + StorageDead(_18); + StorageDead(_17); + _14 = Not(move _15); + StorageDead(_15); + assume(move _14); + StorageDead(_14); + _5 = _16 as *mut [u8] (PtrToPtr); +- StorageDead(_16); ++ nop; StorageDead(_6); - StorageLive(_12); - _12 = (_5.0: *const [u8]); - _4 = move _12 as *mut [u8] (PtrToPtr); - StorageDead(_12); +- _4 = move _5 as *mut u8 (PtrToPtr); ++ _4 = _16 as *mut u8 (PtrToPtr); StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); StorageDead(_4); - StorageDead(_3); - StorageDead(_1); + nop; return; } bb2: { - _11 = option::unwrap_failed() -> unwind continue; + _13 = option::unwrap_failed() -> unwind continue; } bb3: { - _1 = move ((_2 as Some).0: std::alloc::Layout); + _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; - StorageDead(_10); + StorageDead(_12); StorageDead(_2); - StorageLive(_3); StorageLive(_4); StorageLive(_5); StorageLive(_6); StorageLive(_7); - _9 = const _; -- _7 = _9; -+ _7 = const {ALLOC1: &std::alloc::Global}; StorageLive(_8); -- _8 = _1; -- _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb4, unwind continue]; -+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; -+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb4, unwind continue]; + _11 = const _; + _8 = &(*_11); + StorageLive(_10); +- _10 = _1; +- _7 = std::alloc::Global::alloc_impl(move _8, move _10, const false) -> [return: bb4, unwind continue]; ++ _10 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; ++ _7 = std::alloc::Global::alloc_impl(move _8, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb4, unwind continue]; } bb4: { + StorageDead(_10); StorageDead(_8); - StorageDead(_7); - _5 = Result::, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue]; + _6 = Result::, std::alloc::AllocError>::unwrap(move _7) -> [return: bb1, unwind continue]; } bb5: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff index 162b7fa4618d1..a19dcaad0bbd9 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff @@ -5,48 +5,78 @@ let mut _0: (); let _1: std::alloc::Layout; let mut _2: std::option::Option; - let mut _3: *mut u8; - let mut _4: *mut [u8]; - let mut _5: std::ptr::NonNull<[u8]>; - let mut _6: std::result::Result, std::alloc::AllocError>; - let mut _7: &std::alloc::Global; - let mut _8: std::alloc::Layout; + let mut _4: *mut u8; + let mut _5: *mut [u8]; + let mut _6: std::ptr::NonNull<[u8]>; + let mut _7: std::result::Result, std::alloc::AllocError>; + let mut _8: &std::alloc::Global; + let _9: std::alloc::Global; + let mut _10: std::alloc::Layout; scope 1 { - debug layout => _1; - let mut _9: &std::alloc::Global; +- debug layout => _1; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; + let _3: *mut u8; + let mut _11: &std::alloc::Global; scope 2 { - debug ptr => _3; + debug ptr => _4; } scope 5 (inlined ::allocate) { - debug self => _9; - debug layout => _8; +- debug self => _11; +- debug layout => _10; ++ debug self => const {ALLOC1: &std::alloc::Global}; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; } scope 6 (inlined #[track_caller] Result::, std::alloc::AllocError>::unwrap) { - debug self => _6; - let mut _12: isize; - let _13: std::alloc::AllocError; - let mut _14: !; - let _15: &str; - let mut _16: &dyn std::fmt::Debug; - let mut _17: &std::alloc::AllocError; + debug self => _7; + let mut _14: isize; + let _15: std::alloc::AllocError; + let mut _16: !; + let _17: &str; + let mut _18: &dyn std::fmt::Debug; + let mut _19: &std::alloc::AllocError; scope 7 { - debug t => _5; + debug t => _6; } scope 8 { debug e => const std::alloc::AllocError; } } scope 9 (inlined NonNull::<[u8]>::as_ptr) { - debug self => _5; - let mut _18: *const [u8]; + debug self => _6; + let mut _20: bool; + let mut _21: bool; + let mut _22: *const [u8]; + scope 10 { + scope 11 (inlined std::ptr::const_ptr::::is_null) { + debug self => _22; + let mut _23: *const u8; + scope 12 { + scope 13 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _23; + let mut _24: usize; + scope 14 (inlined std::ptr::const_ptr::::addr) { + debug self => _23; + let mut _25: *const (); + scope 15 { + scope 16 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _23; + } + } + } + } + } + } + } } } scope 3 (inlined #[track_caller] Option::::unwrap) { - debug self => _2; - let mut _10: isize; - let mut _11: !; +- debug self => _2; ++ debug self => const Option::::None; + let mut _12: isize; + let mut _13: !; scope 4 { - debug val => _1; +- debug val => _1; ++ debug val => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; } } @@ -56,69 +86,87 @@ StorageLive(_2); - _2 = Option::::None; + _2 = const Option::::None; - StorageLive(_10); -- _10 = discriminant(_2); -- switchInt(move _10) -> [0: bb1, 1: bb2, otherwise: bb6]; -+ _10 = const 0_isize; + StorageLive(_12); +- _12 = discriminant(_2); +- switchInt(move _12) -> [0: bb1, 1: bb2, otherwise: bb6]; ++ _12 = const 0_isize; + switchInt(const 0_isize) -> [0: bb1, 1: bb2, otherwise: bb6]; } bb1: { - _11 = option::unwrap_failed() -> unwind unreachable; + _13 = option::unwrap_failed() -> unwind unreachable; } bb2: { - _1 = move ((_2 as Some).0: std::alloc::Layout); + _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; - StorageDead(_10); + StorageDead(_12); StorageDead(_2); - StorageLive(_3); StorageLive(_4); StorageLive(_5); StorageLive(_6); StorageLive(_7); - _9 = const _; -- _7 = _9; -+ _7 = const {ALLOC1: &std::alloc::Global}; StorageLive(_8); -- _8 = _1; -- _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb3, unwind unreachable]; -+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; -+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb3, unwind unreachable]; + _11 = const _; + _8 = &(*_11); + StorageLive(_10); +- _10 = _1; +- _7 = std::alloc::Global::alloc_impl(move _8, move _10, const false) -> [return: bb3, unwind unreachable]; ++ _10 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; ++ _7 = std::alloc::Global::alloc_impl(move _8, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb3, unwind unreachable]; } bb3: { + StorageDead(_10); StorageDead(_8); - StorageDead(_7); - StorageLive(_12); - StorageLive(_15); - _12 = discriminant(_6); - switchInt(move _12) -> [0: bb5, 1: bb4, otherwise: bb6]; + StorageLive(_14); + StorageLive(_17); + _14 = discriminant(_7); + switchInt(move _14) -> [0: bb5, 1: bb4, otherwise: bb6]; } bb4: { - _15 = const "called `Result::unwrap()` on an `Err` value"; - StorageLive(_16); - StorageLive(_17); - _17 = &_13; - _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); - StorageDead(_17); - _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable; + _17 = const "called `Result::unwrap()` on an `Err` value"; + StorageLive(_18); + StorageLive(_19); + _19 = &_15; + _18 = move _19 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); + StorageDead(_19); + _16 = result::unwrap_failed(move _17, move _18) -> unwind unreachable; } bb5: { - _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); - StorageDead(_15); - StorageDead(_12); + _6 = move ((_7 as Ok).0: std::ptr::NonNull<[u8]>); + StorageDead(_17); + StorageDead(_14); + StorageDead(_7); +- StorageLive(_22); ++ nop; + StorageLive(_20); + StorageLive(_21); + _22 = (_6.0: *const [u8]); + StorageLive(_23); + _23 = _22 as *const u8 (PtrToPtr); + StorageLive(_24); + StorageLive(_25); + _25 = _22 as *const () (PtrToPtr); + _24 = move _25 as usize (Transmute); + StorageDead(_25); + _21 = Eq(move _24, const 0_usize); + StorageDead(_24); + StorageDead(_23); + _20 = Not(move _21); + StorageDead(_21); + assume(move _20); + StorageDead(_20); + _5 = _22 as *mut [u8] (PtrToPtr); +- StorageDead(_22); ++ nop; StorageDead(_6); - StorageLive(_18); - _18 = (_5.0: *const [u8]); - _4 = move _18 as *mut [u8] (PtrToPtr); - StorageDead(_18); +- _4 = move _5 as *mut u8 (PtrToPtr); ++ _4 = _22 as *mut u8 (PtrToPtr); StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); StorageDead(_4); - StorageDead(_3); - StorageDead(_1); + nop; return; diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff index 400aac6d64bb4..dd232b2e274c0 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff @@ -5,33 +5,63 @@ let mut _0: (); let _1: std::alloc::Layout; let mut _2: std::option::Option; - let mut _3: *mut u8; - let mut _4: *mut [u8]; - let mut _5: std::ptr::NonNull<[u8]>; - let mut _6: std::result::Result, std::alloc::AllocError>; - let mut _7: &std::alloc::Global; - let mut _8: std::alloc::Layout; + let mut _4: *mut u8; + let mut _5: *mut [u8]; + let mut _6: std::ptr::NonNull<[u8]>; + let mut _7: std::result::Result, std::alloc::AllocError>; + let mut _8: &std::alloc::Global; + let _9: std::alloc::Global; + let mut _10: std::alloc::Layout; scope 1 { - debug layout => _1; - let mut _9: &std::alloc::Global; +- debug layout => _1; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; + let _3: *mut u8; + let mut _11: &std::alloc::Global; scope 2 { - debug ptr => _3; + debug ptr => _4; } scope 5 (inlined ::allocate) { - debug self => _9; - debug layout => _8; +- debug self => _11; +- debug layout => _10; ++ debug self => const {ALLOC1: &std::alloc::Global}; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; } scope 6 (inlined NonNull::<[u8]>::as_ptr) { - debug self => _5; - let mut _12: *const [u8]; + debug self => _6; + let mut _14: bool; + let mut _15: bool; + let mut _16: *const [u8]; + scope 7 { + scope 8 (inlined std::ptr::const_ptr::::is_null) { + debug self => _16; + let mut _17: *const u8; + scope 9 { + scope 10 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _17; + let mut _18: usize; + scope 11 (inlined std::ptr::const_ptr::::addr) { + debug self => _17; + let mut _19: *const (); + scope 12 { + scope 13 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _17; + } + } + } + } + } + } + } } } scope 3 (inlined #[track_caller] Option::::unwrap) { - debug self => _2; - let mut _10: isize; - let mut _11: !; +- debug self => _2; ++ debug self => const Option::::None; + let mut _12: isize; + let mut _13: !; scope 4 { - debug val => _1; +- debug val => _1; ++ debug val => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; } } @@ -41,56 +71,74 @@ StorageLive(_2); - _2 = Option::::None; + _2 = const Option::::None; - StorageLive(_10); -- _10 = discriminant(_2); -- switchInt(move _10) -> [0: bb2, 1: bb3, otherwise: bb5]; -+ _10 = const 0_isize; + StorageLive(_12); +- _12 = discriminant(_2); +- switchInt(move _12) -> [0: bb2, 1: bb3, otherwise: bb5]; ++ _12 = const 0_isize; + switchInt(const 0_isize) -> [0: bb2, 1: bb3, otherwise: bb5]; } bb1: { + StorageDead(_7); +- StorageLive(_16); ++ nop; + StorageLive(_14); + StorageLive(_15); + _16 = (_6.0: *const [u8]); + StorageLive(_17); + _17 = _16 as *const u8 (PtrToPtr); + StorageLive(_18); + StorageLive(_19); + _19 = _16 as *const () (PtrToPtr); + _18 = move _19 as usize (Transmute); + StorageDead(_19); + _15 = Eq(move _18, const 0_usize); + StorageDead(_18); + StorageDead(_17); + _14 = Not(move _15); + StorageDead(_15); + assume(move _14); + StorageDead(_14); + _5 = _16 as *mut [u8] (PtrToPtr); +- StorageDead(_16); ++ nop; StorageDead(_6); - StorageLive(_12); - _12 = (_5.0: *const [u8]); - _4 = move _12 as *mut [u8] (PtrToPtr); - StorageDead(_12); +- _4 = move _5 as *mut u8 (PtrToPtr); ++ _4 = _16 as *mut u8 (PtrToPtr); StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); StorageDead(_4); - StorageDead(_3); - StorageDead(_1); + nop; return; } bb2: { - _11 = option::unwrap_failed() -> unwind continue; + _13 = option::unwrap_failed() -> unwind continue; } bb3: { - _1 = move ((_2 as Some).0: std::alloc::Layout); + _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; - StorageDead(_10); + StorageDead(_12); StorageDead(_2); - StorageLive(_3); StorageLive(_4); StorageLive(_5); StorageLive(_6); StorageLive(_7); - _9 = const _; -- _7 = _9; -+ _7 = const {ALLOC1: &std::alloc::Global}; StorageLive(_8); -- _8 = _1; -- _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb4, unwind continue]; -+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; -+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb4, unwind continue]; + _11 = const _; + _8 = &(*_11); + StorageLive(_10); +- _10 = _1; +- _7 = std::alloc::Global::alloc_impl(move _8, move _10, const false) -> [return: bb4, unwind continue]; ++ _10 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; ++ _7 = std::alloc::Global::alloc_impl(move _8, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb4, unwind continue]; } bb4: { + StorageDead(_10); StorageDead(_8); - StorageDead(_7); - _5 = Result::, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue]; + _6 = Result::, std::alloc::AllocError>::unwrap(move _7) -> [return: bb1, unwind continue]; } bb5: { diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir index 8d182069adc99..bf4b3b427cdef 100644 --- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir @@ -6,20 +6,19 @@ fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () let mut _0: (); let mut _3: std::iter::FilterMap, impl Fn(T) -> Option>; let mut _4: std::iter::FilterMap, impl Fn(T) -> Option>; - let mut _5: &mut std::iter::FilterMap, impl Fn(T) -> Option>; - let mut _8: std::option::Option; - let mut _9: isize; - let _11: (); + let mut _7: std::option::Option; + let mut _8: isize; + let _10: (); scope 1 { debug iter => _4; - let _10: U; + let _9: U; scope 2 { - debug x => _10; + debug x => _9; } scope 4 (inlined , impl Fn(T) -> Option> as Iterator>::next) { - debug self => _5; - let mut _6: &mut impl Iterator; - let mut _7: &mut impl Fn(T) -> Option; + debug (*(self: &mut FilterMap, impl Fn(T) -> Option>)) => _4; + let mut _5: &mut impl Iterator; + let mut _6: &mut impl Fn(T) -> Option; } } scope 3 (inlined , impl Fn(T) -> Option> as IntoIterator>::into_iter) { @@ -37,24 +36,23 @@ fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () } bb2: { - StorageLive(_8); - _5 = &mut _4; - StorageLive(_6); - _6 = &mut (_4.0: impl Iterator); StorageLive(_7); - _7 = &mut (_4.1: impl Fn(T) -> Option); - _8 = as Iterator>::find_map:: Option>(move _6, move _7) -> [return: bb3, unwind: bb9]; + StorageLive(_5); + _5 = &mut (_4.0: impl Iterator); + StorageLive(_6); + _6 = &mut (_4.1: impl Fn(T) -> Option); + _7 = as Iterator>::find_map:: Option>(move _5, move _6) -> [return: bb3, unwind: bb9]; } bb3: { - StorageDead(_7); StorageDead(_6); - _9 = discriminant(_8); - switchInt(move _9) -> [0: bb4, 1: bb6, otherwise: bb8]; + StorageDead(_5); + _8 = discriminant(_7); + switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8]; } bb4: { - StorageDead(_8); + StorageDead(_7); drop(_4) -> [return: bb5, unwind continue]; } @@ -64,12 +62,12 @@ fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () } bb6: { - _10 = move ((_8 as Some).0: U); - _11 = opaque::(move _10) -> [return: bb7, unwind: bb9]; + _9 = move ((_7 as Some).0: U); + _10 = opaque::(move _9) -> [return: bb7, unwind: bb9]; } bb7: { - StorageDead(_8); + StorageDead(_7); goto -> bb2; } diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir index e27e417ed4ae6..18c16f16acef1 100644 --- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -4,121 +4,64 @@ fn int_range(_1: usize, _2: usize) -> () { debug start => _1; debug end => _2; let mut _0: (); - let mut _3: std::ops::Range; - let mut _4: std::ops::Range; - let mut _5: &mut std::ops::Range; - let mut _11: std::option::Option; - let mut _14: isize; - let _16: (); + let _5: (); scope 1 { - debug iter => _4; - let _15: usize; + debug ((iter: std::ops::Range).0: usize) => _1; + debug ((iter: std::ops::Range).1: usize) => _2; scope 2 { - debug i => _15; + debug i => _4; } scope 4 (inlined iter::range::>::next) { - debug self => _5; + debug ((*(self: &mut std::ops::Range)).0: usize) => _1; + debug ((*(self: &mut std::ops::Range)).1: usize) => _2; scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _5; - let mut _6: &usize; - let mut _7: &usize; - let mut _10: bool; - let _12: usize; - let mut _13: usize; + debug ((*(self: &mut std::ops::Range)).0: usize) => _1; + debug ((*(self: &mut std::ops::Range)).1: usize) => _2; + let mut _3: bool; + let _4: usize; scope 6 { - debug old => _12; + debug old => _4; scope 7 { } } scope 8 (inlined std::cmp::impls::::lt) { - debug self => _6; - debug other => _7; - let mut _8: usize; - let mut _9: usize; + debug (*(self: &usize)) => _1; + debug (*(other: &usize)) => _2; } } } } scope 3 (inlined as IntoIterator>::into_iter) { - debug self => _3; + debug ((self: std::ops::Range).0: usize) => _1; + debug ((self: std::ops::Range).1: usize) => _2; } bb0: { - _3 = std::ops::Range:: { start: _1, end: _2 }; - StorageLive(_4); - _4 = _3; goto -> bb1; } bb1: { - StorageLive(_11); - _5 = &mut _4; - StorageLive(_12); - StorageLive(_10); - StorageLive(_6); - _6 = &(_4.0: usize); - StorageLive(_7); - _7 = &(_4.1: usize); - StorageLive(_8); - _8 = (_4.0: usize); - StorageLive(_9); - _9 = (_4.1: usize); - _10 = Lt(move _8, move _9); - StorageDead(_9); - StorageDead(_8); - switchInt(move _10) -> [0: bb2, otherwise: bb3]; + StorageLive(_3); + _3 = Lt(_1, _2); + switchInt(move _3) -> [0: bb2, otherwise: bb3]; } bb2: { - StorageDead(_7); - StorageDead(_6); - _11 = const Option::::None; - goto -> bb5; + StorageDead(_3); + return; } bb3: { - StorageDead(_7); - StorageDead(_6); - _12 = (_4.0: usize); - StorageLive(_13); - _13 = ::forward_unchecked(_12, const 1_usize) -> [return: bb4, unwind continue]; + _4 = _1; + _1 = ::forward_unchecked(_4, const 1_usize) -> [return: bb4, unwind continue]; } bb4: { - (_4.0: usize) = move _13; - StorageDead(_13); - _11 = Option::::Some(_12); - goto -> bb5; + StorageDead(_3); + _5 = opaque::(move _4) -> [return: bb5, unwind continue]; } bb5: { - StorageDead(_10); - StorageDead(_12); - _14 = discriminant(_11); - switchInt(move _14) -> [0: bb6, 1: bb7, otherwise: bb9]; - } - - bb6: { - StorageDead(_11); - StorageDead(_4); - return; - } - - bb7: { - _15 = ((_11 as Some).0: usize); - _16 = opaque::(move _15) -> [return: bb8, unwind continue]; - } - - bb8: { - StorageDead(_11); goto -> bb1; } - - bb9: { - unreachable; - } -} - -ALLOC0 (size: 16, align: 8) { - 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ } diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir index b800a1be22bae..72ec7547eb861 100644 --- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -6,15 +6,28 @@ fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { let mut _0: (); let mut _3: std::iter::Map, impl Fn(T) -> U>; let mut _4: std::iter::Map, impl Fn(T) -> U>; - let mut _5: &mut std::iter::Map, impl Fn(T) -> U>; - let mut _6: std::option::Option; - let mut _7: isize; - let _9: (); + let _12: (); scope 1 { debug iter => _4; - let _8: U; scope 2 { - debug x => _8; + debug x => _11; + } + scope 4 (inlined , impl Fn(T) -> U> as Iterator>::next) { + debug (*(self: &mut Map, impl Fn(T) -> U>)) => _4; + let mut _5: &mut impl Iterator; + let mut _6: std::option::Option; + let mut _7: &mut impl Fn(T) -> U; + scope 5 (inlined Option::::map:: U>) { + debug self => _6; + debug f => _7; + let mut _8: isize; + let _9: T; + let mut _10: (T,); + let mut _11: U; + scope 6 { + debug x => _9; + } + } } } scope 3 (inlined , impl Fn(T) -> U> as IntoIterator>::into_iter) { @@ -32,20 +45,27 @@ fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { } bb2: { + StorageLive(_7); StorageLive(_6); StorageLive(_5); - _5 = &mut _4; - _6 = , impl Fn(T) -> U> as Iterator>::next(move _5) -> [return: bb3, unwind: bb9]; + _5 = &mut (_4.0: impl Iterator); + _6 = as Iterator>::next(move _5) -> [return: bb3, unwind: bb10]; } bb3: { StorageDead(_5); - _7 = discriminant(_6); - switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb8]; + _7 = &mut (_4.1: impl Fn(T) -> U); + StorageLive(_8); + StorageLive(_9); + _8 = discriminant(_6); + switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb9]; } bb4: { + StorageDead(_9); + StorageDead(_8); StorageDead(_6); + StorageDead(_7); drop(_4) -> [return: bb5, unwind continue]; } @@ -55,24 +75,34 @@ fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { } bb6: { - _8 = move ((_6 as Some).0: U); - _9 = opaque::(move _8) -> [return: bb7, unwind: bb9]; + _9 = move ((_6 as Some).0: T); + StorageLive(_10); + _10 = (_9,); + _11 = <&mut impl Fn(T) -> U as FnOnce<(T,)>>::call_once(move _7, move _10) -> [return: bb7, unwind: bb10]; } bb7: { + StorageDead(_10); + StorageDead(_9); + StorageDead(_8); StorageDead(_6); - goto -> bb2; + StorageDead(_7); + _12 = opaque::(move _11) -> [return: bb8, unwind: bb10]; } bb8: { - unreachable; + goto -> bb2; } - bb9 (cleanup): { - drop(_4) -> [return: bb10, unwind terminate(cleanup)]; + bb9: { + unreachable; } bb10 (cleanup): { + drop(_4) -> [return: bb11, unwind terminate(cleanup)]; + } + + bb11 (cleanup): { resume; } } diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index cb29473d7627f..742a240b2e670 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -3,74 +3,1038 @@ fn vec_move(_1: Vec) -> () { debug v => _1; let mut _0: (); - let mut _2: std::vec::IntoIter; - let mut _3: std::vec::IntoIter; - let mut _4: &mut std::vec::IntoIter; - let mut _5: std::option::Option; - let mut _6: isize; - let _8: (); + let mut _28: std::vec::IntoIter; + let mut _29: std::vec::IntoIter; + let mut _60: std::option::Option; + let _89: (); scope 1 { - debug iter => _3; - let _7: impl Sized; + debug iter => _29; + let _88: impl Sized; scope 2 { - debug x => _7; + debug x => _88; + } + scope 77 (inlined as Iterator>::next) { + debug (*(self: &mut std::vec::IntoIter)) => _29; + let mut _30: bool; + let mut _31: *const *const impl Sized; + let mut _32: *const std::ptr::NonNull; + let _33: std::ptr::NonNull; + let mut _49: bool; + let _50: std::ptr::NonNull; + let mut _53: std::ptr::NonNull; + let mut _59: impl Sized; + let mut _61: std::ptr::NonNull; + let mut _68: *mut impl Sized; + let mut _69: *const impl Sized; + let mut _70: *mut impl Sized; + let mut _71: bool; + let mut _72: *const impl Sized; + let mut _78: *const impl Sized; + let mut _87: impl Sized; + scope 78 { + scope 104 (inlined #[track_caller] zeroed::) { + let _79: (); + let mut _84: std::mem::MaybeUninit; + scope 105 { + scope 106 (inlined MaybeUninit::::zeroed) { + let mut _80: std::mem::MaybeUninit; + let mut _82: *mut impl Sized; + let _83: (); + scope 107 { + debug u => _80; + scope 108 { + scope 110 (inlined MaybeUninit::::as_mut_ptr) { + debug (*(self: &mut MaybeUninit)) => _80; + let mut _81: *mut std::mem::MaybeUninit; + } + scope 111 (inlined std::ptr::mut_ptr::::write_bytes) { + debug self => _82; + debug val => const 0_u8; + debug count => const 1_usize; + scope 112 { + scope 113 (inlined write_bytes::) { + debug dst => _82; + debug val => const 0_u8; + debug count => const 1_usize; + scope 114 { + scope 115 (inlined write_bytes::runtime::) { + debug dst => _82; + let mut _95: *const impl Sized; + scope 116 (inlined intrinsics::is_aligned_and_not_null::) { + debug ptr => _95; + scope 117 (inlined std::ptr::const_ptr::::is_null) { + debug self => _95; + let mut _96: *const u8; + scope 118 { + scope 119 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _96; + scope 120 (inlined std::ptr::const_ptr::::addr) { + debug self => _96; + let mut _97: *const (); + scope 121 { + scope 122 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _96; + } + } + } + } + } + } + scope 123 (inlined std::ptr::const_ptr::::is_aligned) { + debug self => _95; + let mut _98: usize; + scope 124 (inlined align_of::) { + } + scope 125 (inlined std::ptr::const_ptr::::is_aligned_to) { + debug self => _95; + debug align => _98; + let mut _99: &[&str]; + scope 126 { + scope 129 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _95; + } + scope 131 (inlined std::ptr::const_ptr::::is_aligned_to::runtime_impl) { + debug ptr => _97; + debug align => _98; + scope 132 (inlined std::ptr::const_ptr::::addr) { + debug self => _97; + scope 133 { + scope 134 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _97; + } + } + } + } + } + scope 127 (inlined core::num::::is_power_of_two) { + debug self => _98; + scope 128 (inlined core::num::::count_ones) { + debug self => _98; + } + } + scope 130 (inlined Arguments::<'_>::new_const) { + debug pieces => _99; + } + } + } + } + } + } + } + } + } + } + } + scope 109 (inlined MaybeUninit::::uninit) { + } + } + scope 135 (inlined #[track_caller] MaybeUninit::::assume_init) { + debug self => _84; + let _85: (); + let mut _86: std::mem::ManuallyDrop; + scope 136 { + scope 137 (inlined ManuallyDrop::::into_inner) { + debug slot => _86; + } + } + } + } + } + } + scope 79 { + scope 80 { + } + } + scope 81 { + debug old => _50; + scope 82 { + scope 155 (inlined NonNull::::add) { + debug self => _50; + debug count => const 1_usize; + let mut _51: *const impl Sized; + let mut _52: *const impl Sized; + scope 156 { + } + } + } + scope 83 { + scope 157 (inlined NonNull::::as_ptr) { + debug self => _50; + let mut _57: bool; + let mut _58: bool; + scope 158 { + scope 159 (inlined std::ptr::const_ptr::::is_null) { + debug self => _51; + let mut _54: *const u8; + scope 160 { + scope 161 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _54; + let mut _56: usize; + scope 162 (inlined std::ptr::const_ptr::::addr) { + debug self => _54; + let mut _55: *const (); + scope 163 { + scope 164 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _54; + } + } + } + } + } + } + } + } + scope 165 (inlined std::ptr::read::) { + debug src => _51; + scope 166 { + scope 167 (inlined std::ptr::read::runtime::) { + debug src => _51; + scope 168 (inlined intrinsics::is_aligned_and_not_null::) { + debug ptr => _51; + scope 169 (inlined std::ptr::const_ptr::::is_null) { + debug self => _51; + let mut _100: *const u8; + scope 170 { + scope 171 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _100; + scope 172 (inlined std::ptr::const_ptr::::addr) { + debug self => _100; + let mut _101: *const (); + scope 173 { + scope 174 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _100; + } + } + } + } + } + } + scope 175 (inlined std::ptr::const_ptr::::is_aligned) { + debug self => _51; + let mut _102: usize; + scope 176 (inlined align_of::) { + } + scope 177 (inlined std::ptr::const_ptr::::is_aligned_to) { + debug self => _51; + debug align => _102; + let mut _103: &[&str]; + scope 178 { + scope 181 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _51; + } + scope 183 (inlined std::ptr::const_ptr::::is_aligned_to::runtime_impl) { + debug ptr => _101; + debug align => _102; + scope 184 (inlined std::ptr::const_ptr::::addr) { + debug self => _101; + scope 185 { + scope 186 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _101; + } + } + } + } + } + scope 179 (inlined core::num::::is_power_of_two) { + debug self => _102; + scope 180 (inlined core::num::::count_ones) { + debug self => _102; + } + } + scope 182 (inlined Arguments::<'_>::new_const) { + debug pieces => _103; + } + } + } + } + } + } + } + } + } + scope 84 (inlined NonNull::::as_ptr) { + debug self => _61; + let mut _62: *const impl Sized; + let mut _66: bool; + let mut _67: bool; + scope 85 { + scope 86 (inlined std::ptr::const_ptr::::is_null) { + debug self => _62; + let mut _63: *const u8; + scope 87 { + scope 88 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _63; + let mut _65: usize; + scope 89 (inlined std::ptr::const_ptr::::addr) { + debug self => _63; + let mut _64: *const (); + scope 90 { + scope 91 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _63; + } + } + } + } + } + } + } + } + scope 92 (inlined std::ptr::const_ptr::::wrapping_byte_sub) { + debug self => _72; + debug count => const 1_usize; + let mut _73: *const u8; + let mut _74: *const u8; + scope 93 (inlined std::ptr::const_ptr::::cast::) { + debug self => _72; + } + scope 94 (inlined std::ptr::const_ptr::::wrapping_sub) { + debug self => _73; + debug count => const 1_usize; + scope 95 (inlined core::num::::wrapping_neg) { + debug self => const 1_isize; + scope 96 (inlined core::num::::wrapping_sub) { + debug self => const 0_isize; + debug rhs => const 1_isize; + } + } + scope 97 (inlined std::ptr::const_ptr::::wrapping_offset) { + debug self => _73; + debug count => const -1_isize; + scope 98 { + } + } + } + scope 99 (inlined std::ptr::const_ptr::::with_metadata_of::) { + debug self => _74; + debug meta => _72; + let mut _75: *const (); + scope 100 (inlined std::ptr::metadata::) { + debug ptr => _72; + scope 101 { + } + } + scope 102 (inlined std::ptr::from_raw_parts::) { + debug data_address => _75; + debug metadata => const (); + let mut _76: std::ptr::metadata::PtrComponents; + let mut _77: std::ptr::metadata::PtrRepr; + scope 103 { + } + } + } + } + scope 138 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => (_29.4: std::ptr::NonNull); + debug (*(other: &NonNull)) => _33; + let mut _34: std::ptr::NonNull; + let mut _41: *mut impl Sized; + let mut _48: *mut impl Sized; + scope 139 (inlined NonNull::::as_ptr) { + debug self => _34; + let mut _35: *const impl Sized; + let mut _39: bool; + let mut _40: bool; + scope 140 { + scope 141 (inlined std::ptr::const_ptr::::is_null) { + debug self => _35; + let mut _36: *const u8; + scope 142 { + scope 143 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _36; + let mut _38: usize; + scope 144 (inlined std::ptr::const_ptr::::addr) { + debug self => _36; + let mut _37: *const (); + scope 145 { + scope 146 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _36; + } + } + } + } + } + } + } + } + scope 147 (inlined NonNull::::as_ptr) { + debug self => _33; + let mut _42: *const impl Sized; + let mut _46: bool; + let mut _47: bool; + scope 148 { + scope 149 (inlined std::ptr::const_ptr::::is_null) { + debug self => _42; + let mut _43: *const u8; + scope 150 { + scope 151 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _43; + let mut _45: usize; + scope 152 (inlined std::ptr::const_ptr::::addr) { + debug self => _43; + let mut _44: *const (); + scope 153 { + scope 154 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _43; + } + } + } + } + } + } + } + } + } + } + } + scope 3 (inlined as IntoIterator>::into_iter) { + debug self => _1; + let mut _11: bool; + let mut _12: usize; + let mut _13: *mut impl Sized; + let mut _14: *const impl Sized; + let mut _15: usize; + let mut _24: *mut impl Sized; + let mut _26: usize; + scope 4 { + let mut _2: std::mem::ManuallyDrop>; + scope 5 { + debug me => _2; + scope 6 { + debug alloc => const ManuallyDrop:: {{ value: std::alloc::Global }}; + let _10: *mut impl Sized; + scope 7 { + debug begin => _10; + scope 8 { + debug end => _14; + scope 9 { + debug cap => _26; + let _27: std::ptr::NonNull; + scope 10 { + debug buf => _27; + } + scope 68 (inlined NonNull::::new_unchecked) { + debug ptr => _10; + scope 69 { + scope 70 (inlined NonNull::::new_unchecked::runtime::) { + debug ptr => _10; + scope 71 (inlined std::ptr::mut_ptr::::is_null) { + debug self => _10; + let mut _94: *mut u8; + scope 72 { + scope 73 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { + debug ptr => _94; + scope 74 (inlined std::ptr::mut_ptr::::addr) { + debug self => _94; + scope 75 { + scope 76 (inlined std::ptr::mut_ptr::::cast::<()>) { + debug self => _94; + } + } + } + } + } + } + } + } + } + } + scope 66 (inlined > as Deref>::deref) { + debug (*(self: &ManuallyDrop>)) => _2; + } + scope 67 (inlined alloc::raw_vec::RawVec::::capacity) { + debug (*(self: &alloc::raw_vec::RawVec)) => (_1.0: alloc::raw_vec::RawVec); + let mut _25: bool; + } + } + scope 50 (inlined > as Deref>::deref) { + debug (*(self: &ManuallyDrop>)) => _2; + } + scope 51 (inlined Vec::::len) { + debug (*(self: &Vec)) => _1; + } + scope 52 (inlined std::ptr::mut_ptr::::wrapping_byte_add) { + debug self => _10; + debug count => _12; + let mut _16: *mut u8; + let mut _19: *mut u8; + scope 53 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _10; + } + scope 54 (inlined std::ptr::mut_ptr::::wrapping_add) { + debug self => _16; + debug count => _12; + let mut _17: isize; + scope 55 (inlined std::ptr::mut_ptr::::wrapping_offset) { + debug self => _16; + debug count => _17; + let mut _18: *const u8; + scope 56 { + } + } + } + scope 57 (inlined std::ptr::mut_ptr::::with_metadata_of::) { + debug self => _19; + debug meta => _4; + let mut _20: *mut (); + scope 58 (inlined std::ptr::metadata::) { + debug ptr => _4; + scope 59 { + } + } + scope 60 (inlined std::ptr::from_raw_parts_mut::) { + debug data_address => _20; + debug metadata => const (); + let mut _21: *const (); + let mut _22: std::ptr::metadata::PtrComponents; + let mut _23: std::ptr::metadata::PtrRepr; + scope 61 { + } + } + } + } + scope 62 (inlined > as Deref>::deref) { + debug (*(self: &ManuallyDrop>)) => _2; + } + scope 63 (inlined Vec::::len) { + debug (*(self: &Vec)) => _1; + } + scope 64 (inlined std::ptr::mut_ptr::::add) { + debug self => _10; + debug count => _12; + scope 65 { + } + } + } + scope 38 (inlined > as DerefMut>::deref_mut) { + debug (*(self: &mut ManuallyDrop>)) => _2; + } + scope 39 (inlined Vec::::as_mut_ptr) { + debug (*(self: &mut Vec)) => _1; + scope 40 (inlined alloc::raw_vec::RawVec::::ptr) { + debug (*(self: &alloc::raw_vec::RawVec)) => (_1.0: alloc::raw_vec::RawVec); + let mut _3: std::ptr::NonNull; + scope 41 (inlined Unique::::as_ptr) { + debug ((self: Unique).0: std::ptr::NonNull) => _3; + debug ((self: Unique).1: std::marker::PhantomData) => const ZeroSized: PhantomData; + scope 42 (inlined NonNull::::as_ptr) { + debug self => _3; + let mut _4: *const impl Sized; + let mut _8: bool; + let mut _9: bool; + scope 43 { + scope 44 (inlined std::ptr::const_ptr::::is_null) { + debug self => _4; + let mut _5: *const u8; + scope 45 { + scope 46 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _5; + let mut _7: usize; + scope 47 (inlined std::ptr::const_ptr::::addr) { + debug self => _5; + let mut _6: *const (); + scope 48 { + scope 49 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _5; + } + } + } + } + } + } + } + } + } + } + } + } + scope 12 (inlined > as Deref>::deref) { + debug (*(self: &ManuallyDrop>)) => _2; + } + scope 13 (inlined Vec::::allocator) { + debug (*(self: &Vec)) => _1; + scope 14 (inlined alloc::raw_vec::RawVec::::allocator) { + debug (*(self: &alloc::raw_vec::RawVec)) => (_1.0: alloc::raw_vec::RawVec); + } + } + scope 15 (inlined std::ptr::read::) { + debug (*(src: *const std::alloc::Global)) => const std::alloc::Global; + scope 16 { + scope 17 (inlined std::ptr::read::runtime::) { + debug (*(src: *const std::alloc::Global)) => const std::alloc::Global; + scope 18 (inlined intrinsics::is_aligned_and_not_null::) { + debug (*(ptr: *const std::alloc::Global)) => const std::alloc::Global; + scope 19 (inlined std::ptr::const_ptr::::is_null) { + debug (*(self: *const std::alloc::Global)) => const std::alloc::Global; + let mut _90: *const u8; + scope 20 { + scope 21 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _90; + scope 22 (inlined std::ptr::const_ptr::::addr) { + debug self => _90; + let mut _91: *const (); + scope 23 { + scope 24 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _90; + } + } + } + } + } + } + scope 25 (inlined std::ptr::const_ptr::::is_aligned) { + debug (*(self: *const std::alloc::Global)) => const std::alloc::Global; + let mut _92: usize; + scope 26 (inlined align_of::) { + } + scope 27 (inlined std::ptr::const_ptr::::is_aligned_to) { + debug (*(self: *const std::alloc::Global)) => const std::alloc::Global; + debug align => _92; + let mut _93: &[&str]; + scope 28 { + scope 31 (inlined std::ptr::const_ptr::::cast::<()>) { + debug (*(self: *const std::alloc::Global)) => const std::alloc::Global; + } + scope 33 (inlined std::ptr::const_ptr::::is_aligned_to::runtime_impl) { + debug ptr => _91; + debug align => _92; + scope 34 (inlined std::ptr::const_ptr::::addr) { + debug self => _91; + scope 35 { + scope 36 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _91; + } + } + } + } + } + scope 29 (inlined core::num::::is_power_of_two) { + debug self => _92; + scope 30 (inlined core::num::::count_ones) { + debug self => _92; + } + } + scope 32 (inlined Arguments::<'_>::new_const) { + debug pieces => _93; + } + } + } + } + } + } + } + scope 37 (inlined ManuallyDrop::::new) { + debug value => const std::alloc::Global; + } + } + scope 11 (inlined ManuallyDrop::>::new) { + debug value => _1; + } } } bb0: { + StorageLive(_28); + StorageLive(_10); + StorageLive(_27); + StorageLive(_26); + StorageLive(_14); + StorageLive(_4); + StorageLive(_5); StorageLive(_2); - _2 = as IntoIterator>::into_iter(move _1) -> [return: bb1, unwind continue]; + _2 = ManuallyDrop::> { value: _1 }; + StorageLive(_90); + StorageLive(_91); + StorageLive(_92); + StorageLive(_93); + StorageDead(_93); + StorageDead(_92); + StorageDead(_91); + StorageDead(_90); + StorageLive(_3); + _3 = (((_1.0: alloc::raw_vec::RawVec).0: std::ptr::Unique).0: std::ptr::NonNull); + StorageLive(_9); + StorageLive(_8); + _4 = (_3.0: *const impl Sized); + _5 = _4 as *const u8 (PtrToPtr); + StorageLive(_7); + StorageLive(_6); + _6 = _4 as *const () (PtrToPtr); + _7 = move _6 as usize (Transmute); + StorageDead(_6); + _8 = Eq(move _7, const 0_usize); + StorageDead(_7); + _9 = Not(move _8); + StorageDead(_8); + assume(move _9); + StorageDead(_9); + _10 = _4 as *mut impl Sized (PtrToPtr); + StorageDead(_3); + StorageLive(_11); + _11 = const _; + switchInt(move _11) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_3); - _3 = move _2; - goto -> bb2; + StorageLive(_13); + StorageLive(_12); + _12 = (_1.1: usize); + _13 = Offset(_10, _12); + _14 = move _13 as *const impl Sized (PointerCoercion(MutToConstPointer)); + StorageDead(_12); + StorageDead(_13); + goto -> bb4; } bb2: { - StorageLive(_5); - StorageLive(_4); - _4 = &mut _3; - _5 = as Iterator>::next(move _4) -> [return: bb3, unwind: bb9]; + StorageLive(_24); + StorageLive(_15); + _15 = (_1.1: usize); + StorageLive(_18); + StorageLive(_19); + StorageLive(_16); + _16 = _4 as *mut u8 (PtrToPtr); + StorageLive(_17); + _17 = _15 as isize (IntToInt); + _18 = arith_offset::(move _5, move _17) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_4); - _6 = discriminant(_5); - switchInt(move _6) -> [0: bb4, 1: bb6, otherwise: bb8]; + _19 = _18 as *mut u8 (PtrToPtr); + StorageDead(_17); + StorageDead(_16); + StorageLive(_20); + _20 = _18 as *mut () (PtrToPtr); + StorageLive(_23); + StorageLive(_22); + StorageLive(_21); + _21 = _18 as *const () (PtrToPtr); + _22 = std::ptr::metadata::PtrComponents:: { data_address: move _21, metadata: const () }; + StorageDead(_21); + _23 = std::ptr::metadata::PtrRepr:: { const_ptr: move _22 }; + StorageDead(_22); + _24 = (_23.1: *mut impl Sized); + StorageDead(_23); + StorageDead(_20); + StorageDead(_19); + StorageDead(_18); + StorageDead(_15); + _14 = move _24 as *const impl Sized (PointerCoercion(MutToConstPointer)); + StorageDead(_24); + goto -> bb4; } bb4: { - StorageDead(_5); - drop(_3) -> [return: bb5, unwind continue]; + StorageDead(_11); + StorageLive(_25); + _25 = const _; + switchInt(move _25) -> [0: bb5, otherwise: bb6]; } bb5: { - StorageDead(_3); - StorageDead(_2); - return; + _26 = (((_1.0: alloc::raw_vec::RawVec).1: alloc::raw_vec::Cap).0: usize); + goto -> bb7; } bb6: { - _7 = move ((_5 as Some).0: impl Sized); - _8 = opaque::(move _7) -> [return: bb7, unwind: bb9]; + _26 = const _; + goto -> bb7; } bb7: { + StorageDead(_25); + StorageLive(_94); + _27 = NonNull:: { pointer: _4 }; + StorageDead(_94); + _28 = std::vec::IntoIter:: { buf: _27, phantom: const ZeroSized: PhantomData, cap: move _26, alloc: const ManuallyDrop:: {{ value: std::alloc::Global }}, ptr: _27, end: move _14 }; + StorageDead(_2); StorageDead(_5); - goto -> bb2; + StorageDead(_4); + StorageDead(_14); + StorageDead(_26); + StorageDead(_27); + StorageDead(_10); + StorageLive(_29); + _29 = move _28; + goto -> bb8; } bb8: { - unreachable; + StorageLive(_60); + StorageLive(_70); + StorageLive(_33); + StorageLive(_50); + StorageLive(_51); + StorageLive(_30); + _30 = const _; + switchInt(move _30) -> [0: bb9, otherwise: bb12]; + } + + bb9: { + StorageLive(_49); + StorageLive(_32); + StorageLive(_31); + _31 = &raw const (_29.5: *const impl Sized); + _32 = move _31 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_31); + _33 = (*_32); + StorageLive(_41); + StorageLive(_34); + _34 = (_29.4: std::ptr::NonNull); + StorageLive(_35); + StorageLive(_40); + StorageLive(_39); + _35 = (_34.0: *const impl Sized); + StorageLive(_36); + _36 = _35 as *const u8 (PtrToPtr); + StorageLive(_38); + StorageLive(_37); + _37 = _35 as *const () (PtrToPtr); + _38 = move _37 as usize (Transmute); + StorageDead(_37); + _39 = Eq(move _38, const 0_usize); + StorageDead(_38); + StorageDead(_36); + _40 = Not(move _39); + StorageDead(_39); + assume(move _40); + StorageDead(_40); + _41 = _35 as *mut impl Sized (PtrToPtr); + StorageDead(_35); + StorageDead(_34); + StorageLive(_48); + StorageLive(_42); + StorageLive(_47); + StorageLive(_46); + _42 = (_33.0: *const impl Sized); + StorageLive(_43); + _43 = _42 as *const u8 (PtrToPtr); + StorageLive(_45); + StorageLive(_44); + _44 = _42 as *const () (PtrToPtr); + _45 = move _44 as usize (Transmute); + StorageDead(_44); + _46 = Eq(move _45, const 0_usize); + StorageDead(_45); + StorageDead(_43); + _47 = Not(move _46); + StorageDead(_46); + assume(move _47); + StorageDead(_47); + _48 = _42 as *mut impl Sized (PtrToPtr); + StorageDead(_42); + _49 = Eq(move _41, move _48); + StorageDead(_48); + StorageDead(_41); + switchInt(move _49) -> [0: bb10, otherwise: bb11]; + } + + bb10: { + StorageDead(_32); + _50 = (_29.4: std::ptr::NonNull); + StorageLive(_53); + StorageLive(_52); + _51 = (_50.0: *const impl Sized); + _52 = Offset(_51, const 1_usize); + _53 = NonNull:: { pointer: move _52 }; + StorageDead(_52); + (_29.4: std::ptr::NonNull) = move _53; + StorageDead(_53); + StorageLive(_59); + StorageLive(_58); + StorageLive(_57); + StorageLive(_54); + _54 = _51 as *const u8 (PtrToPtr); + StorageLive(_56); + StorageLive(_55); + _55 = _51 as *const () (PtrToPtr); + _56 = move _55 as usize (Transmute); + StorageDead(_55); + _57 = Eq(move _56, const 0_usize); + StorageDead(_56); + StorageDead(_54); + _58 = Not(move _57); + StorageDead(_57); + assume(move _58); + StorageDead(_58); + StorageLive(_100); + StorageLive(_101); + StorageLive(_102); + StorageLive(_103); + _59 = (*_51); + StorageDead(_103); + StorageDead(_102); + StorageDead(_101); + StorageDead(_100); + _60 = Option::::Some(move _59); + StorageDead(_59); + StorageDead(_49); + StorageDead(_30); + StorageDead(_51); + StorageDead(_50); + StorageDead(_33); + StorageDead(_70); + goto -> bb18; + } + + bb11: { + StorageDead(_32); + StorageDead(_49); + StorageDead(_30); + StorageDead(_51); + StorageDead(_50); + StorageDead(_33); + StorageDead(_70); + goto -> bb23; } - bb9 (cleanup): { - drop(_3) -> [return: bb10, unwind terminate(cleanup)]; + bb12: { + StorageLive(_71); + StorageLive(_68); + StorageLive(_61); + _61 = (_29.4: std::ptr::NonNull); + StorageLive(_62); + StorageLive(_67); + StorageLive(_66); + _62 = (_61.0: *const impl Sized); + StorageLive(_63); + _63 = _62 as *const u8 (PtrToPtr); + StorageLive(_65); + StorageLive(_64); + _64 = _62 as *const () (PtrToPtr); + _65 = move _64 as usize (Transmute); + StorageDead(_64); + _66 = Eq(move _65, const 0_usize); + StorageDead(_65); + StorageDead(_63); + _67 = Not(move _66); + StorageDead(_66); + assume(move _67); + StorageDead(_67); + _68 = _62 as *mut impl Sized (PtrToPtr); + StorageDead(_62); + StorageDead(_61); + StorageLive(_69); + _69 = (_29.5: *const impl Sized); + _70 = move _69 as *mut impl Sized (PtrToPtr); + StorageDead(_69); + _71 = Eq(move _68, _70); + switchInt(move _71) -> [0: bb13, otherwise: bb22]; } - bb10 (cleanup): { + bb13: { + StorageDead(_68); + StorageLive(_78); + StorageLive(_72); + _72 = (_29.5: *const impl Sized); + StorageLive(_74); + StorageLive(_73); + _73 = _72 as *const u8 (PtrToPtr); + _74 = arith_offset::(move _73, const -1_isize) -> [return: bb14, unwind unreachable]; + } + + bb14: { + StorageDead(_73); + StorageLive(_75); + _75 = _74 as *const () (PtrToPtr); + StorageLive(_77); + StorageLive(_76); + _76 = std::ptr::metadata::PtrComponents:: { data_address: _75, metadata: const () }; + _77 = std::ptr::metadata::PtrRepr:: { const_ptr: move _76 }; + StorageDead(_76); + _78 = (_77.0: *const impl Sized); + StorageDead(_77); + StorageDead(_75); + StorageDead(_74); + StorageDead(_72); + (_29.5: *const impl Sized) = move _78; + StorageDead(_78); + StorageLive(_87); + _79 = assert_zero_valid::() -> [return: bb15, unwind unreachable]; + } + + bb15: { + StorageLive(_84); + StorageLive(_80); + _80 = MaybeUninit:: { uninit: const () }; + StorageLive(_82); + StorageLive(_81); + _81 = &raw mut _80; + _82 = _81 as *mut impl Sized (PtrToPtr); + StorageDead(_81); + StorageLive(_95); + StorageLive(_96); + StorageLive(_97); + StorageLive(_98); + StorageLive(_99); + _83 = write_bytes::write_bytes::(move _82, const 0_u8, const 1_usize) -> [return: bb16, unwind unreachable]; + } + + bb16: { + StorageDead(_99); + StorageDead(_98); + StorageDead(_97); + StorageDead(_96); + StorageDead(_95); + StorageDead(_82); + _84 = move _80; + StorageDead(_80); + _85 = assert_inhabited::() -> [return: bb17, unwind unreachable]; + } + + bb17: { + StorageLive(_86); + _86 = move (_84.1: std::mem::ManuallyDrop); + _87 = move (_86.0: impl Sized); + StorageDead(_86); + StorageDead(_84); + _60 = Option::::Some(move _87); + StorageDead(_87); + StorageDead(_71); + StorageDead(_30); + StorageDead(_51); + StorageDead(_50); + StorageDead(_33); + StorageDead(_70); + goto -> bb18; + } + + bb18: { + _88 = move ((_60 as Some).0: impl Sized); + _89 = opaque::(move _88) -> [return: bb19, unwind: bb20]; + } + + bb19: { + StorageDead(_60); + goto -> bb8; + } + + bb20 (cleanup): { + drop(_29) -> [return: bb21, unwind terminate(cleanup)]; + } + + bb21 (cleanup): { resume; } + + bb22: { + StorageDead(_68); + StorageDead(_71); + StorageDead(_30); + StorageDead(_51); + StorageDead(_50); + StorageDead(_33); + StorageDead(_70); + goto -> bb23; + } + + bb23: { + StorageDead(_60); + drop(_29) -> [return: bb24, unwind continue]; + } + + bb24: { + StorageDead(_29); + StorageDead(_28); + return; + } } diff --git a/tests/mir-opt/pre-codegen/matches_macro.issue_77355_opt.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/matches_macro.issue_77355_opt.PreCodegen.after.mir new file mode 100644 index 0000000000000..d41135c6a4fa3 --- /dev/null +++ b/tests/mir-opt/pre-codegen/matches_macro.issue_77355_opt.PreCodegen.after.mir @@ -0,0 +1,22 @@ +// MIR for `issue_77355_opt` after PreCodegen + +fn issue_77355_opt(_1: Foo) -> u64 { + debug num => _1; + let mut _0: u64; + let mut _2: isize; + + bb0: { + _2 = discriminant(_1); + switchInt(move _2) -> [1: bb1, 2: bb1, otherwise: bb2]; + } + + bb1: { + _0 = const 23_u64; + return; + } + + bb2: { + _0 = const 42_u64; + return; + } +} diff --git a/tests/mir-opt/pre-codegen/matches_macro.rs b/tests/mir-opt/pre-codegen/matches_macro.rs new file mode 100644 index 0000000000000..42de229657189 --- /dev/null +++ b/tests/mir-opt/pre-codegen/matches_macro.rs @@ -0,0 +1,27 @@ +// This test verifies that the MIR we output using the `matches!()` macro is close +// to the MIR for an `if let` branch. + +pub enum Foo { + A, + B, + C, + D, + E, + F, +} + +// EMIT_MIR matches_macro.issue_77355_opt.PreCodegen.after.mir +fn issue_77355_opt(num: Foo) -> u64 { + // CHECK-LABEL: fn issue_77355_opt( + // CHECK: switchInt({{.*}}) -> [1: bb1, 2: bb1, otherwise: bb2]; + // CHECK: bb1: { + // CHECK-NEXT: _0 = const 23_u64; + // CHECK-NEXT: return; + // CHECK: bb2: { + // CHECK-NEXT: _0 = const 42_u64; + // CHECK-NEXT: return; + if matches!(num, Foo::B | Foo::C) { 23 } else { 42 } +} +fn main() { + issue_77355_opt(Foo::A); +} diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir index f0cb4ca31fecc..2ac4f92e3800f 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir @@ -10,32 +10,94 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { scope 2 { scope 3 { debug result => _0; - scope 16 (inlined std::ptr::write::) { + scope 26 (inlined std::ptr::write::) { debug dst => _1; debug src => _2; - scope 17 { + scope 27 { + scope 28 (inlined std::ptr::write::runtime::) { + debug dst => _1; + let mut _7: *const u32; + scope 29 (inlined intrinsics::is_aligned_and_not_null::) { + debug ptr => _7; + scope 30 (inlined std::ptr::const_ptr::::is_null) { + debug self => _7; + let mut _8: *const u8; + scope 31 { + scope 32 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _8; + scope 33 (inlined std::ptr::const_ptr::::addr) { + debug self => _8; + let mut _9: *const (); + scope 34 { + scope 35 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _8; + } + } + } + } + } + } + scope 36 (inlined std::ptr::const_ptr::::is_aligned) { + debug self => _7; + let mut _10: usize; + scope 37 (inlined align_of::) { + } + scope 38 (inlined std::ptr::const_ptr::::is_aligned_to) { + debug self => _7; + debug align => _10; + let mut _11: &[&str]; + scope 39 { + scope 42 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _7; + } + scope 44 (inlined std::ptr::const_ptr::::is_aligned_to::runtime_impl) { + debug ptr => _9; + debug align => _10; + scope 45 (inlined std::ptr::const_ptr::::addr) { + debug self => _9; + scope 46 { + scope 47 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _9; + } + } + } + } + } + scope 40 (inlined core::num::::is_power_of_two) { + debug self => _10; + scope 41 (inlined core::num::::count_ones) { + debug self => _10; + } + } + scope 43 (inlined Arguments::<'_>::new_const) { + debug pieces => _11; + } + } + } + } + } } } } scope 4 (inlined std::ptr::read::) { debug src => _1; - let mut _3: *const u32; scope 5 { scope 6 (inlined std::ptr::read::runtime::) { - debug src => _3; + debug src => _1; scope 7 (inlined intrinsics::is_aligned_and_not_null::) { - debug ptr => _3; + debug ptr => _1; scope 8 (inlined std::ptr::const_ptr::::is_null) { - debug self => _3; - let mut _4: *const u8; + debug self => _1; + let mut _3: *const u8; scope 9 { scope 10 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { - debug ptr => _4; + debug ptr => _3; scope 11 (inlined std::ptr::const_ptr::::addr) { - debug self => _4; + debug self => _3; + let mut _4: *const (); scope 12 { scope 13 (inlined std::ptr::const_ptr::::cast::<()>) { - debug self => _4; + debug self => _3; } } } @@ -43,9 +105,41 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { } } scope 14 (inlined std::ptr::const_ptr::::is_aligned) { - debug self => _3; + debug self => _1; + let mut _5: usize; scope 15 (inlined align_of::) { } + scope 16 (inlined std::ptr::const_ptr::::is_aligned_to) { + debug self => _1; + debug align => _5; + let mut _6: &[&str]; + scope 17 { + scope 20 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _1; + } + scope 22 (inlined std::ptr::const_ptr::::is_aligned_to::runtime_impl) { + debug ptr => _4; + debug align => _5; + scope 23 (inlined std::ptr::const_ptr::::addr) { + debug self => _4; + scope 24 { + scope 25 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _4; + } + } + } + } + } + scope 18 (inlined core::num::::is_power_of_two) { + debug self => _5; + scope 19 (inlined core::num::::count_ones) { + debug self => _5; + } + } + scope 21 (inlined Arguments::<'_>::new_const) { + debug pieces => _6; + } + } } } } @@ -57,10 +151,24 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { bb0: { StorageLive(_3); StorageLive(_4); + StorageLive(_5); + StorageLive(_6); _0 = (*_1); + StorageDead(_6); + StorageDead(_5); StorageDead(_4); StorageDead(_3); + StorageLive(_7); + StorageLive(_8); + StorageLive(_9); + StorageLive(_10); + StorageLive(_11); (*_1) = _2; + StorageDead(_11); + StorageDead(_10); + StorageDead(_9); + StorageDead(_8); + StorageDead(_7); return; } } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff index 0e7e1f971ec34..879f150b9087a 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff @@ -9,15 +9,18 @@ let _5: usize; let mut _6: usize; let mut _7: bool; - let mut _9: u32; + let mut _9: Point; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_i32; let _3: i32; scope 2 { - debug y => _3; +- debug y => _3; ++ debug y => const 3_i32; let _8: u32; scope 3 { - debug z => _8; +- debug z => _8; ++ debug z => const 42_u32; } } } @@ -38,9 +41,10 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = const 6_usize; +- _6 = Len(_4); - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; ++ _6 = const 6_usize; + _7 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; } @@ -52,8 +56,9 @@ StorageDead(_4); StorageLive(_8); StorageLive(_9); - _9 = const 42_u32; -- _8 = _9; +- _9 = Point { x: const 12_u32, y: const 42_u32 }; +- _8 = (_9.1: u32); ++ _9 = const Point {{ x: 12_u32, y: 42_u32 }}; + _8 = const 42_u32; StorageDead(_9); StorageDead(_8); @@ -65,5 +70,9 @@ + + ALLOC0 (size: 8, align: 4) { + 04 00 00 00 00 __ __ __ │ .....░░░ ++ } ++ ++ ALLOC1 (size: 8, align: 4) { ++ 0c 00 00 00 2a 00 00 00 │ ....*... } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff index 9071a3339c080..e867fad54d99b 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff @@ -9,15 +9,18 @@ let _5: usize; let mut _6: usize; let mut _7: bool; - let mut _9: u32; + let mut _9: Point; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_i32; let _3: i32; scope 2 { - debug y => _3; +- debug y => _3; ++ debug y => const 3_i32; let _8: u32; scope 3 { - debug z => _8; +- debug z => _8; ++ debug z => const 42_u32; } } } @@ -38,9 +41,10 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = const 6_usize; +- _6 = Len(_4); - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; ++ _6 = const 6_usize; + _7 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } @@ -52,8 +56,9 @@ StorageDead(_4); StorageLive(_8); StorageLive(_9); - _9 = const 42_u32; -- _8 = _9; +- _9 = Point { x: const 12_u32, y: const 42_u32 }; +- _8 = (_9.1: u32); ++ _9 = const Point {{ x: 12_u32, y: 42_u32 }}; + _8 = const 42_u32; StorageDead(_9); StorageDead(_8); @@ -65,5 +70,9 @@ + + ALLOC0 (size: 8, align: 4) { + 04 00 00 00 00 __ __ __ │ .....░░░ ++ } ++ ++ ALLOC1 (size: 8, align: 4) { ++ 0c 00 00 00 2a 00 00 00 │ ....*... } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff index 0e7e1f971ec34..879f150b9087a 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff @@ -9,15 +9,18 @@ let _5: usize; let mut _6: usize; let mut _7: bool; - let mut _9: u32; + let mut _9: Point; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_i32; let _3: i32; scope 2 { - debug y => _3; +- debug y => _3; ++ debug y => const 3_i32; let _8: u32; scope 3 { - debug z => _8; +- debug z => _8; ++ debug z => const 42_u32; } } } @@ -38,9 +41,10 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = const 6_usize; +- _6 = Len(_4); - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; ++ _6 = const 6_usize; + _7 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; } @@ -52,8 +56,9 @@ StorageDead(_4); StorageLive(_8); StorageLive(_9); - _9 = const 42_u32; -- _8 = _9; +- _9 = Point { x: const 12_u32, y: const 42_u32 }; +- _8 = (_9.1: u32); ++ _9 = const Point {{ x: 12_u32, y: 42_u32 }}; + _8 = const 42_u32; StorageDead(_9); StorageDead(_8); @@ -65,5 +70,9 @@ + + ALLOC0 (size: 8, align: 4) { + 04 00 00 00 00 __ __ __ │ .....░░░ ++ } ++ ++ ALLOC1 (size: 8, align: 4) { ++ 0c 00 00 00 2a 00 00 00 │ ....*... } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff index 9071a3339c080..e867fad54d99b 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff @@ -9,15 +9,18 @@ let _5: usize; let mut _6: usize; let mut _7: bool; - let mut _9: u32; + let mut _9: Point; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_i32; let _3: i32; scope 2 { - debug y => _3; +- debug y => _3; ++ debug y => const 3_i32; let _8: u32; scope 3 { - debug z => _8; +- debug z => _8; ++ debug z => const 42_u32; } } } @@ -38,9 +41,10 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = const 6_usize; +- _6 = Len(_4); - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; ++ _6 = const 6_usize; + _7 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } @@ -52,8 +56,9 @@ StorageDead(_4); StorageLive(_8); StorageLive(_9); - _9 = const 42_u32; -- _8 = _9; +- _9 = Point { x: const 12_u32, y: const 42_u32 }; +- _8 = (_9.1: u32); ++ _9 = const Point {{ x: 12_u32, y: 42_u32 }}; + _8 = const 42_u32; StorageDead(_9); StorageDead(_8); @@ -65,5 +70,9 @@ + + ALLOC0 (size: 8, align: 4) { + 04 00 00 00 00 __ __ __ │ .....░░░ ++ } ++ ++ ALLOC1 (size: 8, align: 4) { ++ 0c 00 00 00 2a 00 00 00 │ ....*... } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff index 5f2a096bb1f76..5a80398a2378e 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff @@ -3,67 +3,17 @@ fn main() -> () { let mut _0: (); - let _1: i32; - let mut _2: (i32, bool); - let mut _4: [i32; 6]; - let _5: usize; - let mut _6: usize; - let mut _7: bool; - let mut _9: Point; -+ let mut _10: u32; -+ let mut _11: u32; scope 1 { - debug x => _1; - let _3: i32; + debug x => const 4_i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => const 3_i32; scope 3 { - debug z => _8; + debug z => const 42_u32; } } } bb0: { - StorageLive(_1); - _2 = CheckedAdd(const 2_i32, const 2_i32); - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; - } - - bb1: { - _1 = move (_2.0: i32); - StorageLive(_3); - StorageLive(_4); - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; - StorageLive(_5); - _5 = const 3_usize; - _6 = Len(_4); - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; - } - - bb2: { - _3 = _4[_5]; - StorageDead(_5); - StorageDead(_4); - StorageLive(_8); -- StorageLive(_9); -- _9 = Point { x: const 12_u32, y: const 42_u32 }; -- _8 = (_9.1: u32); -- StorageDead(_9); -+ StorageLive(_10); -+ StorageLive(_11); -+ nop; -+ _10 = const 12_u32; -+ _11 = const 42_u32; -+ nop; -+ _8 = _11; -+ StorageDead(_10); -+ StorageDead(_11); -+ nop; - StorageDead(_8); - StorageDead(_3); - StorageDead(_1); return; } } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff index a49546f158c8b..5a80398a2378e 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff @@ -3,67 +3,17 @@ fn main() -> () { let mut _0: (); - let _1: i32; - let mut _2: (i32, bool); - let mut _4: [i32; 6]; - let _5: usize; - let mut _6: usize; - let mut _7: bool; - let mut _9: Point; -+ let mut _10: u32; -+ let mut _11: u32; scope 1 { - debug x => _1; - let _3: i32; + debug x => const 4_i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => const 3_i32; scope 3 { - debug z => _8; + debug z => const 42_u32; } } } bb0: { - StorageLive(_1); - _2 = CheckedAdd(const 2_i32, const 2_i32); - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; - } - - bb1: { - _1 = move (_2.0: i32); - StorageLive(_3); - StorageLive(_4); - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; - StorageLive(_5); - _5 = const 3_usize; - _6 = Len(_4); - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; - } - - bb2: { - _3 = _4[_5]; - StorageDead(_5); - StorageDead(_4); - StorageLive(_8); -- StorageLive(_9); -- _9 = Point { x: const 12_u32, y: const 42_u32 }; -- _8 = (_9.1: u32); -- StorageDead(_9); -+ StorageLive(_10); -+ StorageLive(_11); -+ nop; -+ _10 = const 12_u32; -+ _11 = const 42_u32; -+ nop; -+ _8 = _11; -+ StorageDead(_10); -+ StorageDead(_11); -+ nop; - StorageDead(_8); - StorageDead(_3); - StorageDead(_1); return; } } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff index 5f2a096bb1f76..5a80398a2378e 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff @@ -3,67 +3,17 @@ fn main() -> () { let mut _0: (); - let _1: i32; - let mut _2: (i32, bool); - let mut _4: [i32; 6]; - let _5: usize; - let mut _6: usize; - let mut _7: bool; - let mut _9: Point; -+ let mut _10: u32; -+ let mut _11: u32; scope 1 { - debug x => _1; - let _3: i32; + debug x => const 4_i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => const 3_i32; scope 3 { - debug z => _8; + debug z => const 42_u32; } } } bb0: { - StorageLive(_1); - _2 = CheckedAdd(const 2_i32, const 2_i32); - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; - } - - bb1: { - _1 = move (_2.0: i32); - StorageLive(_3); - StorageLive(_4); - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; - StorageLive(_5); - _5 = const 3_usize; - _6 = Len(_4); - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; - } - - bb2: { - _3 = _4[_5]; - StorageDead(_5); - StorageDead(_4); - StorageLive(_8); -- StorageLive(_9); -- _9 = Point { x: const 12_u32, y: const 42_u32 }; -- _8 = (_9.1: u32); -- StorageDead(_9); -+ StorageLive(_10); -+ StorageLive(_11); -+ nop; -+ _10 = const 12_u32; -+ _11 = const 42_u32; -+ nop; -+ _8 = _11; -+ StorageDead(_10); -+ StorageDead(_11); -+ nop; - StorageDead(_8); - StorageDead(_3); - StorageDead(_1); return; } } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff index a49546f158c8b..5a80398a2378e 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff @@ -3,67 +3,17 @@ fn main() -> () { let mut _0: (); - let _1: i32; - let mut _2: (i32, bool); - let mut _4: [i32; 6]; - let _5: usize; - let mut _6: usize; - let mut _7: bool; - let mut _9: Point; -+ let mut _10: u32; -+ let mut _11: u32; scope 1 { - debug x => _1; - let _3: i32; + debug x => const 4_i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => const 3_i32; scope 3 { - debug z => _8; + debug z => const 42_u32; } } } bb0: { - StorageLive(_1); - _2 = CheckedAdd(const 2_i32, const 2_i32); - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; - } - - bb1: { - _1 = move (_2.0: i32); - StorageLive(_3); - StorageLive(_4); - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; - StorageLive(_5); - _5 = const 3_usize; - _6 = Len(_4); - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; - } - - bb2: { - _3 = _4[_5]; - StorageDead(_5); - StorageDead(_4); - StorageLive(_8); -- StorageLive(_9); -- _9 = Point { x: const 12_u32, y: const 42_u32 }; -- _8 = (_9.1: u32); -- StorageDead(_9); -+ StorageLive(_10); -+ StorageLive(_11); -+ nop; -+ _10 = const 12_u32; -+ _11 = const 42_u32; -+ nop; -+ _8 = _11; -+ StorageDead(_10); -+ StorageDead(_11); -+ nop; - StorageDead(_8); - StorageDead(_3); - StorageDead(_1); return; } } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir index 99805da56694c..a0389c5c55ead 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -5,133 +5,76 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { debug end => _2; debug f => _3; let mut _0: (); - let mut _4: std::ops::Range; - let mut _5: std::ops::Range; - let mut _6: &mut std::ops::Range; - let mut _12: std::option::Option; - let mut _15: isize; - let mut _17: &impl Fn(u32); - let mut _18: (u32,); - let _19: (); + let mut _6: &impl Fn(u32); + let mut _7: (u32,); + let _8: (); scope 1 { - debug iter => _5; - let _16: u32; + debug ((iter: std::ops::Range).0: u32) => _1; + debug ((iter: std::ops::Range).1: u32) => _2; scope 2 { - debug x => _16; + debug x => _5; } scope 4 (inlined iter::range::>::next) { - debug self => _6; + debug ((*(self: &mut std::ops::Range)).0: u32) => _1; + debug ((*(self: &mut std::ops::Range)).1: u32) => _2; scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &u32; - let mut _8: &u32; - let mut _11: bool; - let _13: u32; - let mut _14: u32; + debug ((*(self: &mut std::ops::Range)).0: u32) => _1; + debug ((*(self: &mut std::ops::Range)).1: u32) => _2; + let mut _4: bool; + let _5: u32; scope 6 { - debug old => _13; + debug old => _5; scope 7 { } } scope 8 (inlined std::cmp::impls::::lt) { - debug self => _7; - debug other => _8; - let mut _9: u32; - let mut _10: u32; + debug (*(self: &u32)) => _1; + debug (*(other: &u32)) => _2; } } } } scope 3 (inlined as IntoIterator>::into_iter) { - debug self => _4; + debug ((self: std::ops::Range).0: u32) => _1; + debug ((self: std::ops::Range).1: u32) => _2; } bb0: { - _4 = std::ops::Range:: { start: _1, end: _2 }; - StorageLive(_5); - _5 = _4; goto -> bb1; } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); - StorageLive(_7); - _7 = &(_5.0: u32); - StorageLive(_8); - _8 = &(_5.1: u32); - StorageLive(_9); - _9 = (_5.0: u32); - StorageLive(_10); - _10 = (_5.1: u32); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageLive(_4); + _4 = Lt(_1, _2); + switchInt(move _4) -> [0: bb2, otherwise: bb4]; } bb2: { - StorageDead(_8); - StorageDead(_7); - _12 = const Option::::None; - goto -> bb5; + StorageDead(_4); + drop(_3) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_8); - StorageDead(_7); - _13 = (_5.0: u32); - StorageLive(_14); - _14 = ::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable]; + return; } bb4: { - (_5.0: u32) = move _14; - StorageDead(_14); - _12 = Option::::Some(_13); - goto -> bb5; + _5 = _1; + _1 = ::forward_unchecked(_5, const 1_usize) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_4); + StorageLive(_6); + _6 = &_3; + StorageLive(_7); + _7 = (_5,); + _8 = >::call(move _6, move _7) -> [return: bb6, unwind unreachable]; } bb6: { - StorageDead(_12); - StorageDead(_5); - drop(_3) -> [return: bb7, unwind unreachable]; - } - - bb7: { - return; - } - - bb8: { - _16 = ((_12 as Some).0: u32); - StorageLive(_17); - _17 = &_3; - StorageLive(_18); - _18 = (_16,); - _19 = >::call(move _17, move _18) -> [return: bb9, unwind unreachable]; - } - - bb9: { - StorageDead(_18); - StorageDead(_17); - StorageDead(_12); + StorageDead(_7); + StorageDead(_6); goto -> bb1; } - - bb10: { - unreachable; - } -} - -ALLOC0 (size: 8, align: 4) { - 00 00 00 00 __ __ __ __ │ ....░░░░ } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir index f40f130717569..0211f4f3a977b 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -5,141 +5,84 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { debug end => _2; debug f => _3; let mut _0: (); - let mut _4: std::ops::Range; - let mut _5: std::ops::Range; - let mut _6: &mut std::ops::Range; - let mut _12: std::option::Option; - let mut _15: isize; - let mut _17: &impl Fn(u32); - let mut _18: (u32,); - let _19: (); + let mut _6: &impl Fn(u32); + let mut _7: (u32,); + let _8: (); scope 1 { - debug iter => _5; - let _16: u32; + debug ((iter: std::ops::Range).0: u32) => _1; + debug ((iter: std::ops::Range).1: u32) => _2; scope 2 { - debug x => _16; + debug x => _5; } scope 4 (inlined iter::range::>::next) { - debug self => _6; + debug ((*(self: &mut std::ops::Range)).0: u32) => _1; + debug ((*(self: &mut std::ops::Range)).1: u32) => _2; scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &u32; - let mut _8: &u32; - let mut _11: bool; - let _13: u32; - let mut _14: u32; + debug ((*(self: &mut std::ops::Range)).0: u32) => _1; + debug ((*(self: &mut std::ops::Range)).1: u32) => _2; + let mut _4: bool; + let _5: u32; scope 6 { - debug old => _13; + debug old => _5; scope 7 { } } scope 8 (inlined std::cmp::impls::::lt) { - debug self => _7; - debug other => _8; - let mut _9: u32; - let mut _10: u32; + debug (*(self: &u32)) => _1; + debug (*(other: &u32)) => _2; } } } } scope 3 (inlined as IntoIterator>::into_iter) { - debug self => _4; + debug ((self: std::ops::Range).0: u32) => _1; + debug ((self: std::ops::Range).1: u32) => _2; } bb0: { - _4 = std::ops::Range:: { start: _1, end: _2 }; - StorageLive(_5); - _5 = _4; goto -> bb1; } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); - StorageLive(_7); - _7 = &(_5.0: u32); - StorageLive(_8); - _8 = &(_5.1: u32); - StorageLive(_9); - _9 = (_5.0: u32); - StorageLive(_10); - _10 = (_5.1: u32); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageLive(_4); + _4 = Lt(_1, _2); + switchInt(move _4) -> [0: bb2, otherwise: bb4]; } bb2: { - StorageDead(_8); - StorageDead(_7); - _12 = const Option::::None; - goto -> bb5; + StorageDead(_4); + drop(_3) -> [return: bb3, unwind continue]; } bb3: { - StorageDead(_8); - StorageDead(_7); - _13 = (_5.0: u32); - StorageLive(_14); - _14 = ::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb11]; + return; } bb4: { - (_5.0: u32) = move _14; - StorageDead(_14); - _12 = Option::::Some(_13); - goto -> bb5; + _5 = _1; + _1 = ::forward_unchecked(_5, const 1_usize) -> [return: bb5, unwind: bb7]; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_4); + StorageLive(_6); + _6 = &_3; + StorageLive(_7); + _7 = (_5,); + _8 = >::call(move _6, move _7) -> [return: bb6, unwind: bb7]; } bb6: { - StorageDead(_12); - StorageDead(_5); - drop(_3) -> [return: bb7, unwind continue]; - } - - bb7: { - return; - } - - bb8: { - _16 = ((_12 as Some).0: u32); - StorageLive(_17); - _17 = &_3; - StorageLive(_18); - _18 = (_16,); - _19 = >::call(move _17, move _18) -> [return: bb9, unwind: bb11]; - } - - bb9: { - StorageDead(_18); - StorageDead(_17); - StorageDead(_12); + StorageDead(_7); + StorageDead(_6); goto -> bb1; } - bb10: { - unreachable; + bb7 (cleanup): { + drop(_3) -> [return: bb8, unwind terminate(cleanup)]; } - bb11 (cleanup): { - drop(_3) -> [return: bb12, unwind terminate(cleanup)]; - } - - bb12 (cleanup): { + bb8 (cleanup): { resume; } } - -ALLOC0 (size: 8, align: 4) { - 00 00 00 00 __ __ __ __ │ ....░░░░ -} diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir index f674f6a300900..323a0e736fc1b 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir @@ -7,67 +7,57 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { debug self => _1; scope 2 (inlined as iter::range::RangeIteratorImpl>::spec_next) { debug self => _1; - let mut _2: &u32; - let mut _3: &u32; - let mut _6: bool; - let _7: u32; - let mut _8: u32; + let mut _4: bool; + let _5: u32; + let mut _6: u32; scope 3 { - debug old => _7; + debug old => _5; scope 4 { } } scope 5 (inlined std::cmp::impls::::lt) { - debug self => _2; - debug other => _3; - let mut _4: u32; - let mut _5: u32; + debug (*(self: &u32)) => ((*_1).0: u32); + debug (*(other: &u32)) => ((*_1).1: u32); + let mut _2: u32; + let mut _3: u32; } } } bb0: { - StorageLive(_7); - StorageLive(_6); + StorageLive(_5); + StorageLive(_4); StorageLive(_2); - _2 = &((*_1).0: u32); + _2 = ((*_1).0: u32); StorageLive(_3); - _3 = &((*_1).1: u32); - StorageLive(_4); - _4 = ((*_1).0: u32); - StorageLive(_5); - _5 = ((*_1).1: u32); - _6 = Lt(move _4, move _5); - StorageDead(_5); - StorageDead(_4); - switchInt(move _6) -> [0: bb1, otherwise: bb2]; + _3 = ((*_1).1: u32); + _4 = Lt(move _2, move _3); + StorageDead(_3); + StorageDead(_2); + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageDead(_3); - StorageDead(_2); _0 = const Option::::None; goto -> bb4; } bb2: { - StorageDead(_3); - StorageDead(_2); - _7 = ((*_1).0: u32); - StorageLive(_8); - _8 = ::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind unreachable]; + _5 = ((*_1).0: u32); + StorageLive(_6); + _6 = ::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable]; } bb3: { - ((*_1).0: u32) = move _8; - StorageDead(_8); - _0 = Option::::Some(_7); + ((*_1).0: u32) = move _6; + StorageDead(_6); + _0 = Option::::Some(_5); goto -> bb4; } bb4: { - StorageDead(_6); - StorageDead(_7); + StorageDead(_4); + StorageDead(_5); return; } } diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir index a5029dcad3ad6..524980dc740a0 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir @@ -7,67 +7,57 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { debug self => _1; scope 2 (inlined as iter::range::RangeIteratorImpl>::spec_next) { debug self => _1; - let mut _2: &u32; - let mut _3: &u32; - let mut _6: bool; - let _7: u32; - let mut _8: u32; + let mut _4: bool; + let _5: u32; + let mut _6: u32; scope 3 { - debug old => _7; + debug old => _5; scope 4 { } } scope 5 (inlined std::cmp::impls::::lt) { - debug self => _2; - debug other => _3; - let mut _4: u32; - let mut _5: u32; + debug (*(self: &u32)) => ((*_1).0: u32); + debug (*(other: &u32)) => ((*_1).1: u32); + let mut _2: u32; + let mut _3: u32; } } } bb0: { - StorageLive(_7); - StorageLive(_6); + StorageLive(_5); + StorageLive(_4); StorageLive(_2); - _2 = &((*_1).0: u32); + _2 = ((*_1).0: u32); StorageLive(_3); - _3 = &((*_1).1: u32); - StorageLive(_4); - _4 = ((*_1).0: u32); - StorageLive(_5); - _5 = ((*_1).1: u32); - _6 = Lt(move _4, move _5); - StorageDead(_5); - StorageDead(_4); - switchInt(move _6) -> [0: bb1, otherwise: bb2]; + _3 = ((*_1).1: u32); + _4 = Lt(move _2, move _3); + StorageDead(_3); + StorageDead(_2); + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageDead(_3); - StorageDead(_2); _0 = const Option::::None; goto -> bb4; } bb2: { - StorageDead(_3); - StorageDead(_2); - _7 = ((*_1).0: u32); - StorageLive(_8); - _8 = ::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind continue]; + _5 = ((*_1).0: u32); + StorageLive(_6); + _6 = ::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue]; } bb3: { - ((*_1).0: u32) = move _8; - StorageDead(_8); - _0 = Option::::Some(_7); + ((*_1).0: u32) = move _6; + StorageDead(_6); + _0 = Option::::Some(_5); goto -> bb4; } bb4: { - StorageDead(_6); - StorageDead(_7); + StorageDead(_4); + StorageDead(_5); return; } } diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir index 718dba21a95de..1d968fa1d60b5 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir @@ -29,7 +29,7 @@ fn ezmap(_1: Option) -> Option { } bb2: { - _3 = ((_1 as Some).0: i32); + _3 = move ((_1 as Some).0: i32); StorageLive(_4); _4 = Add(_3, const 1_i32); _0 = Option::::Some(move _4); diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index 7370da5629c18..968b9253b3e95 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -3,235 +3,110 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2: &&(usize, usize, usize, usize)) -> bool { let mut _0: bool; let mut _3: &(usize, usize, usize, usize); - let _4: &usize; - let _5: &usize; - let _6: &usize; - let _7: &usize; - let mut _8: &&usize; - let _9: &usize; - let mut _10: &&usize; - let mut _15: bool; - let mut _16: &&usize; - let _17: &usize; - let mut _18: &&usize; - let mut _23: bool; - let mut _24: &&usize; - let _25: &usize; - let mut _26: &&usize; - let mut _31: bool; - let mut _32: &&usize; - let _33: &usize; - let mut _34: &&usize; + let mut _6: bool; + let mut _9: bool; + let mut _10: bool; scope 1 { - debug a => _4; - debug b => _5; - debug c => _6; - debug d => _7; + debug (*(a: &usize)) => ((*_3).0: usize); + debug (*(b: &usize)) => ((*_3).1: usize); + debug (*(c: &usize)) => ((*_3).2: usize); + debug (*(d: &usize)) => ((*_3).3: usize); scope 2 (inlined std::cmp::impls::::le) { - debug self => _8; - debug other => _10; - let mut _11: &usize; - let mut _12: &usize; + debug (*(*(self: &&usize))) => ((*_3).0: usize); + debug (*(*(other: &&usize))) => ((*_3).2: usize); scope 3 (inlined std::cmp::impls::::le) { - debug self => _11; - debug other => _12; - let mut _13: usize; - let mut _14: usize; + debug (*(self: &usize)) => ((*_3).0: usize); + debug (*(other: &usize)) => ((*_3).2: usize); + let mut _4: usize; + let mut _5: usize; } } scope 4 (inlined std::cmp::impls::::le) { - debug self => _16; - debug other => _18; - let mut _19: &usize; - let mut _20: &usize; + debug (*(*(self: &&usize))) => ((*_3).3: usize); + debug (*(*(other: &&usize))) => ((*_3).1: usize); scope 5 (inlined std::cmp::impls::::le) { - debug self => _19; - debug other => _20; - let mut _21: usize; - let mut _22: usize; + debug (*(self: &usize)) => ((*_3).3: usize); + debug (*(other: &usize)) => ((*_3).1: usize); + let mut _7: usize; + let mut _8: usize; } } scope 6 (inlined std::cmp::impls::::le) { - debug self => _24; - debug other => _26; - let mut _27: &usize; - let mut _28: &usize; + debug (*(*(self: &&usize))) => ((*_3).2: usize); + debug (*(*(other: &&usize))) => ((*_3).0: usize); scope 7 (inlined std::cmp::impls::::le) { - debug self => _27; - debug other => _28; - let mut _29: usize; - let mut _30: usize; + debug (*(self: &usize)) => ((*_3).2: usize); + debug (*(other: &usize)) => ((*_3).0: usize); } } scope 8 (inlined std::cmp::impls::::le) { - debug self => _32; - debug other => _34; - let mut _35: &usize; - let mut _36: &usize; + debug (*(*(self: &&usize))) => ((*_3).1: usize); + debug (*(*(other: &&usize))) => ((*_3).3: usize); scope 9 (inlined std::cmp::impls::::le) { - debug self => _35; - debug other => _36; - let mut _37: usize; - let mut _38: usize; + debug (*(self: &usize)) => ((*_3).1: usize); + debug (*(other: &usize)) => ((*_3).3: usize); + let mut _11: usize; + let mut _12: usize; } } } bb0: { - StorageLive(_4); _3 = (*_2); - _4 = &((*_3).0: usize); - StorageLive(_5); - _5 = &((*_3).1: usize); StorageLive(_6); - _6 = &((*_3).2: usize); - StorageLive(_7); - _7 = &((*_3).3: usize); - StorageLive(_15); - StorageLive(_8); - _8 = &_4; - StorageLive(_10); - StorageLive(_9); - _9 = _6; - _10 = &_9; - StorageLive(_11); - StorageLive(_12); - _11 = _4; - _12 = _9; - StorageLive(_13); - _13 = (*_11); - StorageLive(_14); - _14 = (*_12); - _15 = Le(move _13, move _14); - StorageDead(_14); - StorageDead(_13); - StorageDead(_12); - StorageDead(_11); - switchInt(move _15) -> [0: bb1, otherwise: bb2]; + _4 = ((*_3).0: usize); + _5 = ((*_3).2: usize); + _6 = Le(_4, _5); + switchInt(move _6) -> [0: bb2, otherwise: bb1]; } bb1: { - StorageDead(_9); - StorageDead(_10); + StorageLive(_9); + StorageLive(_7); + _7 = ((*_3).3: usize); + StorageLive(_8); + _8 = ((*_3).1: usize); + _9 = Le(move _7, move _8); StorageDead(_8); - goto -> bb4; + StorageDead(_7); + switchInt(move _9) -> [0: bb2, otherwise: bb6]; } bb2: { - StorageDead(_9); - StorageDead(_10); - StorageDead(_8); - StorageLive(_23); - StorageLive(_16); - _16 = &_7; - StorageLive(_18); - StorageLive(_17); - _17 = _5; - _18 = &_17; - StorageLive(_19); - StorageLive(_20); - _19 = _7; - _20 = _17; - StorageLive(_21); - _21 = (*_19); - StorageLive(_22); - _22 = (*_20); - _23 = Le(move _21, move _22); - StorageDead(_22); - StorageDead(_21); - StorageDead(_20); - StorageDead(_19); - switchInt(move _23) -> [0: bb3, otherwise: bb8]; + StorageLive(_10); + _10 = Le(_5, _4); + switchInt(move _10) -> [0: bb3, otherwise: bb4]; } bb3: { - StorageDead(_17); - StorageDead(_18); - StorageDead(_16); - goto -> bb4; + _0 = const false; + goto -> bb5; } bb4: { - StorageLive(_31); - StorageLive(_24); - _24 = &_6; - StorageLive(_26); - StorageLive(_25); - _25 = _4; - _26 = &_25; - StorageLive(_27); - StorageLive(_28); - _27 = _6; - _28 = _25; - StorageLive(_29); - _29 = (*_27); - StorageLive(_30); - _30 = (*_28); - _31 = Le(move _29, move _30); - StorageDead(_30); - StorageDead(_29); - StorageDead(_28); - StorageDead(_27); - switchInt(move _31) -> [0: bb5, otherwise: bb6]; + StorageLive(_11); + _11 = ((*_3).1: usize); + StorageLive(_12); + _12 = ((*_3).3: usize); + _0 = Le(move _11, move _12); + StorageDead(_12); + StorageDead(_11); + goto -> bb5; } bb5: { - StorageDead(_25); - StorageDead(_26); - StorageDead(_24); - _0 = const false; + StorageDead(_10); goto -> bb7; } bb6: { - StorageDead(_25); - StorageDead(_26); - StorageDead(_24); - StorageLive(_32); - _32 = &_5; - StorageLive(_34); - StorageLive(_33); - _33 = _7; - _34 = &_33; - StorageLive(_35); - StorageLive(_36); - _35 = _5; - _36 = _33; - StorageLive(_37); - _37 = (*_35); - StorageLive(_38); - _38 = (*_36); - _0 = Le(move _37, move _38); - StorageDead(_38); - StorageDead(_37); - StorageDead(_36); - StorageDead(_35); - StorageDead(_33); - StorageDead(_34); - StorageDead(_32); + _0 = const true; goto -> bb7; } bb7: { - StorageDead(_31); - goto -> bb9; - } - - bb8: { - StorageDead(_17); - StorageDead(_18); - StorageDead(_16); - _0 = const true; - goto -> bb9; - } - - bb9: { - StorageDead(_23); - StorageDead(_15); - StorageDead(_7); + StorageDead(_9); StorageDead(_6); - StorageDead(_5); - StorageDead(_4); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir index bc7617bb6ddd8..e4d9060d4cf51 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir @@ -20,8 +20,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { debug self => _2; debug slice => _5; let mut _6: *mut u32; - let mut _9: *mut [u32]; - let mut _10: &[&str]; + let mut _9: &[&str]; scope 5 { scope 10 (inlined std::ptr::mut_ptr::::as_mut_ptr) { debug self => _5; @@ -34,16 +33,16 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } } scope 6 (inlined std::ptr::mut_ptr::::len) { - debug self => _9; - let mut _11: *const [u32]; + debug self => _5; + let mut _10: *const [u32]; scope 7 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _11; + debug ptr => _10; scope 8 { } } } scope 9 (inlined Arguments::<'_>::new_const) { - debug pieces => _10; + debug pieces => _9; } } } @@ -72,12 +71,10 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { _5 = &raw mut (*_1); StorageLive(_9); StorageLive(_10); - StorageLive(_11); StorageLive(_6); _6 = _5 as *mut u32 (PtrToPtr); _7 = Offset(_6, _2); StorageDead(_6); - StorageDead(_11); StorageDead(_10); StorageDead(_9); StorageDead(_5); diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir index bc7617bb6ddd8..e4d9060d4cf51 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir @@ -20,8 +20,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { debug self => _2; debug slice => _5; let mut _6: *mut u32; - let mut _9: *mut [u32]; - let mut _10: &[&str]; + let mut _9: &[&str]; scope 5 { scope 10 (inlined std::ptr::mut_ptr::::as_mut_ptr) { debug self => _5; @@ -34,16 +33,16 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } } scope 6 (inlined std::ptr::mut_ptr::::len) { - debug self => _9; - let mut _11: *const [u32]; + debug self => _5; + let mut _10: *const [u32]; scope 7 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _11; + debug ptr => _10; scope 8 { } } } scope 9 (inlined Arguments::<'_>::new_const) { - debug pieces => _10; + debug pieces => _9; } } } @@ -72,12 +71,10 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { _5 = &raw mut (*_1); StorageLive(_9); StorageLive(_10); - StorageLive(_11); StorageLive(_6); _6 = _5 as *mut u32 (PtrToPtr); _7 = Offset(_6, _2); StorageDead(_6); - StorageDead(_11); StorageDead(_10); StorageDead(_9); StorageDead(_5); diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index 36329f8fc6845..2917c49cd2c0c 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -4,33 +4,31 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> debug slice => _1; debug index => _2; let mut _0: &mut [u32]; - let mut _3: usize; - let mut _4: usize; scope 1 (inlined core::slice::::get_unchecked_mut::>) { debug self => _1; - debug ((index: std::ops::Range).0: usize) => _3; - debug ((index: std::ops::Range).1: usize) => _4; - let mut _5: *mut [u32]; + debug index => _2; + let mut _3: *mut [u32]; let mut _13: *mut [u32]; scope 2 { scope 3 (inlined as SliceIndex<[u32]>>::get_unchecked_mut) { - debug ((self: std::ops::Range).0: usize) => _3; - debug ((self: std::ops::Range).1: usize) => _4; - debug slice => _5; + debug self => _2; + debug slice => _3; + let mut _4: usize; + let mut _5: usize; let mut _7: *mut u32; let mut _8: *mut u32; - let mut _14: *mut [u32]; + let mut _14: usize; let mut _15: &[&str]; scope 4 { let _6: usize; scope 5 { debug new_len => _6; scope 10 (inlined std::ptr::mut_ptr::::as_mut_ptr) { - debug self => _5; + debug self => _3; } scope 11 (inlined std::ptr::mut_ptr::::add) { debug self => _7; - debug count => _3; + debug count => _14; scope 12 { } } @@ -54,7 +52,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> } } scope 6 (inlined std::ptr::mut_ptr::::len) { - debug self => _14; + debug self => _3; let mut _16: *const [u32]; scope 7 (inlined std::ptr::metadata::<[u32]>) { debug ptr => _16; @@ -70,26 +68,29 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> } bb0: { - _3 = move (_2.0: usize); - _4 = move (_2.1: usize); - StorageLive(_5); - _5 = &raw mut (*_1); + StorageLive(_3); + _3 = &raw mut (*_1); StorageLive(_14); StorageLive(_15); StorageLive(_6); + StorageLive(_5); StorageLive(_16); - _6 = SubUnchecked(_4, _3); + StorageLive(_4); + _4 = (_2.1: usize); + _5 = (_2.0: usize); + _6 = SubUnchecked(move _4, _5); + StorageDead(_4); StorageLive(_8); StorageLive(_7); - _7 = _5 as *mut u32 (PtrToPtr); - _8 = Offset(_7, _3); + _7 = _3 as *mut u32 (PtrToPtr); + _8 = Offset(_7, _5); StorageDead(_7); StorageLive(_9); _9 = _8 as *mut () (PtrToPtr); StorageLive(_12); StorageLive(_11); StorageLive(_10); - _10 = _9 as *const () (PointerCoercion(MutToConstPointer)); + _10 = _8 as *const () (PtrToPtr); _11 = std::ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 }; StorageDead(_10); _12 = std::ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 }; @@ -99,10 +100,11 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> StorageDead(_9); StorageDead(_8); StorageDead(_16); + StorageDead(_5); StorageDead(_6); StorageDead(_15); StorageDead(_14); - StorageDead(_5); + StorageDead(_3); _0 = &mut (*_13); return; } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir index 36329f8fc6845..2917c49cd2c0c 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -4,33 +4,31 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> debug slice => _1; debug index => _2; let mut _0: &mut [u32]; - let mut _3: usize; - let mut _4: usize; scope 1 (inlined core::slice::::get_unchecked_mut::>) { debug self => _1; - debug ((index: std::ops::Range).0: usize) => _3; - debug ((index: std::ops::Range).1: usize) => _4; - let mut _5: *mut [u32]; + debug index => _2; + let mut _3: *mut [u32]; let mut _13: *mut [u32]; scope 2 { scope 3 (inlined as SliceIndex<[u32]>>::get_unchecked_mut) { - debug ((self: std::ops::Range).0: usize) => _3; - debug ((self: std::ops::Range).1: usize) => _4; - debug slice => _5; + debug self => _2; + debug slice => _3; + let mut _4: usize; + let mut _5: usize; let mut _7: *mut u32; let mut _8: *mut u32; - let mut _14: *mut [u32]; + let mut _14: usize; let mut _15: &[&str]; scope 4 { let _6: usize; scope 5 { debug new_len => _6; scope 10 (inlined std::ptr::mut_ptr::::as_mut_ptr) { - debug self => _5; + debug self => _3; } scope 11 (inlined std::ptr::mut_ptr::::add) { debug self => _7; - debug count => _3; + debug count => _14; scope 12 { } } @@ -54,7 +52,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> } } scope 6 (inlined std::ptr::mut_ptr::::len) { - debug self => _14; + debug self => _3; let mut _16: *const [u32]; scope 7 (inlined std::ptr::metadata::<[u32]>) { debug ptr => _16; @@ -70,26 +68,29 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> } bb0: { - _3 = move (_2.0: usize); - _4 = move (_2.1: usize); - StorageLive(_5); - _5 = &raw mut (*_1); + StorageLive(_3); + _3 = &raw mut (*_1); StorageLive(_14); StorageLive(_15); StorageLive(_6); + StorageLive(_5); StorageLive(_16); - _6 = SubUnchecked(_4, _3); + StorageLive(_4); + _4 = (_2.1: usize); + _5 = (_2.0: usize); + _6 = SubUnchecked(move _4, _5); + StorageDead(_4); StorageLive(_8); StorageLive(_7); - _7 = _5 as *mut u32 (PtrToPtr); - _8 = Offset(_7, _3); + _7 = _3 as *mut u32 (PtrToPtr); + _8 = Offset(_7, _5); StorageDead(_7); StorageLive(_9); _9 = _8 as *mut () (PtrToPtr); StorageLive(_12); StorageLive(_11); StorageLive(_10); - _10 = _9 as *const () (PointerCoercion(MutToConstPointer)); + _10 = _8 as *const () (PtrToPtr); _11 = std::ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 }; StorageDead(_10); _12 = std::ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 }; @@ -99,10 +100,11 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> StorageDead(_9); StorageDead(_8); StorageDead(_16); + StorageDead(_5); StorageDead(_6); StorageDead(_15); StorageDead(_14); - StorageDead(_5); + StorageDead(_3); _0 = &mut (*_13); return; } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir index d97c96ac8a088..c07d3d26c8124 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir @@ -7,13 +7,130 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range) -> &[u32] { scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { debug self => _1; debug index => _2; + scope 2 (inlined #[track_caller] as SliceIndex<[u32]>>::index) { + debug self => _2; + debug slice => _1; + let mut _3: usize; + let mut _4: usize; + let mut _5: bool; + let mut _6: usize; + let mut _7: bool; + let mut _8: *const [u32]; + let _15: *const [u32]; + let _16: !; + let _17: !; + scope 3 { + scope 4 (inlined as SliceIndex<[u32]>>::get_unchecked) { + debug self => _2; + debug slice => _1; + let mut _10: *const u32; + let mut _11: *const u32; + let mut _18: usize; + let mut _19: &[&str]; + scope 5 { + let _9: usize; + scope 6 { + debug new_len => _9; + scope 11 (inlined std::ptr::const_ptr::::as_ptr) { + debug self => _1; + } + scope 12 (inlined std::ptr::const_ptr::::add) { + debug self => _10; + debug count => _18; + scope 13 { + } + } + scope 14 (inlined slice_from_raw_parts::) { + debug data => _11; + debug len => _9; + let mut _12: *const (); + scope 15 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _11; + } + scope 16 (inlined std::ptr::from_raw_parts::<[u32]>) { + debug data_address => _12; + debug metadata => _9; + let mut _13: std::ptr::metadata::PtrComponents<[u32]>; + let mut _14: std::ptr::metadata::PtrRepr<[u32]>; + scope 17 { + } + } + } + } + } + scope 7 (inlined std::ptr::const_ptr::::len) { + debug self => _1; + scope 8 (inlined std::ptr::metadata::<[u32]>) { + debug ptr => _1; + scope 9 { + } + } + } + scope 10 (inlined Arguments::<'_>::new_const) { + debug pieces => _19; + } + } + } + } } bb0: { - _0 = as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable]; + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + _3 = (_2.0: usize); + _4 = (_2.1: usize); + _5 = Gt(_3, _4); + switchInt(move _5) -> [0: bb1, otherwise: bb4]; } bb1: { + StorageLive(_7); + _6 = Len((*_1)); + _7 = Gt(_4, _6); + switchInt(move _7) -> [0: bb2, otherwise: bb3]; + } + + bb2: { + StorageDead(_7); + StorageDead(_5); + StorageLive(_8); + _8 = &raw const (*_1); + StorageLive(_18); + StorageLive(_19); + StorageLive(_9); + _9 = SubUnchecked(_4, _3); + StorageLive(_11); + StorageLive(_10); + _10 = _8 as *const u32 (PtrToPtr); + _11 = Offset(_10, _3); + StorageDead(_10); + StorageLive(_12); + _12 = _11 as *const () (PtrToPtr); + StorageLive(_14); + StorageLive(_13); + _13 = std::ptr::metadata::PtrComponents::<[u32]> { data_address: _12, metadata: _9 }; + _14 = std::ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _13 }; + StorageDead(_13); + _15 = (_14.0: *const [u32]); + StorageDead(_14); + StorageDead(_12); + StorageDead(_11); + StorageDead(_9); + StorageDead(_19); + StorageDead(_18); + StorageDead(_8); + StorageDead(_4); + StorageDead(_3); + _0 = &(*_15); return; } + + bb3: { + _16 = core::slice::index::slice_end_index_len_fail(move _4, move _6) -> unwind unreachable; + } + + bb4: { + _17 = core::slice::index::slice_index_order_fail(move _3, move _4) -> unwind unreachable; + } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir index 4a976002fa5a8..535cfcb18b1dc 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir @@ -7,13 +7,130 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range) -> &[u32] { scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { debug self => _1; debug index => _2; + scope 2 (inlined #[track_caller] as SliceIndex<[u32]>>::index) { + debug self => _2; + debug slice => _1; + let mut _3: usize; + let mut _4: usize; + let mut _5: bool; + let mut _6: usize; + let mut _7: bool; + let mut _8: *const [u32]; + let _15: *const [u32]; + let _16: !; + let _17: !; + scope 3 { + scope 4 (inlined as SliceIndex<[u32]>>::get_unchecked) { + debug self => _2; + debug slice => _1; + let mut _10: *const u32; + let mut _11: *const u32; + let mut _18: usize; + let mut _19: &[&str]; + scope 5 { + let _9: usize; + scope 6 { + debug new_len => _9; + scope 11 (inlined std::ptr::const_ptr::::as_ptr) { + debug self => _1; + } + scope 12 (inlined std::ptr::const_ptr::::add) { + debug self => _10; + debug count => _18; + scope 13 { + } + } + scope 14 (inlined slice_from_raw_parts::) { + debug data => _11; + debug len => _9; + let mut _12: *const (); + scope 15 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _11; + } + scope 16 (inlined std::ptr::from_raw_parts::<[u32]>) { + debug data_address => _12; + debug metadata => _9; + let mut _13: std::ptr::metadata::PtrComponents<[u32]>; + let mut _14: std::ptr::metadata::PtrRepr<[u32]>; + scope 17 { + } + } + } + } + } + scope 7 (inlined std::ptr::const_ptr::::len) { + debug self => _1; + scope 8 (inlined std::ptr::metadata::<[u32]>) { + debug ptr => _1; + scope 9 { + } + } + } + scope 10 (inlined Arguments::<'_>::new_const) { + debug pieces => _19; + } + } + } + } } bb0: { - _0 = as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue]; + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + _3 = (_2.0: usize); + _4 = (_2.1: usize); + _5 = Gt(_3, _4); + switchInt(move _5) -> [0: bb1, otherwise: bb4]; } bb1: { + StorageLive(_7); + _6 = Len((*_1)); + _7 = Gt(_4, _6); + switchInt(move _7) -> [0: bb2, otherwise: bb3]; + } + + bb2: { + StorageDead(_7); + StorageDead(_5); + StorageLive(_8); + _8 = &raw const (*_1); + StorageLive(_18); + StorageLive(_19); + StorageLive(_9); + _9 = SubUnchecked(_4, _3); + StorageLive(_11); + StorageLive(_10); + _10 = _8 as *const u32 (PtrToPtr); + _11 = Offset(_10, _3); + StorageDead(_10); + StorageLive(_12); + _12 = _11 as *const () (PtrToPtr); + StorageLive(_14); + StorageLive(_13); + _13 = std::ptr::metadata::PtrComponents::<[u32]> { data_address: _12, metadata: _9 }; + _14 = std::ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _13 }; + StorageDead(_13); + _15 = (_14.0: *const [u32]); + StorageDead(_14); + StorageDead(_12); + StorageDead(_11); + StorageDead(_9); + StorageDead(_19); + StorageDead(_18); + StorageDead(_8); + StorageDead(_4); + StorageDead(_3); + _0 = &(*_15); return; } + + bb3: { + _16 = core::slice::index::slice_end_index_len_fail(move _4, move _6) -> unwind continue; + } + + bb4: { + _17 = core::slice::index::slice_index_order_fail(move _3, move _4) -> unwind continue; + } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir index 26b2663fa3580..434553e69f1f5 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir @@ -4,22 +4,232 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::iter::Enumerate>; - let mut _15: std::iter::Enumerate>; - let mut _16: &mut std::iter::Enumerate>; - let mut _17: std::option::Option<(usize, &T)>; - let mut _18: isize; - let mut _21: &impl Fn(usize, &T); - let mut _22: (usize, &T); - let _23: (); + let mut _11: std::slice::Iter<'_, T>; + let mut _12: std::iter::Enumerate>; + let mut _13: std::iter::Enumerate>; + let mut _62: &impl Fn(usize, &T); + let _63: (); scope 1 { - debug iter => _15; - let _19: usize; - let _20: &T; + debug iter => _13; scope 2 { - debug i => _19; - debug x => _20; + debug i => _59; + debug x => _58; + } + scope 25 (inlined > as Iterator>::next) { + debug (*(self: &mut Enumerate>)) => _13; + let mut _57: std::option::Option<&T>; + let mut _60: (usize, bool); + let mut _61: (usize, &T); + scope 26 { + debug a => _58; + let _59: usize; + scope 31 { + debug i => _59; + } + } + scope 27 { + debug residual => const Option::::None; + scope 28 { + scope 34 (inlined as FromResidual>::from_residual) { + debug residual => const Option::::None; + } + } + } + scope 29 { + debug val => _58; + scope 30 { + } + } + scope 32 (inlined as Try>::branch) { + debug self => _57; + let _58: &T; + scope 33 { + debug v => _58; + } + } + scope 35 (inlined as Iterator>::next) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => (_13.0: std::slice::Iter<'_, T>); + let mut _14: bool; + let mut _15: *const *const T; + let mut _16: *const std::ptr::NonNull; + let mut _33: bool; + let mut _34: *const T; + let _37: std::ptr::NonNull; + let mut _56: &T; + scope 36 { + scope 37 { + let _17: std::ptr::NonNull; + let _36: usize; + scope 38 { + debug len => _36; + } + scope 39 { + debug end => _17; + scope 45 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _17; + let mut _18: std::ptr::NonNull; + let mut _25: *mut T; + let mut _32: *mut T; + scope 46 (inlined NonNull::::as_ptr) { + debug self => _18; + let mut _19: *const T; + let mut _23: bool; + let mut _24: bool; + scope 47 { + scope 48 (inlined std::ptr::const_ptr::::is_null) { + debug self => _19; + let mut _20: *const u8; + scope 49 { + scope 50 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _20; + let mut _22: usize; + scope 51 (inlined std::ptr::const_ptr::::addr) { + debug self => _20; + let mut _21: *const (); + scope 52 { + scope 53 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _20; + } + } + } + } + } + } + } + } + scope 54 (inlined NonNull::::as_ptr) { + debug self => _17; + let mut _26: *const T; + let mut _30: bool; + let mut _31: bool; + scope 55 { + scope 56 (inlined std::ptr::const_ptr::::is_null) { + debug self => _26; + let mut _27: *const u8; + scope 57 { + scope 58 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _27; + let mut _29: usize; + scope 59 (inlined std::ptr::const_ptr::::addr) { + debug self => _27; + let mut _28: *const (); + scope 60 { + scope 61 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _27; + } + } + } + } + } + } + } + } + } + } + scope 40 { + scope 44 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _15; + } + } + scope 41 (inlined std::ptr::const_ptr::::addr) { + debug self => _34; + let mut _35: *const (); + scope 42 { + scope 43 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _34; + } + } + } + } + scope 62 (inlined std::slice::Iter::<'_, T>::post_inc_start) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => (_13.0: std::slice::Iter<'_, T>); + debug offset => const 1_usize; + let mut _38: bool; + let mut _39: *mut *const T; + let mut _40: *mut std::ptr::NonNull; + let mut _41: std::ptr::NonNull; + let mut _44: std::ptr::NonNull; + let mut _45: *mut *const T; + let mut _46: *mut usize; + let mut _47: usize; + let mut _48: usize; + scope 63 { + debug old => _37; + scope 64 { + scope 65 { + scope 66 { + debug len => _46; + scope 71 (inlined core::num::::unchecked_sub) { + debug self => _47; + debug rhs => const 1_usize; + scope 72 { + } + } + } + scope 67 { + scope 70 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _45; + } + } + scope 68 { + debug _end => _40; + scope 74 (inlined NonNull::::add) { + debug self => _41; + debug count => const 1_usize; + let mut _42: *const T; + let mut _43: *const T; + scope 75 { + } + } + } + scope 69 { + scope 73 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _39; + } + } + } + } + } + } + scope 76 (inlined NonNull::::as_ref::<'_>) { + debug (*(self: &NonNull)) => _37; + let mut _55: *mut T; + scope 77 { + scope 78 (inlined NonNull::::as_ptr) { + debug self => _37; + let mut _49: *const T; + let mut _53: bool; + let mut _54: bool; + scope 79 { + scope 80 (inlined std::ptr::const_ptr::::is_null) { + debug self => _49; + let mut _50: *const u8; + scope 81 { + scope 82 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _50; + let mut _52: usize; + scope 83 (inlined std::ptr::const_ptr::::addr) { + debug self => _50; + let mut _51: *const (); + scope 84 { + scope 85 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _50; + } + } + } + } + } + } + } + } + scope 86 (inlined std::ptr::mut_ptr::::cast_const) { + debug self => _55; + } + } + } + } + } } } scope 3 (inlined core::slice::::iter) { @@ -29,34 +239,31 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let _4: *const T; let mut _5: bool; let mut _6: usize; + let mut _7: *const T; let mut _8: usize; let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let mut _10: std::ptr::NonNull; scope 5 { debug ptr => _4; scope 6 { - let _7: *const T; scope 7 { debug end_or_len => _7; scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; - let mut _10: *const T; - let mut _24: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _24; + debug ptr => _9; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _24; - let mut _25: *mut u8; + debug self => _9; + let mut _64: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _25; + debug ptr => _64; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _25; + debug self => _64; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _25; + debug self => _64; } } } @@ -87,23 +294,22 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } } scope 22 (inlined as Iterator>::enumerate) { - debug self => _13; + debug self => _11; scope 23 (inlined Enumerate::>::new) { - debug iter => _13; + debug iter => _11; } } scope 24 (inlined > as IntoIterator>::into_iter) { - debug self => _14; + debug self => _12; } bb0: { - StorageLive(_13); + StorageLive(_11); StorageLive(_4); + StorageLive(_7); StorageLive(_3); _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + _4 = _3 as *const T (PtrToPtr); StorageLive(_5); _5 = const _; switchInt(move _5) -> [0: bb1, otherwise: bb2]; @@ -127,73 +333,227 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb3: { StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); - StorageLive(_25); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_25); - StorageDead(_24); - StorageDead(_10); + StorageLive(_9); + _9 = _3 as *mut T (PtrToPtr); + StorageLive(_64); + _10 = NonNull:: { pointer: _4 }; + StorageDead(_64); StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); + _11 = std::slice::Iter::<'_, T> { ptr: move _10, end_or_len: move _7, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_10); + StorageDead(_3); StorageDead(_7); StorageDead(_4); - _14 = Enumerate::> { iter: _13, count: const 0_usize }; - StorageDead(_13); - StorageLive(_15); - _15 = _14; + _12 = Enumerate::> { iter: _11, count: const 0_usize }; + StorageDead(_11); + StorageLive(_13); + _13 = _12; goto -> bb4; } bb4: { + StorageLive(_60); + StorageLive(_57); + StorageLive(_36); StorageLive(_17); - StorageLive(_16); - _16 = &mut _15; - _17 = > as Iterator>::next(move _16) -> [return: bb5, unwind unreachable]; + StorageLive(_37); + StorageLive(_49); + StorageLive(_33); + StorageLive(_14); + _14 = const _; + switchInt(move _14) -> [0: bb5, otherwise: bb6]; } bb5: { + StorageLive(_16); + StorageLive(_15); + _15 = &raw const ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _16 = _15 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_15); + _17 = (*_16); StorageDead(_16); - _18 = discriminant(_17); - switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageLive(_25); + StorageLive(_18); + _18 = ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + StorageLive(_19); + StorageLive(_24); + StorageLive(_23); + _19 = (_18.0: *const T); + StorageLive(_20); + _20 = _19 as *const u8 (PtrToPtr); + StorageLive(_22); + StorageLive(_21); + _21 = _19 as *const () (PtrToPtr); + _22 = move _21 as usize (Transmute); + StorageDead(_21); + _23 = Eq(move _22, const 0_usize); + StorageDead(_22); + StorageDead(_20); + _24 = Not(move _23); + StorageDead(_23); + assume(move _24); + StorageDead(_24); + _25 = _19 as *mut T (PtrToPtr); + StorageDead(_19); + StorageDead(_18); + StorageLive(_32); + StorageLive(_26); + StorageLive(_31); + StorageLive(_30); + _26 = (_17.0: *const T); + StorageLive(_27); + _27 = _26 as *const u8 (PtrToPtr); + StorageLive(_29); + StorageLive(_28); + _28 = _26 as *const () (PtrToPtr); + _29 = move _28 as usize (Transmute); + StorageDead(_28); + _30 = Eq(move _29, const 0_usize); + StorageDead(_29); + StorageDead(_27); + _31 = Not(move _30); + StorageDead(_30); + assume(move _31); + StorageDead(_31); + _32 = _26 as *mut T (PtrToPtr); + StorageDead(_26); + _33 = Eq(move _25, move _32); + StorageDead(_32); + StorageDead(_25); + goto -> bb7; } bb6: { - StorageDead(_17); - StorageDead(_15); - drop(_2) -> [return: bb7, unwind unreachable]; + StorageLive(_34); + _34 = ((_13.0: std::slice::Iter<'_, T>).1: *const T); + StorageLive(_35); + _35 = _34 as *const () (PtrToPtr); + _36 = move _35 as usize (Transmute); + StorageDead(_35); + StorageDead(_34); + _33 = Eq(_36, const 0_usize); + goto -> bb7; } bb7: { - return; + StorageDead(_14); + switchInt(move _33) -> [0: bb8, otherwise: bb14]; } bb8: { - _19 = (((_17 as Some).0: (usize, &T)).0: usize); - _20 = (((_17 as Some).0: (usize, &T)).1: &T); - StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_19, _20); - _23 = >::call(move _21, move _22) -> [return: bb9, unwind unreachable]; + StorageLive(_56); + StorageLive(_46); + StorageLive(_40); + _37 = ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + StorageLive(_38); + _38 = const _; + switchInt(move _38) -> [0: bb9, otherwise: bb10]; } bb9: { - StorageDead(_22); - StorageDead(_21); + StorageLive(_39); + _39 = &raw mut ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _40 = _39 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_39); + StorageLive(_44); + StorageLive(_41); + _41 = ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + StorageLive(_43); + StorageLive(_42); + _42 = (_41.0: *const T); + _43 = Offset(move _42, const 1_usize); + StorageDead(_42); + _44 = NonNull:: { pointer: move _43 }; + StorageDead(_43); + StorageDead(_41); + ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull) = move _44; + StorageDead(_44); + goto -> bb11; + } + + bb10: { + StorageLive(_45); + _45 = &raw mut ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _46 = _45 as *mut usize (PtrToPtr); + StorageDead(_45); + StorageLive(_48); + StorageLive(_47); + _47 = (*_46); + _48 = SubUnchecked(_47, const 1_usize); + StorageDead(_47); + (*_46) = move _48; + StorageDead(_48); + goto -> bb11; + } + + bb11: { + StorageDead(_38); + StorageDead(_40); + StorageDead(_46); + StorageLive(_55); + StorageLive(_54); + StorageLive(_53); + _49 = (_37.0: *const T); + StorageLive(_50); + _50 = _49 as *const u8 (PtrToPtr); + StorageLive(_52); + StorageLive(_51); + _51 = _49 as *const () (PtrToPtr); + _52 = move _51 as usize (Transmute); + StorageDead(_51); + _53 = Eq(move _52, const 0_usize); + StorageDead(_52); + StorageDead(_50); + _54 = Not(move _53); + StorageDead(_53); + assume(move _54); + StorageDead(_54); + _55 = _49 as *mut T (PtrToPtr); + StorageDead(_55); + _56 = &(*_49); + _57 = Option::<&T>::Some(move _56); + StorageDead(_56); + StorageDead(_33); + StorageDead(_49); + StorageDead(_37); StorageDead(_17); + StorageDead(_36); + _58 = move ((_57 as Some).0: &T); + StorageDead(_57); + _59 = (_13.1: usize); + _60 = CheckedAdd((_13.1: usize), const 1_usize); + assert(!move (_60.1: bool), "attempt to compute `{} + {}`, which would overflow", (_13.1: usize), const 1_usize) -> [success: bb12, unwind unreachable]; + } + + bb12: { + (_13.1: usize) = move (_60.0: usize); + _61 = (_59, _58); + StorageDead(_60); + StorageLive(_62); + _62 = &_2; + _63 = >::call(move _62, move _61) -> [return: bb13, unwind unreachable]; + } + + bb13: { + StorageDead(_62); goto -> bb4; } - bb10: { - unreachable; + bb14: { + _57 = const {transmute(0x0000000000000000): Option<&T>}; + StorageDead(_33); + StorageDead(_49); + StorageDead(_37); + StorageDead(_17); + StorageDead(_36); + StorageDead(_57); + StorageDead(_60); + StorageDead(_13); + drop(_2) -> [return: bb15, unwind unreachable]; + } + + bb15: { + return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index a055612bd5feb..091bb68d7af26 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -4,22 +4,22 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::iter::Enumerate>; - let mut _15: std::iter::Enumerate>; - let mut _16: &mut std::iter::Enumerate>; - let mut _17: std::option::Option<(usize, &T)>; - let mut _18: isize; - let mut _21: &impl Fn(usize, &T); - let mut _22: (usize, &T); - let _23: (); + let mut _11: std::slice::Iter<'_, T>; + let mut _12: std::iter::Enumerate>; + let mut _13: std::iter::Enumerate>; + let mut _14: &mut std::iter::Enumerate>; + let mut _15: std::option::Option<(usize, &T)>; + let mut _16: isize; + let mut _19: &impl Fn(usize, &T); + let mut _20: (usize, &T); + let _21: (); scope 1 { - debug iter => _15; - let _19: usize; - let _20: &T; + debug iter => _13; + let _17: usize; + let _18: &T; scope 2 { - debug i => _19; - debug x => _20; + debug i => _17; + debug x => _18; } } scope 3 (inlined core::slice::::iter) { @@ -29,34 +29,31 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let _4: *const T; let mut _5: bool; let mut _6: usize; + let mut _7: *const T; let mut _8: usize; let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let mut _10: std::ptr::NonNull; scope 5 { debug ptr => _4; scope 6 { - let _7: *const T; scope 7 { debug end_or_len => _7; scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; - let mut _10: *const T; - let mut _24: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _24; + debug ptr => _9; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _24; - let mut _25: *mut u8; + debug self => _9; + let mut _22: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _25; + debug ptr => _22; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _25; + debug self => _22; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _25; + debug self => _22; } } } @@ -87,23 +84,22 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } } scope 22 (inlined as Iterator>::enumerate) { - debug self => _13; + debug self => _11; scope 23 (inlined Enumerate::>::new) { - debug iter => _13; + debug iter => _11; } } scope 24 (inlined > as IntoIterator>::into_iter) { - debug self => _14; + debug self => _12; } bb0: { - StorageLive(_13); + StorageLive(_11); StorageLive(_4); + StorageLive(_7); StorageLive(_3); _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + _4 = _3 as *const T (PtrToPtr); StorageLive(_5); _5 = const _; switchInt(move _5) -> [0: bb1, otherwise: bb2]; @@ -127,48 +123,41 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb3: { StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); - StorageLive(_25); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_25); - StorageDead(_24); - StorageDead(_10); + StorageLive(_9); + _9 = _3 as *mut T (PtrToPtr); + StorageLive(_22); + _10 = NonNull:: { pointer: _4 }; + StorageDead(_22); StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); + _11 = std::slice::Iter::<'_, T> { ptr: move _10, end_or_len: move _7, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_10); + StorageDead(_3); StorageDead(_7); StorageDead(_4); - _14 = Enumerate::> { iter: _13, count: const 0_usize }; - StorageDead(_13); - StorageLive(_15); - _15 = _14; + _12 = Enumerate::> { iter: _11, count: const 0_usize }; + StorageDead(_11); + StorageLive(_13); + _13 = _12; goto -> bb4; } bb4: { - StorageLive(_17); - StorageLive(_16); - _16 = &mut _15; - _17 = > as Iterator>::next(move _16) -> [return: bb5, unwind: bb11]; + StorageLive(_15); + StorageLive(_14); + _14 = &mut _13; + _15 = > as Iterator>::next(move _14) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_16); - _18 = discriminant(_17); - switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_14); + _16 = discriminant(_15); + switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_17); StorageDead(_15); + StorageDead(_13); drop(_2) -> [return: bb7, unwind continue]; } @@ -177,19 +166,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _19 = (((_17 as Some).0: (usize, &T)).0: usize); - _20 = (((_17 as Some).0: (usize, &T)).1: &T); - StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_19, _20); - _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; + _17 = (((_15 as Some).0: (usize, &T)).0: usize); + _18 = (((_15 as Some).0: (usize, &T)).1: &T); + StorageLive(_19); + _19 = &_2; + StorageLive(_20); + _20 = (_17, _18); + _21 = >::call(move _19, move _20) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_22); - StorageDead(_21); - StorageDead(_17); + StorageDead(_20); + StorageDead(_19); + StorageDead(_15); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index 471491108e0b6..7fb3ed5980cdc 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -4,19 +4,198 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::slice::Iter<'_, T>; - let mut _15: &mut std::slice::Iter<'_, T>; - let mut _16: std::option::Option<&T>; - let mut _17: isize; - let mut _19: &impl Fn(&T); - let mut _20: (&T,); - let _21: (); + let mut _11: std::slice::Iter<'_, T>; + let mut _12: std::slice::Iter<'_, T>; + let mut _56: &impl Fn(&T); + let mut _57: (&T,); + let _58: (); scope 1 { - debug iter => _14; - let _18: &T; + debug iter => _12; scope 2 { - debug x => _18; + debug x => _55; + } + scope 23 (inlined as Iterator>::next) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => _12; + let mut _13: bool; + let mut _14: *const *const T; + let mut _15: *const std::ptr::NonNull; + let mut _32: bool; + let mut _33: *const T; + let _36: std::ptr::NonNull; + let mut _55: &T; + scope 24 { + scope 25 { + let _16: std::ptr::NonNull; + let _35: usize; + scope 26 { + debug len => _35; + } + scope 27 { + debug end => _16; + scope 33 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => (_12.0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _16; + let mut _17: std::ptr::NonNull; + let mut _24: *mut T; + let mut _31: *mut T; + scope 34 (inlined NonNull::::as_ptr) { + debug self => _17; + let mut _18: *const T; + let mut _22: bool; + let mut _23: bool; + scope 35 { + scope 36 (inlined std::ptr::const_ptr::::is_null) { + debug self => _18; + let mut _19: *const u8; + scope 37 { + scope 38 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _19; + let mut _21: usize; + scope 39 (inlined std::ptr::const_ptr::::addr) { + debug self => _19; + let mut _20: *const (); + scope 40 { + scope 41 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _19; + } + } + } + } + } + } + } + } + scope 42 (inlined NonNull::::as_ptr) { + debug self => _16; + let mut _25: *const T; + let mut _29: bool; + let mut _30: bool; + scope 43 { + scope 44 (inlined std::ptr::const_ptr::::is_null) { + debug self => _25; + let mut _26: *const u8; + scope 45 { + scope 46 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _26; + let mut _28: usize; + scope 47 (inlined std::ptr::const_ptr::::addr) { + debug self => _26; + let mut _27: *const (); + scope 48 { + scope 49 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _26; + } + } + } + } + } + } + } + } + } + } + scope 28 { + scope 32 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _14; + } + } + scope 29 (inlined std::ptr::const_ptr::::addr) { + debug self => _33; + let mut _34: *const (); + scope 30 { + scope 31 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _33; + } + } + } + } + scope 50 (inlined std::slice::Iter::<'_, T>::post_inc_start) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => _12; + debug offset => const 1_usize; + let mut _37: bool; + let mut _38: *mut *const T; + let mut _39: *mut std::ptr::NonNull; + let mut _40: std::ptr::NonNull; + let mut _43: std::ptr::NonNull; + let mut _44: *mut *const T; + let mut _45: *mut usize; + let mut _46: usize; + let mut _47: usize; + scope 51 { + debug old => _36; + scope 52 { + scope 53 { + scope 54 { + debug len => _45; + scope 59 (inlined core::num::::unchecked_sub) { + debug self => _46; + debug rhs => const 1_usize; + scope 60 { + } + } + } + scope 55 { + scope 58 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _44; + } + } + scope 56 { + debug _end => _39; + scope 62 (inlined NonNull::::add) { + debug self => _40; + debug count => const 1_usize; + let mut _41: *const T; + let mut _42: *const T; + scope 63 { + } + } + } + scope 57 { + scope 61 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _38; + } + } + } + } + } + } + scope 64 (inlined NonNull::::as_ref::<'_>) { + debug (*(self: &NonNull)) => _36; + let mut _54: *mut T; + scope 65 { + scope 66 (inlined NonNull::::as_ptr) { + debug self => _36; + let mut _48: *const T; + let mut _52: bool; + let mut _53: bool; + scope 67 { + scope 68 (inlined std::ptr::const_ptr::::is_null) { + debug self => _48; + let mut _49: *const u8; + scope 69 { + scope 70 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _49; + let mut _51: usize; + scope 71 (inlined std::ptr::const_ptr::::addr) { + debug self => _49; + let mut _50: *const (); + scope 72 { + scope 73 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _49; + } + } + } + } + } + } + } + } + scope 74 (inlined std::ptr::mut_ptr::::cast_const) { + debug self => _54; + } + } + } + } } } scope 3 (inlined core::slice::::iter) { @@ -26,34 +205,31 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _4: *const T; let mut _5: bool; let mut _6: usize; + let mut _7: *const T; let mut _8: usize; let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let mut _10: std::ptr::NonNull; scope 5 { debug ptr => _4; scope 6 { - let _7: *const T; scope 7 { debug end_or_len => _7; scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; - let mut _10: *const T; - let mut _22: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _22; + debug ptr => _9; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _22; - let mut _23: *mut u8; + debug self => _9; + let mut _59: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _23; + debug ptr => _59; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _23; + debug self => _59; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _23; + debug self => _59; } } } @@ -84,16 +260,15 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } scope 22 (inlined as IntoIterator>::into_iter) { - debug self => _13; + debug self => _11; } bb0: { StorageLive(_4); + StorageLive(_7); StorageLive(_3); _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + _4 = _3 as *const T (PtrToPtr); StorageLive(_5); _5 = const _; switchInt(move _5) -> [0: bb1, otherwise: bb2]; @@ -117,70 +292,209 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb3: { StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_22); - StorageLive(_23); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_23); - StorageDead(_22); - StorageDead(_10); + StorageLive(_9); + _9 = _3 as *mut T (PtrToPtr); + StorageLive(_59); + _10 = NonNull:: { pointer: _4 }; + StorageDead(_59); StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); + _11 = std::slice::Iter::<'_, T> { ptr: move _10, end_or_len: move _7, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_10); + StorageDead(_3); StorageDead(_7); StorageDead(_4); - StorageLive(_14); - _14 = _13; + StorageLive(_12); + _12 = _11; goto -> bb4; } bb4: { + StorageLive(_35); StorageLive(_16); - StorageLive(_15); - _15 = &mut _14; - _16 = as Iterator>::next(move _15) -> [return: bb5, unwind unreachable]; + StorageLive(_36); + StorageLive(_48); + StorageLive(_32); + StorageLive(_13); + _13 = const _; + switchInt(move _13) -> [0: bb5, otherwise: bb6]; } bb5: { + StorageLive(_15); + StorageLive(_14); + _14 = &raw const (_12.1: *const T); + _15 = _14 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_14); + _16 = (*_15); StorageDead(_15); - _17 = discriminant(_16); - switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageLive(_24); + StorageLive(_17); + _17 = (_12.0: std::ptr::NonNull); + StorageLive(_18); + StorageLive(_23); + StorageLive(_22); + _18 = (_17.0: *const T); + StorageLive(_19); + _19 = _18 as *const u8 (PtrToPtr); + StorageLive(_21); + StorageLive(_20); + _20 = _18 as *const () (PtrToPtr); + _21 = move _20 as usize (Transmute); + StorageDead(_20); + _22 = Eq(move _21, const 0_usize); + StorageDead(_21); + StorageDead(_19); + _23 = Not(move _22); + StorageDead(_22); + assume(move _23); + StorageDead(_23); + _24 = _18 as *mut T (PtrToPtr); + StorageDead(_18); + StorageDead(_17); + StorageLive(_31); + StorageLive(_25); + StorageLive(_30); + StorageLive(_29); + _25 = (_16.0: *const T); + StorageLive(_26); + _26 = _25 as *const u8 (PtrToPtr); + StorageLive(_28); + StorageLive(_27); + _27 = _25 as *const () (PtrToPtr); + _28 = move _27 as usize (Transmute); + StorageDead(_27); + _29 = Eq(move _28, const 0_usize); + StorageDead(_28); + StorageDead(_26); + _30 = Not(move _29); + StorageDead(_29); + assume(move _30); + StorageDead(_30); + _31 = _25 as *mut T (PtrToPtr); + StorageDead(_25); + _32 = Eq(move _24, move _31); + StorageDead(_31); + StorageDead(_24); + goto -> bb7; } bb6: { - StorageDead(_16); - StorageDead(_14); - drop(_2) -> [return: bb7, unwind unreachable]; + StorageLive(_33); + _33 = (_12.1: *const T); + StorageLive(_34); + _34 = _33 as *const () (PtrToPtr); + _35 = move _34 as usize (Transmute); + StorageDead(_34); + StorageDead(_33); + _32 = Eq(_35, const 0_usize); + goto -> bb7; } bb7: { - return; + StorageDead(_13); + switchInt(move _32) -> [0: bb8, otherwise: bb13]; } bb8: { - _18 = ((_16 as Some).0: &T); - StorageLive(_19); - _19 = &_2; - StorageLive(_20); - _20 = (_18,); - _21 = >::call(move _19, move _20) -> [return: bb9, unwind unreachable]; + StorageLive(_45); + StorageLive(_39); + _36 = (_12.0: std::ptr::NonNull); + StorageLive(_37); + _37 = const _; + switchInt(move _37) -> [0: bb9, otherwise: bb10]; } bb9: { - StorageDead(_20); - StorageDead(_19); + StorageLive(_38); + _38 = &raw mut (_12.1: *const T); + _39 = _38 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_38); + StorageLive(_43); + StorageLive(_40); + _40 = (_12.0: std::ptr::NonNull); + StorageLive(_42); + StorageLive(_41); + _41 = (_40.0: *const T); + _42 = Offset(move _41, const 1_usize); + StorageDead(_41); + _43 = NonNull:: { pointer: move _42 }; + StorageDead(_42); + StorageDead(_40); + (_12.0: std::ptr::NonNull) = move _43; + StorageDead(_43); + goto -> bb11; + } + + bb10: { + StorageLive(_44); + _44 = &raw mut (_12.1: *const T); + _45 = _44 as *mut usize (PtrToPtr); + StorageDead(_44); + StorageLive(_47); + StorageLive(_46); + _46 = (*_45); + _47 = SubUnchecked(_46, const 1_usize); + StorageDead(_46); + (*_45) = move _47; + StorageDead(_47); + goto -> bb11; + } + + bb11: { + StorageDead(_37); + StorageDead(_39); + StorageDead(_45); + StorageLive(_54); + StorageLive(_53); + StorageLive(_52); + _48 = (_36.0: *const T); + StorageLive(_49); + _49 = _48 as *const u8 (PtrToPtr); + StorageLive(_51); + StorageLive(_50); + _50 = _48 as *const () (PtrToPtr); + _51 = move _50 as usize (Transmute); + StorageDead(_50); + _52 = Eq(move _51, const 0_usize); + StorageDead(_51); + StorageDead(_49); + _53 = Not(move _52); + StorageDead(_52); + assume(move _53); + StorageDead(_53); + _54 = _48 as *mut T (PtrToPtr); + StorageDead(_54); + _55 = &(*_48); + StorageDead(_32); + StorageDead(_48); + StorageDead(_36); StorageDead(_16); + StorageDead(_35); + StorageLive(_56); + _56 = &_2; + StorageLive(_57); + _57 = (_55,); + _58 = >::call(move _56, move _57) -> [return: bb12, unwind unreachable]; + } + + bb12: { + StorageDead(_57); + StorageDead(_56); goto -> bb4; } - bb10: { - unreachable; + bb13: { + StorageDead(_32); + StorageDead(_48); + StorageDead(_36); + StorageDead(_16); + StorageDead(_35); + StorageDead(_12); + drop(_2) -> [return: bb14, unwind unreachable]; + } + + bb14: { + return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index bbf38aba91f08..9c7cc04f671f5 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -4,19 +4,198 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::slice::Iter<'_, T>; - let mut _15: &mut std::slice::Iter<'_, T>; - let mut _16: std::option::Option<&T>; - let mut _17: isize; - let mut _19: &impl Fn(&T); - let mut _20: (&T,); - let _21: (); + let mut _11: std::slice::Iter<'_, T>; + let mut _12: std::slice::Iter<'_, T>; + let mut _56: &impl Fn(&T); + let mut _57: (&T,); + let _58: (); scope 1 { - debug iter => _14; - let _18: &T; + debug iter => _12; scope 2 { - debug x => _18; + debug x => _55; + } + scope 23 (inlined as Iterator>::next) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => _12; + let mut _13: bool; + let mut _14: *const *const T; + let mut _15: *const std::ptr::NonNull; + let mut _32: bool; + let mut _33: *const T; + let _36: std::ptr::NonNull; + let mut _55: &T; + scope 24 { + scope 25 { + let _16: std::ptr::NonNull; + let _35: usize; + scope 26 { + debug len => _35; + } + scope 27 { + debug end => _16; + scope 33 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => (_12.0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _16; + let mut _17: std::ptr::NonNull; + let mut _24: *mut T; + let mut _31: *mut T; + scope 34 (inlined NonNull::::as_ptr) { + debug self => _17; + let mut _18: *const T; + let mut _22: bool; + let mut _23: bool; + scope 35 { + scope 36 (inlined std::ptr::const_ptr::::is_null) { + debug self => _18; + let mut _19: *const u8; + scope 37 { + scope 38 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _19; + let mut _21: usize; + scope 39 (inlined std::ptr::const_ptr::::addr) { + debug self => _19; + let mut _20: *const (); + scope 40 { + scope 41 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _19; + } + } + } + } + } + } + } + } + scope 42 (inlined NonNull::::as_ptr) { + debug self => _16; + let mut _25: *const T; + let mut _29: bool; + let mut _30: bool; + scope 43 { + scope 44 (inlined std::ptr::const_ptr::::is_null) { + debug self => _25; + let mut _26: *const u8; + scope 45 { + scope 46 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _26; + let mut _28: usize; + scope 47 (inlined std::ptr::const_ptr::::addr) { + debug self => _26; + let mut _27: *const (); + scope 48 { + scope 49 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _26; + } + } + } + } + } + } + } + } + } + } + scope 28 { + scope 32 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _14; + } + } + scope 29 (inlined std::ptr::const_ptr::::addr) { + debug self => _33; + let mut _34: *const (); + scope 30 { + scope 31 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _33; + } + } + } + } + scope 50 (inlined std::slice::Iter::<'_, T>::post_inc_start) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => _12; + debug offset => const 1_usize; + let mut _37: bool; + let mut _38: *mut *const T; + let mut _39: *mut std::ptr::NonNull; + let mut _40: std::ptr::NonNull; + let mut _43: std::ptr::NonNull; + let mut _44: *mut *const T; + let mut _45: *mut usize; + let mut _46: usize; + let mut _47: usize; + scope 51 { + debug old => _36; + scope 52 { + scope 53 { + scope 54 { + debug len => _45; + scope 59 (inlined core::num::::unchecked_sub) { + debug self => _46; + debug rhs => const 1_usize; + scope 60 { + } + } + } + scope 55 { + scope 58 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _44; + } + } + scope 56 { + debug _end => _39; + scope 62 (inlined NonNull::::add) { + debug self => _40; + debug count => const 1_usize; + let mut _41: *const T; + let mut _42: *const T; + scope 63 { + } + } + } + scope 57 { + scope 61 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _38; + } + } + } + } + } + } + scope 64 (inlined NonNull::::as_ref::<'_>) { + debug (*(self: &NonNull)) => _36; + let mut _54: *mut T; + scope 65 { + scope 66 (inlined NonNull::::as_ptr) { + debug self => _36; + let mut _48: *const T; + let mut _52: bool; + let mut _53: bool; + scope 67 { + scope 68 (inlined std::ptr::const_ptr::::is_null) { + debug self => _48; + let mut _49: *const u8; + scope 69 { + scope 70 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _49; + let mut _51: usize; + scope 71 (inlined std::ptr::const_ptr::::addr) { + debug self => _49; + let mut _50: *const (); + scope 72 { + scope 73 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _49; + } + } + } + } + } + } + } + } + scope 74 (inlined std::ptr::mut_ptr::::cast_const) { + debug self => _54; + } + } + } + } } } scope 3 (inlined core::slice::::iter) { @@ -26,34 +205,31 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _4: *const T; let mut _5: bool; let mut _6: usize; + let mut _7: *const T; let mut _8: usize; let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let mut _10: std::ptr::NonNull; scope 5 { debug ptr => _4; scope 6 { - let _7: *const T; scope 7 { debug end_or_len => _7; scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; - let mut _10: *const T; - let mut _22: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _22; + debug ptr => _9; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _22; - let mut _23: *mut u8; + debug self => _9; + let mut _59: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _23; + debug ptr => _59; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _23; + debug self => _59; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _23; + debug self => _59; } } } @@ -84,16 +260,15 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } scope 22 (inlined as IntoIterator>::into_iter) { - debug self => _13; + debug self => _11; } bb0: { StorageLive(_4); + StorageLive(_7); StorageLive(_3); _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + _4 = _3 as *const T (PtrToPtr); StorageLive(_5); _5 = const _; switchInt(move _5) -> [0: bb1, otherwise: bb2]; @@ -117,78 +292,217 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb3: { StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_22); - StorageLive(_23); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_23); - StorageDead(_22); - StorageDead(_10); + StorageLive(_9); + _9 = _3 as *mut T (PtrToPtr); + StorageLive(_59); + _10 = NonNull:: { pointer: _4 }; + StorageDead(_59); StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); + _11 = std::slice::Iter::<'_, T> { ptr: move _10, end_or_len: move _7, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_10); + StorageDead(_3); StorageDead(_7); StorageDead(_4); - StorageLive(_14); - _14 = _13; + StorageLive(_12); + _12 = _11; goto -> bb4; } bb4: { + StorageLive(_35); StorageLive(_16); - StorageLive(_15); - _15 = &mut _14; - _16 = as Iterator>::next(move _15) -> [return: bb5, unwind: bb11]; + StorageLive(_36); + StorageLive(_48); + StorageLive(_32); + StorageLive(_13); + _13 = const _; + switchInt(move _13) -> [0: bb5, otherwise: bb6]; } bb5: { + StorageLive(_15); + StorageLive(_14); + _14 = &raw const (_12.1: *const T); + _15 = _14 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_14); + _16 = (*_15); StorageDead(_15); - _17 = discriminant(_16); - switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageLive(_24); + StorageLive(_17); + _17 = (_12.0: std::ptr::NonNull); + StorageLive(_18); + StorageLive(_23); + StorageLive(_22); + _18 = (_17.0: *const T); + StorageLive(_19); + _19 = _18 as *const u8 (PtrToPtr); + StorageLive(_21); + StorageLive(_20); + _20 = _18 as *const () (PtrToPtr); + _21 = move _20 as usize (Transmute); + StorageDead(_20); + _22 = Eq(move _21, const 0_usize); + StorageDead(_21); + StorageDead(_19); + _23 = Not(move _22); + StorageDead(_22); + assume(move _23); + StorageDead(_23); + _24 = _18 as *mut T (PtrToPtr); + StorageDead(_18); + StorageDead(_17); + StorageLive(_31); + StorageLive(_25); + StorageLive(_30); + StorageLive(_29); + _25 = (_16.0: *const T); + StorageLive(_26); + _26 = _25 as *const u8 (PtrToPtr); + StorageLive(_28); + StorageLive(_27); + _27 = _25 as *const () (PtrToPtr); + _28 = move _27 as usize (Transmute); + StorageDead(_27); + _29 = Eq(move _28, const 0_usize); + StorageDead(_28); + StorageDead(_26); + _30 = Not(move _29); + StorageDead(_29); + assume(move _30); + StorageDead(_30); + _31 = _25 as *mut T (PtrToPtr); + StorageDead(_25); + _32 = Eq(move _24, move _31); + StorageDead(_31); + StorageDead(_24); + goto -> bb7; } bb6: { - StorageDead(_16); - StorageDead(_14); - drop(_2) -> [return: bb7, unwind continue]; + StorageLive(_33); + _33 = (_12.1: *const T); + StorageLive(_34); + _34 = _33 as *const () (PtrToPtr); + _35 = move _34 as usize (Transmute); + StorageDead(_34); + StorageDead(_33); + _32 = Eq(_35, const 0_usize); + goto -> bb7; } bb7: { - return; + StorageDead(_13); + switchInt(move _32) -> [0: bb8, otherwise: bb15]; } bb8: { - _18 = ((_16 as Some).0: &T); - StorageLive(_19); - _19 = &_2; - StorageLive(_20); - _20 = (_18,); - _21 = >::call(move _19, move _20) -> [return: bb9, unwind: bb11]; + StorageLive(_45); + StorageLive(_39); + _36 = (_12.0: std::ptr::NonNull); + StorageLive(_37); + _37 = const _; + switchInt(move _37) -> [0: bb9, otherwise: bb10]; } bb9: { - StorageDead(_20); - StorageDead(_19); - StorageDead(_16); - goto -> bb4; + StorageLive(_38); + _38 = &raw mut (_12.1: *const T); + _39 = _38 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_38); + StorageLive(_43); + StorageLive(_40); + _40 = (_12.0: std::ptr::NonNull); + StorageLive(_42); + StorageLive(_41); + _41 = (_40.0: *const T); + _42 = Offset(move _41, const 1_usize); + StorageDead(_41); + _43 = NonNull:: { pointer: move _42 }; + StorageDead(_42); + StorageDead(_40); + (_12.0: std::ptr::NonNull) = move _43; + StorageDead(_43); + goto -> bb11; } bb10: { - unreachable; + StorageLive(_44); + _44 = &raw mut (_12.1: *const T); + _45 = _44 as *mut usize (PtrToPtr); + StorageDead(_44); + StorageLive(_47); + StorageLive(_46); + _46 = (*_45); + _47 = SubUnchecked(_46, const 1_usize); + StorageDead(_46); + (*_45) = move _47; + StorageDead(_47); + goto -> bb11; } - bb11 (cleanup): { - drop(_2) -> [return: bb12, unwind terminate(cleanup)]; + bb11: { + StorageDead(_37); + StorageDead(_39); + StorageDead(_45); + StorageLive(_54); + StorageLive(_53); + StorageLive(_52); + _48 = (_36.0: *const T); + StorageLive(_49); + _49 = _48 as *const u8 (PtrToPtr); + StorageLive(_51); + StorageLive(_50); + _50 = _48 as *const () (PtrToPtr); + _51 = move _50 as usize (Transmute); + StorageDead(_50); + _52 = Eq(move _51, const 0_usize); + StorageDead(_51); + StorageDead(_49); + _53 = Not(move _52); + StorageDead(_52); + assume(move _53); + StorageDead(_53); + _54 = _48 as *mut T (PtrToPtr); + StorageDead(_54); + _55 = &(*_48); + StorageDead(_32); + StorageDead(_48); + StorageDead(_36); + StorageDead(_16); + StorageDead(_35); + StorageLive(_56); + _56 = &_2; + StorageLive(_57); + _57 = (_55,); + _58 = >::call(move _56, move _57) -> [return: bb12, unwind: bb13]; } - bb12 (cleanup): { + bb12: { + StorageDead(_57); + StorageDead(_56); + goto -> bb4; + } + + bb13 (cleanup): { + drop(_2) -> [return: bb14, unwind terminate(cleanup)]; + } + + bb14 (cleanup): { resume; } + + bb15: { + StorageDead(_32); + StorageDead(_48); + StorageDead(_36); + StorageDead(_16); + StorageDead(_35); + StorageDead(_12); + drop(_2) -> [return: bb16, unwind continue]; + } + + bb16: { + return; + } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir index 83915d3c44931..494f24d9e00f9 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir @@ -5,149 +5,92 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug f => _2; let mut _0: (); let mut _3: usize; - let mut _4: std::ops::Range; - let mut _5: std::ops::Range; - let mut _6: &mut std::ops::Range; - let mut _12: std::option::Option; - let mut _15: isize; - let mut _17: usize; - let mut _18: bool; - let mut _20: &impl Fn(usize, &T); - let mut _21: (usize, &T); - let _22: (); + let mut _4: usize; + let mut _7: usize; + let mut _8: bool; + let mut _10: &impl Fn(usize, &T); + let mut _11: (usize, &T); + let _12: (); scope 1 { - debug iter => _5; - let _16: usize; + debug ((iter: std::ops::Range).0: usize) => _4; + debug ((iter: std::ops::Range).1: usize) => _3; scope 2 { - debug i => _16; - let _19: &T; + debug i => _6; + let _9: &T; scope 3 { - debug x => _19; + debug x => _9; } } scope 5 (inlined iter::range::>::next) { - debug self => _6; + debug ((*(self: &mut std::ops::Range)).0: usize) => _4; + debug ((*(self: &mut std::ops::Range)).1: usize) => _3; scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &usize; - let mut _8: &usize; - let mut _11: bool; - let _13: usize; - let mut _14: usize; + debug ((*(self: &mut std::ops::Range)).0: usize) => _4; + debug ((*(self: &mut std::ops::Range)).1: usize) => _3; + let mut _5: bool; + let _6: usize; scope 7 { - debug old => _13; + debug old => _6; scope 8 { } } scope 9 (inlined std::cmp::impls::::lt) { - debug self => _7; - debug other => _8; - let mut _9: usize; - let mut _10: usize; + debug (*(self: &usize)) => _4; + debug (*(other: &usize)) => _3; } } } } scope 4 (inlined as IntoIterator>::into_iter) { - debug self => _4; + debug ((self: std::ops::Range).0: usize) => const 0_usize; + debug ((self: std::ops::Range).1: usize) => _3; } bb0: { - StorageLive(_3); _3 = Len((*_1)); - _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; - StorageDead(_3); - StorageLive(_5); - _5 = _4; + _4 = const 0_usize; goto -> bb1; } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); - StorageLive(_7); - _7 = &(_5.0: usize); - StorageLive(_8); - _8 = &(_5.1: usize); - StorageLive(_9); - _9 = (_5.0: usize); - StorageLive(_10); - _10 = (_5.1: usize); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageLive(_5); + _5 = Lt(_4, _3); + switchInt(move _5) -> [0: bb2, otherwise: bb4]; } bb2: { - StorageDead(_8); - StorageDead(_7); - _12 = const Option::::None; - goto -> bb5; + StorageDead(_5); + drop(_2) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_8); - StorageDead(_7); - _13 = (_5.0: usize); - StorageLive(_14); - _14 = ::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable]; + return; } bb4: { - (_5.0: usize) = move _14; - StorageDead(_14); - _12 = Option::::Some(_13); - goto -> bb5; + _6 = _4; + _4 = ::forward_unchecked(_6, const 1_usize) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11]; + StorageDead(_5); + _7 = Len((*_1)); + _8 = Lt(_6, _7); + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb6, unwind unreachable]; } bb6: { - StorageDead(_12); - StorageDead(_5); - drop(_2) -> [return: bb7, unwind unreachable]; + _9 = &(*_1)[_6]; + StorageLive(_10); + _10 = &_2; + StorageLive(_11); + _11 = (_6, _9); + _12 = >::call(move _10, move _11) -> [return: bb7, unwind unreachable]; } bb7: { - return; - } - - bb8: { - _16 = ((_12 as Some).0: usize); - _17 = Len((*_1)); - _18 = Lt(_16, _17); - assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind unreachable]; - } - - bb9: { - _19 = &(*_1)[_16]; - StorageLive(_20); - _20 = &_2; - StorageLive(_21); - _21 = (_16, _19); - _22 = >::call(move _20, move _21) -> [return: bb10, unwind unreachable]; - } - - bb10: { - StorageDead(_21); - StorageDead(_20); - StorageDead(_12); + StorageDead(_11); + StorageDead(_10); goto -> bb1; } - - bb11: { - unreachable; - } -} - -ALLOC0 (size: 16, align: 8) { - 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir index 0a005a460e84d..ecb66dc66e383 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir @@ -5,157 +5,100 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug f => _2; let mut _0: (); let mut _3: usize; - let mut _4: std::ops::Range; - let mut _5: std::ops::Range; - let mut _6: &mut std::ops::Range; - let mut _12: std::option::Option; - let mut _15: isize; - let mut _17: usize; - let mut _18: bool; - let mut _20: &impl Fn(usize, &T); - let mut _21: (usize, &T); - let _22: (); + let mut _4: usize; + let mut _7: usize; + let mut _8: bool; + let mut _10: &impl Fn(usize, &T); + let mut _11: (usize, &T); + let _12: (); scope 1 { - debug iter => _5; - let _16: usize; + debug ((iter: std::ops::Range).0: usize) => _4; + debug ((iter: std::ops::Range).1: usize) => _3; scope 2 { - debug i => _16; - let _19: &T; + debug i => _6; + let _9: &T; scope 3 { - debug x => _19; + debug x => _9; } } scope 5 (inlined iter::range::>::next) { - debug self => _6; + debug ((*(self: &mut std::ops::Range)).0: usize) => _4; + debug ((*(self: &mut std::ops::Range)).1: usize) => _3; scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &usize; - let mut _8: &usize; - let mut _11: bool; - let _13: usize; - let mut _14: usize; + debug ((*(self: &mut std::ops::Range)).0: usize) => _4; + debug ((*(self: &mut std::ops::Range)).1: usize) => _3; + let mut _5: bool; + let _6: usize; scope 7 { - debug old => _13; + debug old => _6; scope 8 { } } scope 9 (inlined std::cmp::impls::::lt) { - debug self => _7; - debug other => _8; - let mut _9: usize; - let mut _10: usize; + debug (*(self: &usize)) => _4; + debug (*(other: &usize)) => _3; } } } } scope 4 (inlined as IntoIterator>::into_iter) { - debug self => _4; + debug ((self: std::ops::Range).0: usize) => const 0_usize; + debug ((self: std::ops::Range).1: usize) => _3; } bb0: { - StorageLive(_3); _3 = Len((*_1)); - _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; - StorageDead(_3); - StorageLive(_5); - _5 = _4; + _4 = const 0_usize; goto -> bb1; } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); - StorageLive(_7); - _7 = &(_5.0: usize); - StorageLive(_8); - _8 = &(_5.1: usize); - StorageLive(_9); - _9 = (_5.0: usize); - StorageLive(_10); - _10 = (_5.1: usize); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageLive(_5); + _5 = Lt(_4, _3); + switchInt(move _5) -> [0: bb2, otherwise: bb4]; } bb2: { - StorageDead(_8); - StorageDead(_7); - _12 = const Option::::None; - goto -> bb5; + StorageDead(_5); + drop(_2) -> [return: bb3, unwind continue]; } bb3: { - StorageDead(_8); - StorageDead(_7); - _13 = (_5.0: usize); - StorageLive(_14); - _14 = ::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb12]; + return; } bb4: { - (_5.0: usize) = move _14; - StorageDead(_14); - _12 = Option::::Some(_13); - goto -> bb5; + _6 = _4; + _4 = ::forward_unchecked(_6, const 1_usize) -> [return: bb5, unwind: bb8]; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11]; + StorageDead(_5); + _7 = Len((*_1)); + _8 = Lt(_6, _7); + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb6, unwind: bb8]; } bb6: { - StorageDead(_12); - StorageDead(_5); - drop(_2) -> [return: bb7, unwind continue]; + _9 = &(*_1)[_6]; + StorageLive(_10); + _10 = &_2; + StorageLive(_11); + _11 = (_6, _9); + _12 = >::call(move _10, move _11) -> [return: bb7, unwind: bb8]; } bb7: { - return; - } - - bb8: { - _16 = ((_12 as Some).0: usize); - _17 = Len((*_1)); - _18 = Lt(_16, _17); - assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind: bb12]; - } - - bb9: { - _19 = &(*_1)[_16]; - StorageLive(_20); - _20 = &_2; - StorageLive(_21); - _21 = (_16, _19); - _22 = >::call(move _20, move _21) -> [return: bb10, unwind: bb12]; - } - - bb10: { - StorageDead(_21); - StorageDead(_20); - StorageDead(_12); + StorageDead(_11); + StorageDead(_10); goto -> bb1; } - bb11: { - unreachable; - } - - bb12 (cleanup): { - drop(_2) -> [return: bb13, unwind terminate(cleanup)]; + bb8 (cleanup): { + drop(_2) -> [return: bb9, unwind terminate(cleanup)]; } - bb13 (cleanup): { + bb9 (cleanup): { resume; } } - -ALLOC0 (size: 16, align: 8) { - 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ -} diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir index f9c8ab4db60b7..bf6841903c410 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir @@ -4,24 +4,207 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::iter::Rev>; - let mut _15: std::iter::Rev>; - let mut _16: &mut std::iter::Rev>; - let mut _18: std::option::Option<&T>; - let mut _19: isize; - let mut _21: &impl Fn(&T); - let mut _22: (&T,); - let _23: (); + let mut _11: std::slice::Iter<'_, T>; + let mut _12: std::iter::Rev>; + let mut _13: std::iter::Rev>; + let mut _57: &impl Fn(&T); + let mut _58: (&T,); + let _59: (); scope 1 { - debug iter => _15; - let _20: &T; + debug iter => _13; scope 2 { - debug x => _20; + debug x => _56; } scope 25 (inlined > as Iterator>::next) { - debug self => _16; - let mut _17: &mut std::slice::Iter<'_, T>; + debug (*(self: &mut Rev>)) => _13; + scope 26 (inlined as DoubleEndedIterator>::next_back) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => (_13.0: std::slice::Iter<'_, T>); + let mut _14: bool; + let mut _15: *const *const T; + let mut _16: *const std::ptr::NonNull; + let mut _33: bool; + let mut _34: *const T; + let mut _56: &T; + scope 27 { + scope 28 { + let _17: std::ptr::NonNull; + let _36: usize; + scope 29 { + debug len => _36; + } + scope 30 { + debug end => _17; + scope 36 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _17; + let mut _18: std::ptr::NonNull; + let mut _25: *mut T; + let mut _32: *mut T; + scope 37 (inlined NonNull::::as_ptr) { + debug self => _18; + let mut _19: *const T; + let mut _23: bool; + let mut _24: bool; + scope 38 { + scope 39 (inlined std::ptr::const_ptr::::is_null) { + debug self => _19; + let mut _20: *const u8; + scope 40 { + scope 41 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _20; + let mut _22: usize; + scope 42 (inlined std::ptr::const_ptr::::addr) { + debug self => _20; + let mut _21: *const (); + scope 43 { + scope 44 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _20; + } + } + } + } + } + } + } + } + scope 45 (inlined NonNull::::as_ptr) { + debug self => _17; + let mut _26: *const T; + let mut _30: bool; + let mut _31: bool; + scope 46 { + scope 47 (inlined std::ptr::const_ptr::::is_null) { + debug self => _26; + let mut _27: *const u8; + scope 48 { + scope 49 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _27; + let mut _29: usize; + scope 50 (inlined std::ptr::const_ptr::::addr) { + debug self => _27; + let mut _28: *const (); + scope 51 { + scope 52 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _27; + } + } + } + } + } + } + } + } + } + } + scope 31 { + scope 35 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _15; + } + } + scope 32 (inlined std::ptr::const_ptr::::addr) { + debug self => _34; + let mut _35: *const (); + scope 33 { + scope 34 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _34; + } + } + } + } + scope 53 (inlined std::slice::Iter::<'_, T>::pre_dec_end) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => (_13.0: std::slice::Iter<'_, T>); + debug offset => const 1_usize; + let mut _37: bool; + let mut _38: *mut *const T; + let mut _39: *mut std::ptr::NonNull; + let mut _40: std::ptr::NonNull; + let mut _45: *mut *const T; + let mut _46: *mut usize; + let mut _47: usize; + let mut _48: usize; + scope 54 { + scope 55 { + debug len => _46; + scope 57 { + scope 62 (inlined core::num::::unchecked_sub) { + debug self => _47; + debug rhs => const 1_usize; + scope 63 { + } + } + } + } + scope 56 { + scope 61 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _45; + } + } + scope 58 { + debug end => _39; + scope 60 { + scope 65 (inlined NonNull::::sub) { + debug self => _40; + debug count => const 1_usize; + let mut _41: bool; + scope 66 { + scope 67 (inlined NonNull::::offset) { + debug self => _40; + debug count => const -1_isize; + let mut _42: *const T; + let mut _43: *const T; + scope 68 { + } + } + } + } + } + } + scope 59 { + scope 64 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _38; + } + } + } + } + scope 69 (inlined NonNull::::as_ref::<'_>) { + debug (*(self: &NonNull)) => _44; + let mut _44: std::ptr::NonNull; + let mut _55: *mut T; + scope 70 { + scope 71 (inlined NonNull::::as_ptr) { + debug self => _44; + let mut _49: *const T; + let mut _53: bool; + let mut _54: bool; + scope 72 { + scope 73 (inlined std::ptr::const_ptr::::is_null) { + debug self => _49; + let mut _50: *const u8; + scope 74 { + scope 75 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _50; + let mut _52: usize; + scope 76 (inlined std::ptr::const_ptr::::addr) { + debug self => _50; + let mut _51: *const (); + scope 77 { + scope 78 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _50; + } + } + } + } + } + } + } + } + scope 79 (inlined std::ptr::mut_ptr::::cast_const) { + debug self => _55; + } + } + } + } + } } } scope 3 (inlined core::slice::::iter) { @@ -31,34 +214,31 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _4: *const T; let mut _5: bool; let mut _6: usize; + let mut _7: *const T; let mut _8: usize; let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let mut _10: std::ptr::NonNull; scope 5 { debug ptr => _4; scope 6 { - let _7: *const T; scope 7 { debug end_or_len => _7; scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; - let mut _10: *const T; - let mut _24: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _24; + debug ptr => _9; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _24; - let mut _25: *mut u8; + debug self => _9; + let mut _60: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _25; + debug ptr => _60; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _25; + debug self => _60; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _25; + debug self => _60; } } } @@ -89,23 +269,22 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } scope 22 (inlined as Iterator>::rev) { - debug self => _13; + debug self => _11; scope 23 (inlined Rev::>::new) { - debug iter => _13; + debug iter => _11; } } scope 24 (inlined > as IntoIterator>::into_iter) { - debug self => _14; + debug self => _12; } bb0: { - StorageLive(_13); + StorageLive(_11); StorageLive(_4); + StorageLive(_7); StorageLive(_3); _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + _4 = _3 as *const T (PtrToPtr); StorageLive(_5); _5 = const _; switchInt(move _5) -> [0: bb1, otherwise: bb2]; @@ -129,73 +308,221 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb3: { StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); - StorageLive(_25); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_25); - StorageDead(_24); - StorageDead(_10); + StorageLive(_9); + _9 = _3 as *mut T (PtrToPtr); + StorageLive(_60); + _10 = NonNull:: { pointer: _4 }; + StorageDead(_60); StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); + _11 = std::slice::Iter::<'_, T> { ptr: move _10, end_or_len: move _7, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_10); + StorageDead(_3); StorageDead(_7); StorageDead(_4); - _14 = Rev::> { iter: _13 }; - StorageDead(_13); - StorageLive(_15); - _15 = _14; + _12 = Rev::> { iter: _11 }; + StorageDead(_11); + StorageLive(_13); + _13 = _12; goto -> bb4; } bb4: { - StorageLive(_18); - _16 = &mut _15; + StorageLive(_36); StorageLive(_17); - _17 = &mut (_15.0: std::slice::Iter<'_, T>); - _18 = as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable]; + StorageLive(_44); + StorageLive(_49); + StorageLive(_33); + StorageLive(_14); + _14 = const _; + switchInt(move _14) -> [0: bb5, otherwise: bb6]; } bb5: { - StorageDead(_17); - _19 = discriminant(_18); - switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageLive(_16); + StorageLive(_15); + _15 = &raw const ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _16 = _15 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_15); + _17 = (*_16); + StorageDead(_16); + StorageLive(_25); + StorageLive(_18); + _18 = ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + StorageLive(_19); + StorageLive(_24); + StorageLive(_23); + _19 = (_18.0: *const T); + StorageLive(_20); + _20 = _19 as *const u8 (PtrToPtr); + StorageLive(_22); + StorageLive(_21); + _21 = _19 as *const () (PtrToPtr); + _22 = move _21 as usize (Transmute); + StorageDead(_21); + _23 = Eq(move _22, const 0_usize); + StorageDead(_22); + StorageDead(_20); + _24 = Not(move _23); + StorageDead(_23); + assume(move _24); + StorageDead(_24); + _25 = _19 as *mut T (PtrToPtr); + StorageDead(_19); + StorageDead(_18); + StorageLive(_32); + StorageLive(_26); + StorageLive(_31); + StorageLive(_30); + _26 = (_17.0: *const T); + StorageLive(_27); + _27 = _26 as *const u8 (PtrToPtr); + StorageLive(_29); + StorageLive(_28); + _28 = _26 as *const () (PtrToPtr); + _29 = move _28 as usize (Transmute); + StorageDead(_28); + _30 = Eq(move _29, const 0_usize); + StorageDead(_29); + StorageDead(_27); + _31 = Not(move _30); + StorageDead(_30); + assume(move _31); + StorageDead(_31); + _32 = _26 as *mut T (PtrToPtr); + StorageDead(_26); + _33 = Eq(move _25, move _32); + StorageDead(_32); + StorageDead(_25); + goto -> bb7; } bb6: { - StorageDead(_18); - StorageDead(_15); - drop(_2) -> [return: bb7, unwind unreachable]; + StorageLive(_34); + _34 = ((_13.0: std::slice::Iter<'_, T>).1: *const T); + StorageLive(_35); + _35 = _34 as *const () (PtrToPtr); + _36 = move _35 as usize (Transmute); + StorageDead(_35); + StorageDead(_34); + _33 = Eq(_36, const 0_usize); + goto -> bb7; } bb7: { - return; + StorageDead(_14); + switchInt(move _33) -> [0: bb8, otherwise: bb15]; } bb8: { - _20 = ((_18 as Some).0: &T); - StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_20,); - _23 = >::call(move _21, move _22) -> [return: bb9, unwind unreachable]; + StorageLive(_46); + StorageLive(_39); + StorageLive(_40); + StorageLive(_37); + _37 = const _; + switchInt(move _37) -> [0: bb9, otherwise: bb12]; } bb9: { - StorageDead(_22); - StorageDead(_21); - StorageDead(_18); - goto -> bb4; + StorageLive(_38); + _38 = &raw mut ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _39 = _38 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_38); + _40 = (*_39); + StorageLive(_41); + _41 = const _; + switchInt(move _41) -> [0: bb10, otherwise: bb11]; } bb10: { - unreachable; + StorageLive(_43); + StorageLive(_42); + _42 = (_40.0: *const T); + _43 = Offset(move _42, const -1_isize); + StorageDead(_42); + _40 = NonNull:: { pointer: move _43 }; + StorageDead(_43); + goto -> bb11; + } + + bb11: { + StorageDead(_41); + (*_39) = move _40; + _44 = (*_39); + goto -> bb13; + } + + bb12: { + StorageLive(_45); + _45 = &raw mut ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _46 = _45 as *mut usize (PtrToPtr); + StorageDead(_45); + StorageLive(_48); + StorageLive(_47); + _47 = (*_46); + _48 = SubUnchecked(_47, const 1_usize); + StorageDead(_47); + (*_46) = move _48; + StorageDead(_48); + _44 = ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + goto -> bb13; + } + + bb13: { + StorageDead(_37); + StorageDead(_40); + StorageDead(_39); + StorageDead(_46); + StorageLive(_55); + StorageLive(_54); + StorageLive(_53); + _49 = (_44.0: *const T); + StorageLive(_50); + _50 = _49 as *const u8 (PtrToPtr); + StorageLive(_52); + StorageLive(_51); + _51 = _49 as *const () (PtrToPtr); + _52 = move _51 as usize (Transmute); + StorageDead(_51); + _53 = Eq(move _52, const 0_usize); + StorageDead(_52); + StorageDead(_50); + _54 = Not(move _53); + StorageDead(_53); + assume(move _54); + StorageDead(_54); + _55 = _49 as *mut T (PtrToPtr); + StorageDead(_55); + _56 = &(*_49); + StorageDead(_33); + StorageDead(_49); + StorageDead(_44); + StorageDead(_17); + StorageDead(_36); + StorageLive(_57); + _57 = &_2; + StorageLive(_58); + _58 = (_56,); + _59 = >::call(move _57, move _58) -> [return: bb14, unwind unreachable]; + } + + bb14: { + StorageDead(_58); + StorageDead(_57); + goto -> bb4; + } + + bb15: { + StorageDead(_33); + StorageDead(_49); + StorageDead(_44); + StorageDead(_17); + StorageDead(_36); + StorageDead(_13); + drop(_2) -> [return: bb16, unwind unreachable]; + } + + bb16: { + return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index 65f423ac326be..0592af2cd7303 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -4,24 +4,207 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::iter::Rev>; - let mut _15: std::iter::Rev>; - let mut _16: &mut std::iter::Rev>; - let mut _18: std::option::Option<&T>; - let mut _19: isize; - let mut _21: &impl Fn(&T); - let mut _22: (&T,); - let _23: (); + let mut _11: std::slice::Iter<'_, T>; + let mut _12: std::iter::Rev>; + let mut _13: std::iter::Rev>; + let mut _57: &impl Fn(&T); + let mut _58: (&T,); + let _59: (); scope 1 { - debug iter => _15; - let _20: &T; + debug iter => _13; scope 2 { - debug x => _20; + debug x => _56; } scope 25 (inlined > as Iterator>::next) { - debug self => _16; - let mut _17: &mut std::slice::Iter<'_, T>; + debug (*(self: &mut Rev>)) => _13; + scope 26 (inlined as DoubleEndedIterator>::next_back) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => (_13.0: std::slice::Iter<'_, T>); + let mut _14: bool; + let mut _15: *const *const T; + let mut _16: *const std::ptr::NonNull; + let mut _33: bool; + let mut _34: *const T; + let mut _56: &T; + scope 27 { + scope 28 { + let _17: std::ptr::NonNull; + let _36: usize; + scope 29 { + debug len => _36; + } + scope 30 { + debug end => _17; + scope 36 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _17; + let mut _18: std::ptr::NonNull; + let mut _25: *mut T; + let mut _32: *mut T; + scope 37 (inlined NonNull::::as_ptr) { + debug self => _18; + let mut _19: *const T; + let mut _23: bool; + let mut _24: bool; + scope 38 { + scope 39 (inlined std::ptr::const_ptr::::is_null) { + debug self => _19; + let mut _20: *const u8; + scope 40 { + scope 41 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _20; + let mut _22: usize; + scope 42 (inlined std::ptr::const_ptr::::addr) { + debug self => _20; + let mut _21: *const (); + scope 43 { + scope 44 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _20; + } + } + } + } + } + } + } + } + scope 45 (inlined NonNull::::as_ptr) { + debug self => _17; + let mut _26: *const T; + let mut _30: bool; + let mut _31: bool; + scope 46 { + scope 47 (inlined std::ptr::const_ptr::::is_null) { + debug self => _26; + let mut _27: *const u8; + scope 48 { + scope 49 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _27; + let mut _29: usize; + scope 50 (inlined std::ptr::const_ptr::::addr) { + debug self => _27; + let mut _28: *const (); + scope 51 { + scope 52 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _27; + } + } + } + } + } + } + } + } + } + } + scope 31 { + scope 35 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _15; + } + } + scope 32 (inlined std::ptr::const_ptr::::addr) { + debug self => _34; + let mut _35: *const (); + scope 33 { + scope 34 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _34; + } + } + } + } + scope 53 (inlined std::slice::Iter::<'_, T>::pre_dec_end) { + debug (*(self: &mut std::slice::Iter<'_, T>)) => (_13.0: std::slice::Iter<'_, T>); + debug offset => const 1_usize; + let mut _37: bool; + let mut _38: *mut *const T; + let mut _39: *mut std::ptr::NonNull; + let mut _40: std::ptr::NonNull; + let mut _45: *mut *const T; + let mut _46: *mut usize; + let mut _47: usize; + let mut _48: usize; + scope 54 { + scope 55 { + debug len => _46; + scope 57 { + scope 62 (inlined core::num::::unchecked_sub) { + debug self => _47; + debug rhs => const 1_usize; + scope 63 { + } + } + } + } + scope 56 { + scope 61 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _45; + } + } + scope 58 { + debug end => _39; + scope 60 { + scope 65 (inlined NonNull::::sub) { + debug self => _40; + debug count => const 1_usize; + let mut _41: bool; + scope 66 { + scope 67 (inlined NonNull::::offset) { + debug self => _40; + debug count => const -1_isize; + let mut _42: *const T; + let mut _43: *const T; + scope 68 { + } + } + } + } + } + } + scope 59 { + scope 64 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _38; + } + } + } + } + scope 69 (inlined NonNull::::as_ref::<'_>) { + debug (*(self: &NonNull)) => _44; + let mut _44: std::ptr::NonNull; + let mut _55: *mut T; + scope 70 { + scope 71 (inlined NonNull::::as_ptr) { + debug self => _44; + let mut _49: *const T; + let mut _53: bool; + let mut _54: bool; + scope 72 { + scope 73 (inlined std::ptr::const_ptr::::is_null) { + debug self => _49; + let mut _50: *const u8; + scope 74 { + scope 75 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _50; + let mut _52: usize; + scope 76 (inlined std::ptr::const_ptr::::addr) { + debug self => _50; + let mut _51: *const (); + scope 77 { + scope 78 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _50; + } + } + } + } + } + } + } + } + scope 79 (inlined std::ptr::mut_ptr::::cast_const) { + debug self => _55; + } + } + } + } + } } } scope 3 (inlined core::slice::::iter) { @@ -31,34 +214,31 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _4: *const T; let mut _5: bool; let mut _6: usize; + let mut _7: *const T; let mut _8: usize; let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let mut _10: std::ptr::NonNull; scope 5 { debug ptr => _4; scope 6 { - let _7: *const T; scope 7 { debug end_or_len => _7; scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; - let mut _10: *const T; - let mut _24: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _24; + debug ptr => _9; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _24; - let mut _25: *mut u8; + debug self => _9; + let mut _60: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _25; + debug ptr => _60; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _25; + debug self => _60; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _25; + debug self => _60; } } } @@ -89,23 +269,22 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } scope 22 (inlined as Iterator>::rev) { - debug self => _13; + debug self => _11; scope 23 (inlined Rev::>::new) { - debug iter => _13; + debug iter => _11; } } scope 24 (inlined > as IntoIterator>::into_iter) { - debug self => _14; + debug self => _12; } bb0: { - StorageLive(_13); + StorageLive(_11); StorageLive(_4); + StorageLive(_7); StorageLive(_3); _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + _4 = _3 as *const T (PtrToPtr); StorageLive(_5); _5 = const _; switchInt(move _5) -> [0: bb1, otherwise: bb2]; @@ -129,81 +308,229 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb3: { StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); - StorageLive(_25); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_25); - StorageDead(_24); - StorageDead(_10); + StorageLive(_9); + _9 = _3 as *mut T (PtrToPtr); + StorageLive(_60); + _10 = NonNull:: { pointer: _4 }; + StorageDead(_60); StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); + _11 = std::slice::Iter::<'_, T> { ptr: move _10, end_or_len: move _7, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_10); + StorageDead(_3); StorageDead(_7); StorageDead(_4); - _14 = Rev::> { iter: _13 }; - StorageDead(_13); - StorageLive(_15); - _15 = _14; + _12 = Rev::> { iter: _11 }; + StorageDead(_11); + StorageLive(_13); + _13 = _12; goto -> bb4; } bb4: { - StorageLive(_18); - _16 = &mut _15; + StorageLive(_36); StorageLive(_17); - _17 = &mut (_15.0: std::slice::Iter<'_, T>); - _18 = as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11]; + StorageLive(_44); + StorageLive(_49); + StorageLive(_33); + StorageLive(_14); + _14 = const _; + switchInt(move _14) -> [0: bb5, otherwise: bb6]; } bb5: { - StorageDead(_17); - _19 = discriminant(_18); - switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageLive(_16); + StorageLive(_15); + _15 = &raw const ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _16 = _15 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_15); + _17 = (*_16); + StorageDead(_16); + StorageLive(_25); + StorageLive(_18); + _18 = ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + StorageLive(_19); + StorageLive(_24); + StorageLive(_23); + _19 = (_18.0: *const T); + StorageLive(_20); + _20 = _19 as *const u8 (PtrToPtr); + StorageLive(_22); + StorageLive(_21); + _21 = _19 as *const () (PtrToPtr); + _22 = move _21 as usize (Transmute); + StorageDead(_21); + _23 = Eq(move _22, const 0_usize); + StorageDead(_22); + StorageDead(_20); + _24 = Not(move _23); + StorageDead(_23); + assume(move _24); + StorageDead(_24); + _25 = _19 as *mut T (PtrToPtr); + StorageDead(_19); + StorageDead(_18); + StorageLive(_32); + StorageLive(_26); + StorageLive(_31); + StorageLive(_30); + _26 = (_17.0: *const T); + StorageLive(_27); + _27 = _26 as *const u8 (PtrToPtr); + StorageLive(_29); + StorageLive(_28); + _28 = _26 as *const () (PtrToPtr); + _29 = move _28 as usize (Transmute); + StorageDead(_28); + _30 = Eq(move _29, const 0_usize); + StorageDead(_29); + StorageDead(_27); + _31 = Not(move _30); + StorageDead(_30); + assume(move _31); + StorageDead(_31); + _32 = _26 as *mut T (PtrToPtr); + StorageDead(_26); + _33 = Eq(move _25, move _32); + StorageDead(_32); + StorageDead(_25); + goto -> bb7; } bb6: { - StorageDead(_18); - StorageDead(_15); - drop(_2) -> [return: bb7, unwind continue]; + StorageLive(_34); + _34 = ((_13.0: std::slice::Iter<'_, T>).1: *const T); + StorageLive(_35); + _35 = _34 as *const () (PtrToPtr); + _36 = move _35 as usize (Transmute); + StorageDead(_35); + StorageDead(_34); + _33 = Eq(_36, const 0_usize); + goto -> bb7; } bb7: { - return; + StorageDead(_14); + switchInt(move _33) -> [0: bb8, otherwise: bb17]; } bb8: { - _20 = ((_18 as Some).0: &T); - StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_20,); - _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; + StorageLive(_46); + StorageLive(_39); + StorageLive(_40); + StorageLive(_37); + _37 = const _; + switchInt(move _37) -> [0: bb9, otherwise: bb12]; } bb9: { - StorageDead(_22); - StorageDead(_21); - StorageDead(_18); - goto -> bb4; + StorageLive(_38); + _38 = &raw mut ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _39 = _38 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_38); + _40 = (*_39); + StorageLive(_41); + _41 = const _; + switchInt(move _41) -> [0: bb10, otherwise: bb11]; } bb10: { - unreachable; + StorageLive(_43); + StorageLive(_42); + _42 = (_40.0: *const T); + _43 = Offset(move _42, const -1_isize); + StorageDead(_42); + _40 = NonNull:: { pointer: move _43 }; + StorageDead(_43); + goto -> bb11; + } + + bb11: { + StorageDead(_41); + (*_39) = move _40; + _44 = (*_39); + goto -> bb13; + } + + bb12: { + StorageLive(_45); + _45 = &raw mut ((_13.0: std::slice::Iter<'_, T>).1: *const T); + _46 = _45 as *mut usize (PtrToPtr); + StorageDead(_45); + StorageLive(_48); + StorageLive(_47); + _47 = (*_46); + _48 = SubUnchecked(_47, const 1_usize); + StorageDead(_47); + (*_46) = move _48; + StorageDead(_48); + _44 = ((_13.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull); + goto -> bb13; + } + + bb13: { + StorageDead(_37); + StorageDead(_40); + StorageDead(_39); + StorageDead(_46); + StorageLive(_55); + StorageLive(_54); + StorageLive(_53); + _49 = (_44.0: *const T); + StorageLive(_50); + _50 = _49 as *const u8 (PtrToPtr); + StorageLive(_52); + StorageLive(_51); + _51 = _49 as *const () (PtrToPtr); + _52 = move _51 as usize (Transmute); + StorageDead(_51); + _53 = Eq(move _52, const 0_usize); + StorageDead(_52); + StorageDead(_50); + _54 = Not(move _53); + StorageDead(_53); + assume(move _54); + StorageDead(_54); + _55 = _49 as *mut T (PtrToPtr); + StorageDead(_55); + _56 = &(*_49); + StorageDead(_33); + StorageDead(_49); + StorageDead(_44); + StorageDead(_17); + StorageDead(_36); + StorageLive(_57); + _57 = &_2; + StorageLive(_58); + _58 = (_56,); + _59 = >::call(move _57, move _58) -> [return: bb14, unwind: bb15]; + } + + bb14: { + StorageDead(_58); + StorageDead(_57); + goto -> bb4; } - bb11 (cleanup): { - drop(_2) -> [return: bb12, unwind terminate(cleanup)]; + bb15 (cleanup): { + drop(_2) -> [return: bb16, unwind terminate(cleanup)]; } - bb12 (cleanup): { + bb16 (cleanup): { resume; } + + bb17: { + StorageDead(_33); + StorageDead(_49); + StorageDead(_44); + StorageDead(_17); + StorageDead(_36); + StorageDead(_13); + drop(_2) -> [return: bb18, unwind continue]; + } + + bb18: { + return; + } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir index 78f96bf419559..5484f45df83a5 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir @@ -3,12 +3,376 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut T> { debug it => _1; let mut _0: std::option::Option<&mut T>; + scope 1 (inlined as DoubleEndedIterator>::next_back) { + debug self => _1; + let mut _2: bool; + let mut _3: *const *mut T; + let mut _4: *const std::ptr::NonNull; + let mut _21: bool; + let mut _22: *mut T; + let mut _44: &mut T; + scope 2 { + scope 3 { + let _5: std::ptr::NonNull; + let _24: usize; + scope 4 { + debug len => _24; + } + scope 5 { + debug end => _5; + scope 11 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => ((*_1).0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _5; + let mut _6: std::ptr::NonNull; + let mut _13: *mut T; + let mut _20: *mut T; + scope 12 (inlined NonNull::::as_ptr) { + debug self => _6; + let mut _7: *const T; + let mut _11: bool; + let mut _12: bool; + scope 13 { + scope 14 (inlined std::ptr::const_ptr::::is_null) { + debug self => _7; + let mut _8: *const u8; + scope 15 { + scope 16 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _8; + let mut _10: usize; + scope 17 (inlined std::ptr::const_ptr::::addr) { + debug self => _8; + let mut _9: *const (); + scope 18 { + scope 19 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _8; + } + } + } + } + } + } + } + } + scope 20 (inlined NonNull::::as_ptr) { + debug self => _5; + let mut _14: *const T; + let mut _18: bool; + let mut _19: bool; + scope 21 { + scope 22 (inlined std::ptr::const_ptr::::is_null) { + debug self => _14; + let mut _15: *const u8; + scope 23 { + scope 24 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _15; + let mut _17: usize; + scope 25 (inlined std::ptr::const_ptr::::addr) { + debug self => _15; + let mut _16: *const (); + scope 26 { + scope 27 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _15; + } + } + } + } + } + } + } + } + } + } + scope 6 { + scope 10 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _3; + } + } + scope 7 (inlined std::ptr::mut_ptr::::addr) { + debug self => _22; + let mut _23: *mut (); + scope 8 { + scope 9 (inlined std::ptr::mut_ptr::::cast::<()>) { + debug self => _22; + } + } + } + } + scope 28 (inlined std::slice::IterMut::<'_, T>::pre_dec_end) { + debug self => _1; + debug offset => const 1_usize; + let mut _25: bool; + let mut _26: *mut *mut T; + let mut _27: *mut std::ptr::NonNull; + let mut _28: std::ptr::NonNull; + let mut _33: *mut *mut T; + let mut _34: *mut usize; + let mut _35: usize; + let mut _36: usize; + scope 29 { + scope 30 { + debug len => _34; + scope 32 { + scope 37 (inlined core::num::::unchecked_sub) { + debug self => _35; + debug rhs => const 1_usize; + scope 38 { + } + } + } + } + scope 31 { + scope 36 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _33; + } + } + scope 33 { + debug end => _27; + scope 35 { + scope 40 (inlined NonNull::::sub) { + debug self => _28; + debug count => const 1_usize; + let mut _29: bool; + scope 41 { + scope 42 (inlined NonNull::::offset) { + debug self => _28; + debug count => const -1_isize; + let mut _30: *const T; + let mut _31: *const T; + scope 43 { + } + } + } + } + } + } + scope 34 { + scope 39 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _26; + } + } + } + } + scope 44 (inlined NonNull::::as_mut::<'_>) { + debug (*(self: &mut NonNull)) => _32; + let mut _32: std::ptr::NonNull; + let mut _43: *mut T; + scope 45 { + scope 46 (inlined NonNull::::as_ptr) { + debug self => _32; + let mut _37: *const T; + let mut _41: bool; + let mut _42: bool; + scope 47 { + scope 48 (inlined std::ptr::const_ptr::::is_null) { + debug self => _37; + let mut _38: *const u8; + scope 49 { + scope 50 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _38; + let mut _40: usize; + scope 51 (inlined std::ptr::const_ptr::::addr) { + debug self => _38; + let mut _39: *const (); + scope 52 { + scope 53 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _38; + } + } + } + } + } + } + } + } + } + } + } + } bb0: { - _0 = as DoubleEndedIterator>::next_back(move _1) -> [return: bb1, unwind unreachable]; + StorageLive(_24); + StorageLive(_5); + StorageLive(_43); + StorageLive(_32); + StorageLive(_21); + StorageLive(_2); + _2 = const _; + switchInt(move _2) -> [0: bb1, otherwise: bb2]; } bb1: { + StorageLive(_4); + StorageLive(_3); + _3 = &raw const ((*_1).1: *mut T); + _4 = _3 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_3); + _5 = (*_4); + StorageDead(_4); + StorageLive(_13); + StorageLive(_6); + _6 = ((*_1).0: std::ptr::NonNull); + StorageLive(_7); + StorageLive(_12); + StorageLive(_11); + _7 = (_6.0: *const T); + StorageLive(_8); + _8 = _7 as *const u8 (PtrToPtr); + StorageLive(_10); + StorageLive(_9); + _9 = _7 as *const () (PtrToPtr); + _10 = move _9 as usize (Transmute); + StorageDead(_9); + _11 = Eq(move _10, const 0_usize); + StorageDead(_10); + StorageDead(_8); + _12 = Not(move _11); + StorageDead(_11); + assume(move _12); + StorageDead(_12); + _13 = _7 as *mut T (PtrToPtr); + StorageDead(_7); + StorageDead(_6); + StorageLive(_20); + StorageLive(_14); + StorageLive(_19); + StorageLive(_18); + _14 = (_5.0: *const T); + StorageLive(_15); + _15 = _14 as *const u8 (PtrToPtr); + StorageLive(_17); + StorageLive(_16); + _16 = _14 as *const () (PtrToPtr); + _17 = move _16 as usize (Transmute); + StorageDead(_16); + _18 = Eq(move _17, const 0_usize); + StorageDead(_17); + StorageDead(_15); + _19 = Not(move _18); + StorageDead(_18); + assume(move _19); + StorageDead(_19); + _20 = _14 as *mut T (PtrToPtr); + StorageDead(_14); + _21 = Eq(move _13, move _20); + StorageDead(_20); + StorageDead(_13); + goto -> bb3; + } + + bb2: { + StorageLive(_22); + _22 = ((*_1).1: *mut T); + StorageLive(_23); + _23 = _22 as *mut () (PtrToPtr); + _24 = move _23 as usize (Transmute); + StorageDead(_23); + StorageDead(_22); + _21 = Eq(_24, const 0_usize); + goto -> bb3; + } + + bb3: { + StorageDead(_2); + switchInt(move _21) -> [0: bb4, otherwise: bb10]; + } + + bb4: { + StorageLive(_44); + StorageLive(_34); + StorageLive(_27); + StorageLive(_28); + StorageLive(_25); + _25 = const _; + switchInt(move _25) -> [0: bb5, otherwise: bb8]; + } + + bb5: { + StorageLive(_26); + _26 = &raw mut ((*_1).1: *mut T); + _27 = _26 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_26); + _28 = (*_27); + StorageLive(_29); + _29 = const _; + switchInt(move _29) -> [0: bb6, otherwise: bb7]; + } + + bb6: { + StorageLive(_31); + StorageLive(_30); + _30 = (_28.0: *const T); + _31 = Offset(move _30, const -1_isize); + StorageDead(_30); + _28 = NonNull:: { pointer: move _31 }; + StorageDead(_31); + goto -> bb7; + } + + bb7: { + StorageDead(_29); + (*_27) = move _28; + _32 = (*_27); + goto -> bb9; + } + + bb8: { + StorageLive(_33); + _33 = &raw mut ((*_1).1: *mut T); + _34 = _33 as *mut usize (PtrToPtr); + StorageDead(_33); + StorageLive(_36); + StorageLive(_35); + _35 = (*_34); + _36 = SubUnchecked(_35, const 1_usize); + StorageDead(_35); + (*_34) = move _36; + StorageDead(_36); + _32 = ((*_1).0: std::ptr::NonNull); + goto -> bb9; + } + + bb9: { + StorageDead(_25); + StorageDead(_28); + StorageDead(_27); + StorageDead(_34); + StorageLive(_37); + StorageLive(_42); + StorageLive(_41); + _37 = (_32.0: *const T); + StorageLive(_38); + _38 = _37 as *const u8 (PtrToPtr); + StorageLive(_40); + StorageLive(_39); + _39 = _37 as *const () (PtrToPtr); + _40 = move _39 as usize (Transmute); + StorageDead(_39); + _41 = Eq(move _40, const 0_usize); + StorageDead(_40); + StorageDead(_38); + _42 = Not(move _41); + StorageDead(_41); + assume(move _42); + StorageDead(_42); + _43 = _37 as *mut T (PtrToPtr); + StorageDead(_37); + _44 = &mut (*_43); + _0 = Option::<&mut T>::Some(move _44); + StorageDead(_44); + goto -> bb11; + } + + bb10: { + _0 = const {transmute(0x0000000000000000): Option<&mut T>}; + goto -> bb11; + } + + bb11: { + StorageDead(_21); + StorageDead(_32); + StorageDead(_43); + StorageDead(_5); + StorageDead(_24); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir index dfe5e206fadaf..5484f45df83a5 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir @@ -3,12 +3,376 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut T> { debug it => _1; let mut _0: std::option::Option<&mut T>; + scope 1 (inlined as DoubleEndedIterator>::next_back) { + debug self => _1; + let mut _2: bool; + let mut _3: *const *mut T; + let mut _4: *const std::ptr::NonNull; + let mut _21: bool; + let mut _22: *mut T; + let mut _44: &mut T; + scope 2 { + scope 3 { + let _5: std::ptr::NonNull; + let _24: usize; + scope 4 { + debug len => _24; + } + scope 5 { + debug end => _5; + scope 11 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => ((*_1).0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _5; + let mut _6: std::ptr::NonNull; + let mut _13: *mut T; + let mut _20: *mut T; + scope 12 (inlined NonNull::::as_ptr) { + debug self => _6; + let mut _7: *const T; + let mut _11: bool; + let mut _12: bool; + scope 13 { + scope 14 (inlined std::ptr::const_ptr::::is_null) { + debug self => _7; + let mut _8: *const u8; + scope 15 { + scope 16 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _8; + let mut _10: usize; + scope 17 (inlined std::ptr::const_ptr::::addr) { + debug self => _8; + let mut _9: *const (); + scope 18 { + scope 19 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _8; + } + } + } + } + } + } + } + } + scope 20 (inlined NonNull::::as_ptr) { + debug self => _5; + let mut _14: *const T; + let mut _18: bool; + let mut _19: bool; + scope 21 { + scope 22 (inlined std::ptr::const_ptr::::is_null) { + debug self => _14; + let mut _15: *const u8; + scope 23 { + scope 24 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _15; + let mut _17: usize; + scope 25 (inlined std::ptr::const_ptr::::addr) { + debug self => _15; + let mut _16: *const (); + scope 26 { + scope 27 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _15; + } + } + } + } + } + } + } + } + } + } + scope 6 { + scope 10 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _3; + } + } + scope 7 (inlined std::ptr::mut_ptr::::addr) { + debug self => _22; + let mut _23: *mut (); + scope 8 { + scope 9 (inlined std::ptr::mut_ptr::::cast::<()>) { + debug self => _22; + } + } + } + } + scope 28 (inlined std::slice::IterMut::<'_, T>::pre_dec_end) { + debug self => _1; + debug offset => const 1_usize; + let mut _25: bool; + let mut _26: *mut *mut T; + let mut _27: *mut std::ptr::NonNull; + let mut _28: std::ptr::NonNull; + let mut _33: *mut *mut T; + let mut _34: *mut usize; + let mut _35: usize; + let mut _36: usize; + scope 29 { + scope 30 { + debug len => _34; + scope 32 { + scope 37 (inlined core::num::::unchecked_sub) { + debug self => _35; + debug rhs => const 1_usize; + scope 38 { + } + } + } + } + scope 31 { + scope 36 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _33; + } + } + scope 33 { + debug end => _27; + scope 35 { + scope 40 (inlined NonNull::::sub) { + debug self => _28; + debug count => const 1_usize; + let mut _29: bool; + scope 41 { + scope 42 (inlined NonNull::::offset) { + debug self => _28; + debug count => const -1_isize; + let mut _30: *const T; + let mut _31: *const T; + scope 43 { + } + } + } + } + } + } + scope 34 { + scope 39 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _26; + } + } + } + } + scope 44 (inlined NonNull::::as_mut::<'_>) { + debug (*(self: &mut NonNull)) => _32; + let mut _32: std::ptr::NonNull; + let mut _43: *mut T; + scope 45 { + scope 46 (inlined NonNull::::as_ptr) { + debug self => _32; + let mut _37: *const T; + let mut _41: bool; + let mut _42: bool; + scope 47 { + scope 48 (inlined std::ptr::const_ptr::::is_null) { + debug self => _37; + let mut _38: *const u8; + scope 49 { + scope 50 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _38; + let mut _40: usize; + scope 51 (inlined std::ptr::const_ptr::::addr) { + debug self => _38; + let mut _39: *const (); + scope 52 { + scope 53 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _38; + } + } + } + } + } + } + } + } + } + } + } + } bb0: { - _0 = as DoubleEndedIterator>::next_back(move _1) -> [return: bb1, unwind continue]; + StorageLive(_24); + StorageLive(_5); + StorageLive(_43); + StorageLive(_32); + StorageLive(_21); + StorageLive(_2); + _2 = const _; + switchInt(move _2) -> [0: bb1, otherwise: bb2]; } bb1: { + StorageLive(_4); + StorageLive(_3); + _3 = &raw const ((*_1).1: *mut T); + _4 = _3 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_3); + _5 = (*_4); + StorageDead(_4); + StorageLive(_13); + StorageLive(_6); + _6 = ((*_1).0: std::ptr::NonNull); + StorageLive(_7); + StorageLive(_12); + StorageLive(_11); + _7 = (_6.0: *const T); + StorageLive(_8); + _8 = _7 as *const u8 (PtrToPtr); + StorageLive(_10); + StorageLive(_9); + _9 = _7 as *const () (PtrToPtr); + _10 = move _9 as usize (Transmute); + StorageDead(_9); + _11 = Eq(move _10, const 0_usize); + StorageDead(_10); + StorageDead(_8); + _12 = Not(move _11); + StorageDead(_11); + assume(move _12); + StorageDead(_12); + _13 = _7 as *mut T (PtrToPtr); + StorageDead(_7); + StorageDead(_6); + StorageLive(_20); + StorageLive(_14); + StorageLive(_19); + StorageLive(_18); + _14 = (_5.0: *const T); + StorageLive(_15); + _15 = _14 as *const u8 (PtrToPtr); + StorageLive(_17); + StorageLive(_16); + _16 = _14 as *const () (PtrToPtr); + _17 = move _16 as usize (Transmute); + StorageDead(_16); + _18 = Eq(move _17, const 0_usize); + StorageDead(_17); + StorageDead(_15); + _19 = Not(move _18); + StorageDead(_18); + assume(move _19); + StorageDead(_19); + _20 = _14 as *mut T (PtrToPtr); + StorageDead(_14); + _21 = Eq(move _13, move _20); + StorageDead(_20); + StorageDead(_13); + goto -> bb3; + } + + bb2: { + StorageLive(_22); + _22 = ((*_1).1: *mut T); + StorageLive(_23); + _23 = _22 as *mut () (PtrToPtr); + _24 = move _23 as usize (Transmute); + StorageDead(_23); + StorageDead(_22); + _21 = Eq(_24, const 0_usize); + goto -> bb3; + } + + bb3: { + StorageDead(_2); + switchInt(move _21) -> [0: bb4, otherwise: bb10]; + } + + bb4: { + StorageLive(_44); + StorageLive(_34); + StorageLive(_27); + StorageLive(_28); + StorageLive(_25); + _25 = const _; + switchInt(move _25) -> [0: bb5, otherwise: bb8]; + } + + bb5: { + StorageLive(_26); + _26 = &raw mut ((*_1).1: *mut T); + _27 = _26 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_26); + _28 = (*_27); + StorageLive(_29); + _29 = const _; + switchInt(move _29) -> [0: bb6, otherwise: bb7]; + } + + bb6: { + StorageLive(_31); + StorageLive(_30); + _30 = (_28.0: *const T); + _31 = Offset(move _30, const -1_isize); + StorageDead(_30); + _28 = NonNull:: { pointer: move _31 }; + StorageDead(_31); + goto -> bb7; + } + + bb7: { + StorageDead(_29); + (*_27) = move _28; + _32 = (*_27); + goto -> bb9; + } + + bb8: { + StorageLive(_33); + _33 = &raw mut ((*_1).1: *mut T); + _34 = _33 as *mut usize (PtrToPtr); + StorageDead(_33); + StorageLive(_36); + StorageLive(_35); + _35 = (*_34); + _36 = SubUnchecked(_35, const 1_usize); + StorageDead(_35); + (*_34) = move _36; + StorageDead(_36); + _32 = ((*_1).0: std::ptr::NonNull); + goto -> bb9; + } + + bb9: { + StorageDead(_25); + StorageDead(_28); + StorageDead(_27); + StorageDead(_34); + StorageLive(_37); + StorageLive(_42); + StorageLive(_41); + _37 = (_32.0: *const T); + StorageLive(_38); + _38 = _37 as *const u8 (PtrToPtr); + StorageLive(_40); + StorageLive(_39); + _39 = _37 as *const () (PtrToPtr); + _40 = move _39 as usize (Transmute); + StorageDead(_39); + _41 = Eq(move _40, const 0_usize); + StorageDead(_40); + StorageDead(_38); + _42 = Not(move _41); + StorageDead(_41); + assume(move _42); + StorageDead(_42); + _43 = _37 as *mut T (PtrToPtr); + StorageDead(_37); + _44 = &mut (*_43); + _0 = Option::<&mut T>::Some(move _44); + StorageDead(_44); + goto -> bb11; + } + + bb10: { + _0 = const {transmute(0x0000000000000000): Option<&mut T>}; + goto -> bb11; + } + + bb11: { + StorageDead(_21); + StorageDead(_32); + StorageDead(_43); + StorageDead(_5); + StorageDead(_24); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir index 8edac638ccdd6..9b348fe65bada 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir @@ -3,12 +3,364 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { debug it => _1; let mut _0: std::option::Option<&T>; + scope 1 (inlined as Iterator>::next) { + debug self => _1; + let mut _2: bool; + let mut _3: *const *const T; + let mut _4: *const std::ptr::NonNull; + let mut _21: bool; + let mut _22: *const T; + let _25: std::ptr::NonNull; + let mut _44: &T; + scope 2 { + scope 3 { + let _5: std::ptr::NonNull; + let _24: usize; + scope 4 { + debug len => _24; + } + scope 5 { + debug end => _5; + scope 11 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => ((*_1).0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _5; + let mut _6: std::ptr::NonNull; + let mut _13: *mut T; + let mut _20: *mut T; + scope 12 (inlined NonNull::::as_ptr) { + debug self => _6; + let mut _7: *const T; + let mut _11: bool; + let mut _12: bool; + scope 13 { + scope 14 (inlined std::ptr::const_ptr::::is_null) { + debug self => _7; + let mut _8: *const u8; + scope 15 { + scope 16 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _8; + let mut _10: usize; + scope 17 (inlined std::ptr::const_ptr::::addr) { + debug self => _8; + let mut _9: *const (); + scope 18 { + scope 19 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _8; + } + } + } + } + } + } + } + } + scope 20 (inlined NonNull::::as_ptr) { + debug self => _5; + let mut _14: *const T; + let mut _18: bool; + let mut _19: bool; + scope 21 { + scope 22 (inlined std::ptr::const_ptr::::is_null) { + debug self => _14; + let mut _15: *const u8; + scope 23 { + scope 24 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _15; + let mut _17: usize; + scope 25 (inlined std::ptr::const_ptr::::addr) { + debug self => _15; + let mut _16: *const (); + scope 26 { + scope 27 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _15; + } + } + } + } + } + } + } + } + } + } + scope 6 { + scope 10 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _3; + } + } + scope 7 (inlined std::ptr::const_ptr::::addr) { + debug self => _22; + let mut _23: *const (); + scope 8 { + scope 9 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _22; + } + } + } + } + scope 28 (inlined std::slice::Iter::<'_, T>::post_inc_start) { + debug self => _1; + debug offset => const 1_usize; + let mut _26: bool; + let mut _27: *mut *const T; + let mut _28: *mut std::ptr::NonNull; + let mut _29: std::ptr::NonNull; + let mut _32: std::ptr::NonNull; + let mut _33: *mut *const T; + let mut _34: *mut usize; + let mut _35: usize; + let mut _36: usize; + scope 29 { + debug old => _25; + scope 30 { + scope 31 { + scope 32 { + debug len => _34; + scope 37 (inlined core::num::::unchecked_sub) { + debug self => _35; + debug rhs => const 1_usize; + scope 38 { + } + } + } + scope 33 { + scope 36 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _33; + } + } + scope 34 { + debug _end => _28; + scope 40 (inlined NonNull::::add) { + debug self => _29; + debug count => const 1_usize; + let mut _30: *const T; + let mut _31: *const T; + scope 41 { + } + } + } + scope 35 { + scope 39 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _27; + } + } + } + } + } + } + scope 42 (inlined NonNull::::as_ref::<'_>) { + debug (*(self: &NonNull)) => _25; + let mut _43: *mut T; + scope 43 { + scope 44 (inlined NonNull::::as_ptr) { + debug self => _25; + let mut _37: *const T; + let mut _41: bool; + let mut _42: bool; + scope 45 { + scope 46 (inlined std::ptr::const_ptr::::is_null) { + debug self => _37; + let mut _38: *const u8; + scope 47 { + scope 48 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _38; + let mut _40: usize; + scope 49 (inlined std::ptr::const_ptr::::addr) { + debug self => _38; + let mut _39: *const (); + scope 50 { + scope 51 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _38; + } + } + } + } + } + } + } + } + scope 52 (inlined std::ptr::mut_ptr::::cast_const) { + debug self => _43; + } + } + } + } + } bb0: { - _0 = as Iterator>::next(move _1) -> [return: bb1, unwind unreachable]; + StorageLive(_24); + StorageLive(_5); + StorageLive(_25); + StorageLive(_37); + StorageLive(_21); + StorageLive(_2); + _2 = const _; + switchInt(move _2) -> [0: bb1, otherwise: bb2]; } bb1: { + StorageLive(_4); + StorageLive(_3); + _3 = &raw const ((*_1).1: *const T); + _4 = _3 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_3); + _5 = (*_4); + StorageDead(_4); + StorageLive(_13); + StorageLive(_6); + _6 = ((*_1).0: std::ptr::NonNull); + StorageLive(_7); + StorageLive(_12); + StorageLive(_11); + _7 = (_6.0: *const T); + StorageLive(_8); + _8 = _7 as *const u8 (PtrToPtr); + StorageLive(_10); + StorageLive(_9); + _9 = _7 as *const () (PtrToPtr); + _10 = move _9 as usize (Transmute); + StorageDead(_9); + _11 = Eq(move _10, const 0_usize); + StorageDead(_10); + StorageDead(_8); + _12 = Not(move _11); + StorageDead(_11); + assume(move _12); + StorageDead(_12); + _13 = _7 as *mut T (PtrToPtr); + StorageDead(_7); + StorageDead(_6); + StorageLive(_20); + StorageLive(_14); + StorageLive(_19); + StorageLive(_18); + _14 = (_5.0: *const T); + StorageLive(_15); + _15 = _14 as *const u8 (PtrToPtr); + StorageLive(_17); + StorageLive(_16); + _16 = _14 as *const () (PtrToPtr); + _17 = move _16 as usize (Transmute); + StorageDead(_16); + _18 = Eq(move _17, const 0_usize); + StorageDead(_17); + StorageDead(_15); + _19 = Not(move _18); + StorageDead(_18); + assume(move _19); + StorageDead(_19); + _20 = _14 as *mut T (PtrToPtr); + StorageDead(_14); + _21 = Eq(move _13, move _20); + StorageDead(_20); + StorageDead(_13); + goto -> bb3; + } + + bb2: { + StorageLive(_22); + _22 = ((*_1).1: *const T); + StorageLive(_23); + _23 = _22 as *const () (PtrToPtr); + _24 = move _23 as usize (Transmute); + StorageDead(_23); + StorageDead(_22); + _21 = Eq(_24, const 0_usize); + goto -> bb3; + } + + bb3: { + StorageDead(_2); + switchInt(move _21) -> [0: bb4, otherwise: bb8]; + } + + bb4: { + StorageLive(_44); + StorageLive(_34); + StorageLive(_28); + _25 = ((*_1).0: std::ptr::NonNull); + StorageLive(_26); + _26 = const _; + switchInt(move _26) -> [0: bb5, otherwise: bb6]; + } + + bb5: { + StorageLive(_27); + _27 = &raw mut ((*_1).1: *const T); + _28 = _27 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_27); + StorageLive(_32); + StorageLive(_29); + _29 = ((*_1).0: std::ptr::NonNull); + StorageLive(_31); + StorageLive(_30); + _30 = (_29.0: *const T); + _31 = Offset(move _30, const 1_usize); + StorageDead(_30); + _32 = NonNull:: { pointer: move _31 }; + StorageDead(_31); + StorageDead(_29); + ((*_1).0: std::ptr::NonNull) = move _32; + StorageDead(_32); + goto -> bb7; + } + + bb6: { + StorageLive(_33); + _33 = &raw mut ((*_1).1: *const T); + _34 = _33 as *mut usize (PtrToPtr); + StorageDead(_33); + StorageLive(_36); + StorageLive(_35); + _35 = (*_34); + _36 = SubUnchecked(_35, const 1_usize); + StorageDead(_35); + (*_34) = move _36; + StorageDead(_36); + goto -> bb7; + } + + bb7: { + StorageDead(_26); + StorageDead(_28); + StorageDead(_34); + StorageLive(_43); + StorageLive(_42); + StorageLive(_41); + _37 = (_25.0: *const T); + StorageLive(_38); + _38 = _37 as *const u8 (PtrToPtr); + StorageLive(_40); + StorageLive(_39); + _39 = _37 as *const () (PtrToPtr); + _40 = move _39 as usize (Transmute); + StorageDead(_39); + _41 = Eq(move _40, const 0_usize); + StorageDead(_40); + StorageDead(_38); + _42 = Not(move _41); + StorageDead(_41); + assume(move _42); + StorageDead(_42); + _43 = _37 as *mut T (PtrToPtr); + StorageDead(_43); + _44 = &(*_37); + _0 = Option::<&T>::Some(move _44); + StorageDead(_44); + goto -> bb9; + } + + bb8: { + _0 = const {transmute(0x0000000000000000): Option<&T>}; + goto -> bb9; + } + + bb9: { + StorageDead(_21); + StorageDead(_37); + StorageDead(_25); + StorageDead(_5); + StorageDead(_24); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir index fdde07173437b..9b348fe65bada 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir @@ -3,12 +3,364 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { debug it => _1; let mut _0: std::option::Option<&T>; + scope 1 (inlined as Iterator>::next) { + debug self => _1; + let mut _2: bool; + let mut _3: *const *const T; + let mut _4: *const std::ptr::NonNull; + let mut _21: bool; + let mut _22: *const T; + let _25: std::ptr::NonNull; + let mut _44: &T; + scope 2 { + scope 3 { + let _5: std::ptr::NonNull; + let _24: usize; + scope 4 { + debug len => _24; + } + scope 5 { + debug end => _5; + scope 11 (inlined as PartialEq>::eq) { + debug (*(self: &NonNull)) => ((*_1).0: std::ptr::NonNull); + debug (*(other: &NonNull)) => _5; + let mut _6: std::ptr::NonNull; + let mut _13: *mut T; + let mut _20: *mut T; + scope 12 (inlined NonNull::::as_ptr) { + debug self => _6; + let mut _7: *const T; + let mut _11: bool; + let mut _12: bool; + scope 13 { + scope 14 (inlined std::ptr::const_ptr::::is_null) { + debug self => _7; + let mut _8: *const u8; + scope 15 { + scope 16 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _8; + let mut _10: usize; + scope 17 (inlined std::ptr::const_ptr::::addr) { + debug self => _8; + let mut _9: *const (); + scope 18 { + scope 19 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _8; + } + } + } + } + } + } + } + } + scope 20 (inlined NonNull::::as_ptr) { + debug self => _5; + let mut _14: *const T; + let mut _18: bool; + let mut _19: bool; + scope 21 { + scope 22 (inlined std::ptr::const_ptr::::is_null) { + debug self => _14; + let mut _15: *const u8; + scope 23 { + scope 24 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _15; + let mut _17: usize; + scope 25 (inlined std::ptr::const_ptr::::addr) { + debug self => _15; + let mut _16: *const (); + scope 26 { + scope 27 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _15; + } + } + } + } + } + } + } + } + } + } + scope 6 { + scope 10 (inlined std::ptr::const_ptr::::cast::>) { + debug self => _3; + } + } + scope 7 (inlined std::ptr::const_ptr::::addr) { + debug self => _22; + let mut _23: *const (); + scope 8 { + scope 9 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _22; + } + } + } + } + scope 28 (inlined std::slice::Iter::<'_, T>::post_inc_start) { + debug self => _1; + debug offset => const 1_usize; + let mut _26: bool; + let mut _27: *mut *const T; + let mut _28: *mut std::ptr::NonNull; + let mut _29: std::ptr::NonNull; + let mut _32: std::ptr::NonNull; + let mut _33: *mut *const T; + let mut _34: *mut usize; + let mut _35: usize; + let mut _36: usize; + scope 29 { + debug old => _25; + scope 30 { + scope 31 { + scope 32 { + debug len => _34; + scope 37 (inlined core::num::::unchecked_sub) { + debug self => _35; + debug rhs => const 1_usize; + scope 38 { + } + } + } + scope 33 { + scope 36 (inlined std::ptr::mut_ptr::::cast::) { + debug self => _33; + } + } + scope 34 { + debug _end => _28; + scope 40 (inlined NonNull::::add) { + debug self => _29; + debug count => const 1_usize; + let mut _30: *const T; + let mut _31: *const T; + scope 41 { + } + } + } + scope 35 { + scope 39 (inlined std::ptr::mut_ptr::::cast::>) { + debug self => _27; + } + } + } + } + } + } + scope 42 (inlined NonNull::::as_ref::<'_>) { + debug (*(self: &NonNull)) => _25; + let mut _43: *mut T; + scope 43 { + scope 44 (inlined NonNull::::as_ptr) { + debug self => _25; + let mut _37: *const T; + let mut _41: bool; + let mut _42: bool; + scope 45 { + scope 46 (inlined std::ptr::const_ptr::::is_null) { + debug self => _37; + let mut _38: *const u8; + scope 47 { + scope 48 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { + debug ptr => _38; + let mut _40: usize; + scope 49 (inlined std::ptr::const_ptr::::addr) { + debug self => _38; + let mut _39: *const (); + scope 50 { + scope 51 (inlined std::ptr::const_ptr::::cast::<()>) { + debug self => _38; + } + } + } + } + } + } + } + } + scope 52 (inlined std::ptr::mut_ptr::::cast_const) { + debug self => _43; + } + } + } + } + } bb0: { - _0 = as Iterator>::next(move _1) -> [return: bb1, unwind continue]; + StorageLive(_24); + StorageLive(_5); + StorageLive(_25); + StorageLive(_37); + StorageLive(_21); + StorageLive(_2); + _2 = const _; + switchInt(move _2) -> [0: bb1, otherwise: bb2]; } bb1: { + StorageLive(_4); + StorageLive(_3); + _3 = &raw const ((*_1).1: *const T); + _4 = _3 as *const std::ptr::NonNull (PtrToPtr); + StorageDead(_3); + _5 = (*_4); + StorageDead(_4); + StorageLive(_13); + StorageLive(_6); + _6 = ((*_1).0: std::ptr::NonNull); + StorageLive(_7); + StorageLive(_12); + StorageLive(_11); + _7 = (_6.0: *const T); + StorageLive(_8); + _8 = _7 as *const u8 (PtrToPtr); + StorageLive(_10); + StorageLive(_9); + _9 = _7 as *const () (PtrToPtr); + _10 = move _9 as usize (Transmute); + StorageDead(_9); + _11 = Eq(move _10, const 0_usize); + StorageDead(_10); + StorageDead(_8); + _12 = Not(move _11); + StorageDead(_11); + assume(move _12); + StorageDead(_12); + _13 = _7 as *mut T (PtrToPtr); + StorageDead(_7); + StorageDead(_6); + StorageLive(_20); + StorageLive(_14); + StorageLive(_19); + StorageLive(_18); + _14 = (_5.0: *const T); + StorageLive(_15); + _15 = _14 as *const u8 (PtrToPtr); + StorageLive(_17); + StorageLive(_16); + _16 = _14 as *const () (PtrToPtr); + _17 = move _16 as usize (Transmute); + StorageDead(_16); + _18 = Eq(move _17, const 0_usize); + StorageDead(_17); + StorageDead(_15); + _19 = Not(move _18); + StorageDead(_18); + assume(move _19); + StorageDead(_19); + _20 = _14 as *mut T (PtrToPtr); + StorageDead(_14); + _21 = Eq(move _13, move _20); + StorageDead(_20); + StorageDead(_13); + goto -> bb3; + } + + bb2: { + StorageLive(_22); + _22 = ((*_1).1: *const T); + StorageLive(_23); + _23 = _22 as *const () (PtrToPtr); + _24 = move _23 as usize (Transmute); + StorageDead(_23); + StorageDead(_22); + _21 = Eq(_24, const 0_usize); + goto -> bb3; + } + + bb3: { + StorageDead(_2); + switchInt(move _21) -> [0: bb4, otherwise: bb8]; + } + + bb4: { + StorageLive(_44); + StorageLive(_34); + StorageLive(_28); + _25 = ((*_1).0: std::ptr::NonNull); + StorageLive(_26); + _26 = const _; + switchInt(move _26) -> [0: bb5, otherwise: bb6]; + } + + bb5: { + StorageLive(_27); + _27 = &raw mut ((*_1).1: *const T); + _28 = _27 as *mut std::ptr::NonNull (PtrToPtr); + StorageDead(_27); + StorageLive(_32); + StorageLive(_29); + _29 = ((*_1).0: std::ptr::NonNull); + StorageLive(_31); + StorageLive(_30); + _30 = (_29.0: *const T); + _31 = Offset(move _30, const 1_usize); + StorageDead(_30); + _32 = NonNull:: { pointer: move _31 }; + StorageDead(_31); + StorageDead(_29); + ((*_1).0: std::ptr::NonNull) = move _32; + StorageDead(_32); + goto -> bb7; + } + + bb6: { + StorageLive(_33); + _33 = &raw mut ((*_1).1: *const T); + _34 = _33 as *mut usize (PtrToPtr); + StorageDead(_33); + StorageLive(_36); + StorageLive(_35); + _35 = (*_34); + _36 = SubUnchecked(_35, const 1_usize); + StorageDead(_35); + (*_34) = move _36; + StorageDead(_36); + goto -> bb7; + } + + bb7: { + StorageDead(_26); + StorageDead(_28); + StorageDead(_34); + StorageLive(_43); + StorageLive(_42); + StorageLive(_41); + _37 = (_25.0: *const T); + StorageLive(_38); + _38 = _37 as *const u8 (PtrToPtr); + StorageLive(_40); + StorageLive(_39); + _39 = _37 as *const () (PtrToPtr); + _40 = move _39 as usize (Transmute); + StorageDead(_39); + _41 = Eq(move _40, const 0_usize); + StorageDead(_40); + StorageDead(_38); + _42 = Not(move _41); + StorageDead(_41); + assume(move _42); + StorageDead(_42); + _43 = _37 as *mut T (PtrToPtr); + StorageDead(_43); + _44 = &(*_37); + _0 = Option::<&T>::Some(move _44); + StorageDead(_44); + goto -> bb9; + } + + bb8: { + _0 = const {transmute(0x0000000000000000): Option<&T>}; + goto -> bb9; + } + + bb9: { + StorageDead(_21); + StorageDead(_37); + StorageDead(_25); + StorageDead(_5); + StorageDead(_24); return; } } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir index 485dc9179cef0..2259b8f6262b5 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir @@ -3,16 +3,12 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14 - debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15 + debug (*(x: &u8)) => _1; // in scope 1 at $DIR/spans.rs:14:14: 14:15 } bb0: { - StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 - _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 - StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir index 485dc9179cef0..2259b8f6262b5 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir @@ -3,16 +3,12 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14 - debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15 + debug (*(x: &u8)) => _1; // in scope 1 at $DIR/spans.rs:14:14: 14:15 } bb0: { - StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 - _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 - StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir index c1d4d4871d02c..16d6d9719b641 100644 --- a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir @@ -6,65 +6,51 @@ fn new(_1: Result) -> Result { let mut _2: isize; let _3: T; let mut _4: std::ops::ControlFlow; - let _5: E; - let mut _6: isize; - let _7: T; - let _8: E; + let _5: T; + let _6: E; + let _7: E; scope 1 { debug v => _3; } scope 2 { - debug e => _5; + debug e => _6; } scope 3 { - debug v => _7; + debug v => _5; } scope 4 { - debug e => _8; + debug e => _7; } bb0: { StorageLive(_4); _2 = discriminant(_1); - switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb7]; + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; } bb1: { _3 = move ((_1 as Ok).0: T); _4 = ControlFlow::::Continue(_3); + _5 = move ((_4 as Continue).0: T); + _0 = Result::::Ok(_5); + StorageDead(_4); goto -> bb3; } bb2: { - _5 = move ((_1 as Err).0: E); - _4 = ControlFlow::::Break(_5); + _6 = move ((_1 as Err).0: E); + _4 = ControlFlow::::Break(_6); + _7 = move ((_4 as Break).0: E); + _0 = Result::::Err(_7); + StorageDead(_4); goto -> bb3; } bb3: { - _6 = discriminant(_4); - switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb7]; - } - - bb4: { - _7 = move ((_4 as Continue).0: T); - _0 = Result::::Ok(_7); - StorageDead(_4); - goto -> bb6; - } - - bb5: { - _8 = move ((_4 as Break).0: E); - _0 = Result::::Err(_8); - StorageDead(_4); - goto -> bb6; - } - - bb6: { return; } - bb7: { + bb4: { unreachable; } } diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff index 1648f5dd8ca63..fed9854b6143c 100644 --- a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff @@ -22,23 +22,27 @@ let _24: &mut u8; let mut _25: debuginfo::T; scope 1 { - debug ref_mut_u8 => _1; +- debug ref_mut_u8 => _1; ++ debug (*(ref_mut_u8: &mut u8)) => _2; let _3: &u8; let mut _28: &debuginfo::T; scope 2 { - debug field => _3; +- debug field => _3; ++ debug (*(field: &u8)) => ((*_28).0: u8); let _5: &u8; scope 3 { - debug reborrow => _5; -+ debug reborrow => _1; ++ debug (*(reborrow: &mut u8)) => _2; let _9: &i32; let _22: &&&mut u8; let mut _27: &std::option::Option; scope 4 { - debug variant_field => _9; +- debug variant_field => _9; ++ debug (*(variant_field: &i32)) => (((*_27) as Some).0: i32); } scope 5 { - debug constant_index => _19; +- debug constant_index => _19; ++ debug (*(constant_index: &i32)) => (*_12)[1 of 3]; debug subslice => _20; debug constant_index_from_end => _21; let _19: &i32; @@ -47,20 +51,21 @@ let mut _26: &[i32; 10]; } scope 6 { - debug multiple_borrow => _22; +- debug multiple_borrow => _22; ++ debug (*(*(*(multiple_borrow: &&&mut u8)))) => (_25.0: u8); } } } } bb0: { - StorageLive(_1); +- StorageLive(_1); StorageLive(_2); _2 = const 5_u8; - _1 = &mut _2; - StorageLive(_3); +- _1 = &mut _2; +- StorageLive(_3); _28 = const _; - _3 = &((*_28).0: u8); +- _3 = &((*_28).0: u8); - StorageLive(_5); - _5 = &(*_1); - StorageLive(_6); @@ -71,11 +76,11 @@ } bb1: { - StorageLive(_9); +- StorageLive(_9); _27 = const _; - _9 = &(((*_27) as Some).0: i32); +- _9 = &(((*_27) as Some).0: i32); - _6 = const (); - StorageDead(_9); +- StorageDead(_9); goto -> bb4; } @@ -114,9 +119,8 @@ } bb6: { - StorageLive(_19); +- StorageLive(_19); - _19 = &(*_11)[1 of 3]; -+ _19 = &(*_12)[1 of 3]; StorageLive(_20); - _20 = &(*_11)[2:-1]; + _20 = &(*_12)[2:-1]; @@ -126,7 +130,7 @@ + _21 = &(*_12)[-1 of 3]; StorageDead(_21); StorageDead(_20); - StorageDead(_19); +- StorageDead(_19); goto -> bb8; } @@ -139,23 +143,23 @@ - StorageDead(_12); - StorageDead(_11); - StorageDead(_10); - StorageLive(_22); - StorageLive(_23); - StorageLive(_24); +- StorageLive(_22); +- StorageLive(_23); +- StorageLive(_24); StorageLive(_25); _25 = T(const 6_u8); - _24 = &mut (_25.0: u8); - _23 = &_24; - _22 = &_23; +- _24 = &mut (_25.0: u8); +- _23 = &_24; +- _22 = &_23; _0 = const (); StorageDead(_25); - StorageDead(_24); - StorageDead(_23); - StorageDead(_22); +- StorageDead(_24); +- StorageDead(_23); +- StorageDead(_22); - StorageDead(_5); - StorageDead(_3); +- StorageDead(_3); StorageDead(_2); - StorageDead(_1); +- StorageDead(_1); return; } } diff --git a/tests/mir-opt/reference_prop.many_debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.many_debuginfo.ReferencePropagation.diff new file mode 100644 index 0000000000000..6b2e3c6b267c4 --- /dev/null +++ b/tests/mir-opt/reference_prop.many_debuginfo.ReferencePropagation.diff @@ -0,0 +1,1223 @@ +- // MIR for `many_debuginfo` before ReferencePropagation ++ // MIR for `many_debuginfo` after ReferencePropagation + + fn many_debuginfo() -> () { + let mut _0: (); + let _1: i32; + let _3: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&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&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _220: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _221: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _222: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _223: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _224: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _225: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _226: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _227: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _228: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _229: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _230: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _231: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _232: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _233: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _234: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _235: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _236: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _237: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _238: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _239: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _240: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _241: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _242: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _243: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _244: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _245: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _246: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _247: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _248: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _249: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _250: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _251: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _252: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _253: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _254: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _255: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _256: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _257: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _258: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _259: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _260: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _261: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _262: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _263: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _264: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _265: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _266: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _267: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _268: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _269: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _270: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _271: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _272: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _273: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _274: &&&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _275: &&&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _276: &&&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _277: &&&&&&&&&&&&&&&&&&&&&&&&&i32; + let _278: &&&&&&&&&&&&&&&&&&&&&&&&i32; + let _279: &&&&&&&&&&&&&&&&&&&&&&&i32; + let _280: &&&&&&&&&&&&&&&&&&&&&&i32; + let _281: &&&&&&&&&&&&&&&&&&&&&i32; + let _282: &&&&&&&&&&&&&&&&&&&&i32; + let _283: &&&&&&&&&&&&&&&&&&&i32; + let _284: &&&&&&&&&&&&&&&&&&i32; + let _285: &&&&&&&&&&&&&&&&&i32; + let _286: &&&&&&&&&&&&&&&&i32; + let _287: &&&&&&&&&&&&&&&i32; + let _288: &&&&&&&&&&&&&&i32; + let _289: &&&&&&&&&&&&&i32; + let _290: &&&&&&&&&&&&i32; + let _291: &&&&&&&&&&&i32; + let _292: &&&&&&&&&&i32; + let _293: &&&&&&&&&i32; + let _294: &&&&&&&&i32; + let _295: &&&&&&&i32; + let _296: &&&&&&i32; + let _297: &&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&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) => _1; + } + } + + bb0: { + StorageLive(_1); + _1 = const 0_i32; +- StorageLive(_2); +- StorageLive(_3); +- StorageLive(_4); +- StorageLive(_5); +- StorageLive(_6); +- StorageLive(_7); +- StorageLive(_8); +- StorageLive(_9); +- StorageLive(_10); +- StorageLive(_11); +- StorageLive(_12); +- StorageLive(_13); +- StorageLive(_14); +- StorageLive(_15); +- StorageLive(_16); +- StorageLive(_17); +- StorageLive(_18); +- StorageLive(_19); +- StorageLive(_20); +- StorageLive(_21); +- StorageLive(_22); +- StorageLive(_23); +- StorageLive(_24); +- StorageLive(_25); +- StorageLive(_26); +- StorageLive(_27); +- StorageLive(_28); +- StorageLive(_29); +- StorageLive(_30); +- StorageLive(_31); +- StorageLive(_32); +- StorageLive(_33); +- StorageLive(_34); +- StorageLive(_35); +- StorageLive(_36); +- StorageLive(_37); +- StorageLive(_38); +- StorageLive(_39); +- StorageLive(_40); +- StorageLive(_41); +- StorageLive(_42); +- StorageLive(_43); +- StorageLive(_44); +- StorageLive(_45); +- StorageLive(_46); +- StorageLive(_47); +- StorageLive(_48); +- StorageLive(_49); +- StorageLive(_50); +- StorageLive(_51); +- StorageLive(_52); +- StorageLive(_53); +- StorageLive(_54); +- StorageLive(_55); +- StorageLive(_56); +- StorageLive(_57); +- StorageLive(_58); +- StorageLive(_59); +- StorageLive(_60); +- StorageLive(_61); +- StorageLive(_62); +- StorageLive(_63); +- StorageLive(_64); +- StorageLive(_65); +- StorageLive(_66); +- StorageLive(_67); +- StorageLive(_68); +- StorageLive(_69); +- StorageLive(_70); +- StorageLive(_71); +- StorageLive(_72); +- StorageLive(_73); +- StorageLive(_74); +- StorageLive(_75); +- StorageLive(_76); +- StorageLive(_77); +- StorageLive(_78); +- StorageLive(_79); +- StorageLive(_80); +- StorageLive(_81); +- StorageLive(_82); +- StorageLive(_83); +- StorageLive(_84); +- StorageLive(_85); +- StorageLive(_86); +- StorageLive(_87); +- StorageLive(_88); +- StorageLive(_89); +- StorageLive(_90); +- StorageLive(_91); +- StorageLive(_92); +- StorageLive(_93); +- StorageLive(_94); +- StorageLive(_95); +- StorageLive(_96); +- StorageLive(_97); +- StorageLive(_98); +- StorageLive(_99); +- StorageLive(_100); +- StorageLive(_101); +- StorageLive(_102); +- StorageLive(_103); +- StorageLive(_104); +- StorageLive(_105); +- StorageLive(_106); +- StorageLive(_107); +- StorageLive(_108); +- StorageLive(_109); +- StorageLive(_110); +- StorageLive(_111); +- StorageLive(_112); +- StorageLive(_113); +- StorageLive(_114); +- StorageLive(_115); +- StorageLive(_116); +- StorageLive(_117); +- StorageLive(_118); +- StorageLive(_119); +- StorageLive(_120); +- StorageLive(_121); +- StorageLive(_122); +- StorageLive(_123); +- StorageLive(_124); +- StorageLive(_125); +- StorageLive(_126); +- StorageLive(_127); +- StorageLive(_128); +- StorageLive(_129); +- StorageLive(_130); +- StorageLive(_131); +- StorageLive(_132); +- StorageLive(_133); +- StorageLive(_134); +- StorageLive(_135); +- StorageLive(_136); +- StorageLive(_137); +- StorageLive(_138); +- StorageLive(_139); +- StorageLive(_140); +- StorageLive(_141); +- StorageLive(_142); +- StorageLive(_143); +- StorageLive(_144); +- StorageLive(_145); +- StorageLive(_146); +- StorageLive(_147); +- StorageLive(_148); +- StorageLive(_149); +- StorageLive(_150); +- StorageLive(_151); +- StorageLive(_152); +- StorageLive(_153); +- StorageLive(_154); +- StorageLive(_155); +- StorageLive(_156); +- StorageLive(_157); +- StorageLive(_158); +- StorageLive(_159); +- StorageLive(_160); +- StorageLive(_161); +- StorageLive(_162); +- StorageLive(_163); +- StorageLive(_164); +- StorageLive(_165); +- StorageLive(_166); +- StorageLive(_167); +- StorageLive(_168); +- StorageLive(_169); +- StorageLive(_170); +- StorageLive(_171); +- StorageLive(_172); +- StorageLive(_173); +- StorageLive(_174); +- StorageLive(_175); +- StorageLive(_176); +- StorageLive(_177); +- StorageLive(_178); +- StorageLive(_179); +- StorageLive(_180); +- StorageLive(_181); +- StorageLive(_182); +- StorageLive(_183); +- StorageLive(_184); +- StorageLive(_185); +- StorageLive(_186); +- StorageLive(_187); +- StorageLive(_188); +- StorageLive(_189); +- StorageLive(_190); +- StorageLive(_191); +- StorageLive(_192); +- StorageLive(_193); +- StorageLive(_194); +- StorageLive(_195); +- StorageLive(_196); +- StorageLive(_197); +- StorageLive(_198); +- StorageLive(_199); +- StorageLive(_200); +- StorageLive(_201); +- StorageLive(_202); +- StorageLive(_203); +- StorageLive(_204); +- StorageLive(_205); +- StorageLive(_206); +- StorageLive(_207); +- StorageLive(_208); +- StorageLive(_209); +- StorageLive(_210); +- StorageLive(_211); +- StorageLive(_212); +- StorageLive(_213); +- StorageLive(_214); +- StorageLive(_215); +- StorageLive(_216); +- StorageLive(_217); +- StorageLive(_218); +- StorageLive(_219); +- StorageLive(_220); +- StorageLive(_221); +- StorageLive(_222); +- StorageLive(_223); +- StorageLive(_224); +- StorageLive(_225); +- StorageLive(_226); +- StorageLive(_227); +- StorageLive(_228); +- StorageLive(_229); +- StorageLive(_230); +- StorageLive(_231); +- StorageLive(_232); +- StorageLive(_233); +- StorageLive(_234); +- StorageLive(_235); +- StorageLive(_236); +- StorageLive(_237); +- StorageLive(_238); +- StorageLive(_239); +- StorageLive(_240); +- StorageLive(_241); +- StorageLive(_242); +- StorageLive(_243); +- StorageLive(_244); +- StorageLive(_245); +- StorageLive(_246); +- StorageLive(_247); +- StorageLive(_248); +- StorageLive(_249); +- StorageLive(_250); +- StorageLive(_251); +- StorageLive(_252); +- StorageLive(_253); +- StorageLive(_254); +- StorageLive(_255); +- StorageLive(_256); +- StorageLive(_257); +- StorageLive(_258); +- StorageLive(_259); +- StorageLive(_260); +- StorageLive(_261); +- StorageLive(_262); +- StorageLive(_263); +- StorageLive(_264); +- StorageLive(_265); +- StorageLive(_266); +- StorageLive(_267); +- StorageLive(_268); +- StorageLive(_269); +- StorageLive(_270); +- StorageLive(_271); +- StorageLive(_272); +- StorageLive(_273); +- StorageLive(_274); +- StorageLive(_275); +- StorageLive(_276); +- StorageLive(_277); +- StorageLive(_278); +- StorageLive(_279); +- StorageLive(_280); +- StorageLive(_281); +- StorageLive(_282); +- StorageLive(_283); +- StorageLive(_284); +- StorageLive(_285); +- StorageLive(_286); +- StorageLive(_287); +- StorageLive(_288); +- StorageLive(_289); +- StorageLive(_290); +- StorageLive(_291); +- StorageLive(_292); +- StorageLive(_293); +- StorageLive(_294); +- StorageLive(_295); +- StorageLive(_296); +- StorageLive(_297); +- StorageLive(_298); +- StorageLive(_299); +- StorageLive(_300); +- StorageLive(_301); +- _301 = &_1; +- _300 = &_301; +- _299 = &_300; +- _298 = &_299; +- _297 = &_298; +- _296 = &_297; +- _295 = &_296; +- _294 = &_295; +- _293 = &_294; +- _292 = &_293; +- _291 = &_292; +- _290 = &_291; +- _289 = &_290; +- _288 = &_289; +- _287 = &_288; +- _286 = &_287; +- _285 = &_286; +- _284 = &_285; +- _283 = &_284; +- _282 = &_283; +- _281 = &_282; +- _280 = &_281; +- _279 = &_280; +- _278 = &_279; +- _277 = &_278; +- _276 = &_277; +- _275 = &_276; +- _274 = &_275; +- _273 = &_274; +- _272 = &_273; +- _271 = &_272; +- _270 = &_271; +- _269 = &_270; +- _268 = &_269; +- _267 = &_268; +- _266 = &_267; +- _265 = &_266; +- _264 = &_265; +- _263 = &_264; +- _262 = &_263; +- _261 = &_262; +- _260 = &_261; +- _259 = &_260; +- _258 = &_259; +- _257 = &_258; +- _256 = &_257; +- _255 = &_256; +- _254 = &_255; +- _253 = &_254; +- _252 = &_253; +- _251 = &_252; +- _250 = &_251; +- _249 = &_250; +- _248 = &_249; +- _247 = &_248; +- _246 = &_247; +- _245 = &_246; +- _244 = &_245; +- _243 = &_244; +- _242 = &_243; +- _241 = &_242; +- _240 = &_241; +- _239 = &_240; +- _238 = &_239; +- _237 = &_238; +- _236 = &_237; +- _235 = &_236; +- _234 = &_235; +- _233 = &_234; +- _232 = &_233; +- _231 = &_232; +- _230 = &_231; +- _229 = &_230; +- _228 = &_229; +- _227 = &_228; +- _226 = &_227; +- _225 = &_226; +- _224 = &_225; +- _223 = &_224; +- _222 = &_223; +- _221 = &_222; +- _220 = &_221; +- _219 = &_220; +- _218 = &_219; +- _217 = &_218; +- _216 = &_217; +- _215 = &_216; +- _214 = &_215; +- _213 = &_214; +- _212 = &_213; +- _211 = &_212; +- _210 = &_211; +- _209 = &_210; +- _208 = &_209; +- _207 = &_208; +- _206 = &_207; +- _205 = &_206; +- _204 = &_205; +- _203 = &_204; +- _202 = &_203; +- _201 = &_202; +- _200 = &_201; +- _199 = &_200; +- _198 = &_199; +- _197 = &_198; +- _196 = &_197; +- _195 = &_196; +- _194 = &_195; +- _193 = &_194; +- _192 = &_193; +- _191 = &_192; +- _190 = &_191; +- _189 = &_190; +- _188 = &_189; +- _187 = &_188; +- _186 = &_187; +- _185 = &_186; +- _184 = &_185; +- _183 = &_184; +- _182 = &_183; +- _181 = &_182; +- _180 = &_181; +- _179 = &_180; +- _178 = &_179; +- _177 = &_178; +- _176 = &_177; +- _175 = &_176; +- _174 = &_175; +- _173 = &_174; +- _172 = &_173; +- _171 = &_172; +- _170 = &_171; +- _169 = &_170; +- _168 = &_169; +- _167 = &_168; +- _166 = &_167; +- _165 = &_166; +- _164 = &_165; +- _163 = &_164; +- _162 = &_163; +- _161 = &_162; +- _160 = &_161; +- _159 = &_160; +- _158 = &_159; +- _157 = &_158; +- _156 = &_157; +- _155 = &_156; +- _154 = &_155; +- _153 = &_154; +- _152 = &_153; +- _151 = &_152; +- _150 = &_151; +- _149 = &_150; +- _148 = &_149; +- _147 = &_148; +- _146 = &_147; +- _145 = &_146; +- _144 = &_145; +- _143 = &_144; +- _142 = &_143; +- _141 = &_142; +- _140 = &_141; +- _139 = &_140; +- _138 = &_139; +- _137 = &_138; +- _136 = &_137; +- _135 = &_136; +- _134 = &_135; +- _133 = &_134; +- _132 = &_133; +- _131 = &_132; +- _130 = &_131; +- _129 = &_130; +- _128 = &_129; +- _127 = &_128; +- _126 = &_127; +- _125 = &_126; +- _124 = &_125; +- _123 = &_124; +- _122 = &_123; +- _121 = &_122; +- _120 = &_121; +- _119 = &_120; +- _118 = &_119; +- _117 = &_118; +- _116 = &_117; +- _115 = &_116; +- _114 = &_115; +- _113 = &_114; +- _112 = &_113; +- _111 = &_112; +- _110 = &_111; +- _109 = &_110; +- _108 = &_109; +- _107 = &_108; +- _106 = &_107; +- _105 = &_106; +- _104 = &_105; +- _103 = &_104; +- _102 = &_103; +- _101 = &_102; +- _100 = &_101; +- _99 = &_100; +- _98 = &_99; +- _97 = &_98; +- _96 = &_97; +- _95 = &_96; +- _94 = &_95; +- _93 = &_94; +- _92 = &_93; +- _91 = &_92; +- _90 = &_91; +- _89 = &_90; +- _88 = &_89; +- _87 = &_88; +- _86 = &_87; +- _85 = &_86; +- _84 = &_85; +- _83 = &_84; +- _82 = &_83; +- _81 = &_82; +- _80 = &_81; +- _79 = &_80; +- _78 = &_79; +- _77 = &_78; +- _76 = &_77; +- _75 = &_76; +- _74 = &_75; +- _73 = &_74; +- _72 = &_73; +- _71 = &_72; +- _70 = &_71; +- _69 = &_70; +- _68 = &_69; +- _67 = &_68; +- _66 = &_67; +- _65 = &_66; +- _64 = &_65; +- _63 = &_64; +- _62 = &_63; +- _61 = &_62; +- _60 = &_61; +- _59 = &_60; +- _58 = &_59; +- _57 = &_58; +- _56 = &_57; +- _55 = &_56; +- _54 = &_55; +- _53 = &_54; +- _52 = &_53; +- _51 = &_52; +- _50 = &_51; +- _49 = &_50; +- _48 = &_49; +- _47 = &_48; +- _46 = &_47; +- _45 = &_46; +- _44 = &_45; +- _43 = &_44; +- _42 = &_43; +- _41 = &_42; +- _40 = &_41; +- _39 = &_40; +- _38 = &_39; +- _37 = &_38; +- _36 = &_37; +- _35 = &_36; +- _34 = &_35; +- _33 = &_34; +- _32 = &_33; +- _31 = &_32; +- _30 = &_31; +- _29 = &_30; +- _28 = &_29; +- _27 = &_28; +- _26 = &_27; +- _25 = &_26; +- _24 = &_25; +- _23 = &_24; +- _22 = &_23; +- _21 = &_22; +- _20 = &_21; +- _19 = &_20; +- _18 = &_19; +- _17 = &_18; +- _16 = &_17; +- _15 = &_16; +- _14 = &_15; +- _13 = &_14; +- _12 = &_13; +- _11 = &_12; +- _10 = &_11; +- _9 = &_10; +- _8 = &_9; +- _7 = &_8; +- _6 = &_7; +- _5 = &_6; +- _4 = &_5; +- _3 = &_4; +- _2 = &_3; + _0 = const (); +- StorageDead(_301); +- StorageDead(_300); +- StorageDead(_299); +- StorageDead(_298); +- StorageDead(_297); +- StorageDead(_296); +- StorageDead(_295); +- StorageDead(_294); +- StorageDead(_293); +- StorageDead(_292); +- StorageDead(_291); +- StorageDead(_290); +- StorageDead(_289); +- StorageDead(_288); +- StorageDead(_287); +- StorageDead(_286); +- StorageDead(_285); +- StorageDead(_284); +- StorageDead(_283); +- StorageDead(_282); +- StorageDead(_281); +- StorageDead(_280); +- StorageDead(_279); +- StorageDead(_278); +- StorageDead(_277); +- StorageDead(_276); +- StorageDead(_275); +- StorageDead(_274); +- StorageDead(_273); +- StorageDead(_272); +- StorageDead(_271); +- StorageDead(_270); +- StorageDead(_269); +- StorageDead(_268); +- StorageDead(_267); +- StorageDead(_266); +- StorageDead(_265); +- StorageDead(_264); +- StorageDead(_263); +- StorageDead(_262); +- StorageDead(_261); +- StorageDead(_260); +- StorageDead(_259); +- StorageDead(_258); +- StorageDead(_257); +- StorageDead(_256); +- StorageDead(_255); +- StorageDead(_254); +- StorageDead(_253); +- StorageDead(_252); +- StorageDead(_251); +- StorageDead(_250); +- StorageDead(_249); +- StorageDead(_248); +- StorageDead(_247); +- StorageDead(_246); +- StorageDead(_245); +- StorageDead(_244); +- StorageDead(_243); +- StorageDead(_242); +- StorageDead(_241); +- StorageDead(_240); +- StorageDead(_239); +- StorageDead(_238); +- StorageDead(_237); +- StorageDead(_236); +- StorageDead(_235); +- StorageDead(_234); +- StorageDead(_233); +- StorageDead(_232); +- StorageDead(_231); +- StorageDead(_230); +- StorageDead(_229); +- StorageDead(_228); +- StorageDead(_227); +- StorageDead(_226); +- StorageDead(_225); +- StorageDead(_224); +- StorageDead(_223); +- StorageDead(_222); +- StorageDead(_221); +- StorageDead(_220); +- StorageDead(_219); +- StorageDead(_218); +- StorageDead(_217); +- StorageDead(_216); +- StorageDead(_215); +- StorageDead(_214); +- StorageDead(_213); +- StorageDead(_212); +- StorageDead(_211); +- StorageDead(_210); +- StorageDead(_209); +- StorageDead(_208); +- StorageDead(_207); +- StorageDead(_206); +- StorageDead(_205); +- StorageDead(_204); +- StorageDead(_203); +- StorageDead(_202); +- StorageDead(_201); +- StorageDead(_200); +- StorageDead(_199); +- StorageDead(_198); +- StorageDead(_197); +- StorageDead(_196); +- StorageDead(_195); +- StorageDead(_194); +- StorageDead(_193); +- StorageDead(_192); +- StorageDead(_191); +- StorageDead(_190); +- StorageDead(_189); +- StorageDead(_188); +- StorageDead(_187); +- StorageDead(_186); +- StorageDead(_185); +- StorageDead(_184); +- StorageDead(_183); +- StorageDead(_182); +- StorageDead(_181); +- StorageDead(_180); +- StorageDead(_179); +- StorageDead(_178); +- StorageDead(_177); +- StorageDead(_176); +- StorageDead(_175); +- StorageDead(_174); +- StorageDead(_173); +- StorageDead(_172); +- StorageDead(_171); +- StorageDead(_170); +- StorageDead(_169); +- StorageDead(_168); +- StorageDead(_167); +- StorageDead(_166); +- StorageDead(_165); +- StorageDead(_164); +- StorageDead(_163); +- StorageDead(_162); +- StorageDead(_161); +- StorageDead(_160); +- StorageDead(_159); +- StorageDead(_158); +- StorageDead(_157); +- StorageDead(_156); +- StorageDead(_155); +- StorageDead(_154); +- StorageDead(_153); +- StorageDead(_152); +- StorageDead(_151); +- StorageDead(_150); +- StorageDead(_149); +- StorageDead(_148); +- StorageDead(_147); +- StorageDead(_146); +- StorageDead(_145); +- StorageDead(_144); +- StorageDead(_143); +- StorageDead(_142); +- StorageDead(_141); +- StorageDead(_140); +- StorageDead(_139); +- StorageDead(_138); +- StorageDead(_137); +- StorageDead(_136); +- StorageDead(_135); +- StorageDead(_134); +- StorageDead(_133); +- StorageDead(_132); +- StorageDead(_131); +- StorageDead(_130); +- StorageDead(_129); +- StorageDead(_128); +- StorageDead(_127); +- StorageDead(_126); +- StorageDead(_125); +- StorageDead(_124); +- StorageDead(_123); +- StorageDead(_122); +- StorageDead(_121); +- StorageDead(_120); +- StorageDead(_119); +- StorageDead(_118); +- StorageDead(_117); +- StorageDead(_116); +- StorageDead(_115); +- StorageDead(_114); +- StorageDead(_113); +- StorageDead(_112); +- StorageDead(_111); +- StorageDead(_110); +- StorageDead(_109); +- StorageDead(_108); +- StorageDead(_107); +- StorageDead(_106); +- StorageDead(_105); +- StorageDead(_104); +- StorageDead(_103); +- StorageDead(_102); +- StorageDead(_101); +- StorageDead(_100); +- StorageDead(_99); +- StorageDead(_98); +- StorageDead(_97); +- StorageDead(_96); +- StorageDead(_95); +- StorageDead(_94); +- StorageDead(_93); +- StorageDead(_92); +- StorageDead(_91); +- StorageDead(_90); +- StorageDead(_89); +- StorageDead(_88); +- StorageDead(_87); +- StorageDead(_86); +- StorageDead(_85); +- StorageDead(_84); +- StorageDead(_83); +- StorageDead(_82); +- StorageDead(_81); +- StorageDead(_80); +- StorageDead(_79); +- StorageDead(_78); +- StorageDead(_77); +- StorageDead(_76); +- StorageDead(_75); +- StorageDead(_74); +- StorageDead(_73); +- StorageDead(_72); +- StorageDead(_71); +- StorageDead(_70); +- StorageDead(_69); +- StorageDead(_68); +- StorageDead(_67); +- StorageDead(_66); +- StorageDead(_65); +- StorageDead(_64); +- StorageDead(_63); +- StorageDead(_62); +- StorageDead(_61); +- StorageDead(_60); +- StorageDead(_59); +- StorageDead(_58); +- StorageDead(_57); +- StorageDead(_56); +- StorageDead(_55); +- StorageDead(_54); +- StorageDead(_53); +- StorageDead(_52); +- StorageDead(_51); +- StorageDead(_50); +- StorageDead(_49); +- StorageDead(_48); +- StorageDead(_47); +- StorageDead(_46); +- StorageDead(_45); +- StorageDead(_44); +- StorageDead(_43); +- StorageDead(_42); +- StorageDead(_41); +- StorageDead(_40); +- StorageDead(_39); +- StorageDead(_38); +- StorageDead(_37); +- StorageDead(_36); +- StorageDead(_35); +- StorageDead(_34); +- StorageDead(_33); +- StorageDead(_32); +- StorageDead(_31); +- StorageDead(_30); +- StorageDead(_29); +- StorageDead(_28); +- StorageDead(_27); +- StorageDead(_26); +- StorageDead(_25); +- StorageDead(_24); +- StorageDead(_23); +- StorageDead(_22); +- StorageDead(_21); +- StorageDead(_20); +- StorageDead(_19); +- StorageDead(_18); +- StorageDead(_17); +- StorageDead(_16); +- StorageDead(_15); +- StorageDead(_14); +- StorageDead(_13); +- StorageDead(_12); +- StorageDead(_11); +- StorageDead(_10); +- StorageDead(_9); +- StorageDead(_8); +- StorageDead(_7); +- StorageDead(_6); +- StorageDead(_5); +- StorageDead(_4); +- StorageDead(_3); +- StorageDead(_2); + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff index 747028e128fc8..d9008736c3a39 100644 --- a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff @@ -13,15 +13,16 @@ debug x => _1; let _2: &mut i32; scope 2 { - debug xref => _2; +- debug xref => _2; ++ debug (*(xref: &mut i32)) => _1; let _3: *mut i32; scope 3 { - debug xraw => _3; -+ debug xraw => _2; ++ debug (*(xraw: &mut i32)) => _1; let _6: &i32; scope 4 { - debug xshr => _6; -+ debug xshr => _2; ++ debug (*(xshr: &mut i32)) => _1; let _7: i32; scope 5 { debug a => _7; @@ -37,7 +38,7 @@ StorageLive(_1); _1 = const 2_i32; - StorageLive(_2); - _2 = &mut _1; +- _2 = &mut _1; - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index 1be2ce8d0bbd4..425d73245dd2b 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -52,7 +52,8 @@ debug a => _4; let _5: &usize; scope 2 { - debug b => _5; +- debug b => _5; ++ debug (*(b: &usize)) => _4; let _6: usize; scope 3 { debug c => _6; @@ -157,10 +158,12 @@ debug a => _60; let _61: &usize; scope 30 { - debug b => _61; +- debug b => _61; ++ debug (*(b: &usize)) => _60; let _62: &&usize; scope 31 { - debug d => _62; +- debug d => _62; ++ debug (*(*(d: &&usize))) => _60; let _63: usize; scope 32 { debug c => _63; @@ -172,10 +175,12 @@ debug a => _66; let mut _67: &usize; scope 34 { - debug b => _67; +- debug b => _67; ++ debug (*(b: &usize)) => _66; let _68: &mut &usize; scope 35 { - debug d => _68; +- debug d => _68; ++ debug (*(*(d: &mut &usize))) => _66; let _69: usize; scope 36 { debug c => _69; @@ -188,8 +193,8 @@ - StorageLive(_3); StorageLive(_4); _4 = const 5_usize; - StorageLive(_5); - _5 = &_4; +- StorageLive(_5); +- _5 = &_4; StorageLive(_6); - _6 = (*_5); + _6 = _4; @@ -204,7 +209,7 @@ StorageDead(_7); - _3 = const (); StorageDead(_6); - StorageDead(_5); +- StorageDead(_5); StorageDead(_4); - StorageDead(_3); - StorageLive(_9); @@ -247,7 +252,8 @@ StorageLive(_21); _21 = &_20; StorageLive(_22); - _22 = (*_20); +- _22 = (*_20); ++ _22 = _19; StorageLive(_23); StorageLive(_24); _24 = _21; @@ -389,12 +395,13 @@ - StorageLive(_59); StorageLive(_60); _60 = const 5_usize; - StorageLive(_61); - _61 = &_60; - StorageLive(_62); - _62 = &_61; +- StorageLive(_61); +- _61 = &_60; +- StorageLive(_62); +- _62 = &_61; StorageLive(_63); - _63 = (*_61); +- _63 = (*_61); ++ _63 = _60; StorageLive(_64); StorageLive(_65); _65 = (); @@ -406,18 +413,19 @@ StorageDead(_64); - _59 = const (); StorageDead(_63); - StorageDead(_62); - StorageDead(_61); +- StorageDead(_62); +- StorageDead(_61); StorageDead(_60); - StorageDead(_59); StorageLive(_66); _66 = const 5_usize; - StorageLive(_67); - _67 = &_66; - StorageLive(_68); - _68 = &mut _67; +- StorageLive(_67); +- _67 = &_66; +- StorageLive(_68); +- _68 = &mut _67; StorageLive(_69); - _69 = (*_67); +- _69 = (*_67); ++ _69 = _66; StorageLive(_70); StorageLive(_71); _71 = (); @@ -429,8 +437,8 @@ StorageDead(_70); _0 = const (); StorageDead(_69); - StorageDead(_68); - StorageDead(_67); +- StorageDead(_68); +- StorageDead(_67); StorageDead(_66); return; } diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index ce5ddbfdd1231..39e198e11d4b1 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -45,7 +45,8 @@ debug a => _4; let _5: *const usize; scope 3 { - debug b => _5; +- debug b => _5; ++ debug (*(b: *const usize)) => _4; let _6: usize; scope 4 { debug c => _6; @@ -174,10 +175,12 @@ debug a => _58; let _59: *const usize; scope 39 { - debug b => _59; +- debug b => _59; ++ debug (*(b: *const usize)) => _58; let _60: *const usize; scope 40 { - debug c => _60; +- debug c => _60; ++ debug (*(c: *const usize)) => _58; let _61: usize; scope 41 { debug e => _61; @@ -192,10 +195,12 @@ debug a => _65; let _66: *const usize; scope 44 { - debug b => _66; +- debug b => _66; ++ debug (*(b: *const usize)) => _65; let _67: &*const usize; scope 45 { - debug d => _67; +- debug d => _67; ++ debug (*(*(d: &*const usize))) => _65; let _68: usize; scope 46 { debug c => _68; @@ -210,10 +215,12 @@ debug a => _71; let mut _72: *const usize; scope 49 { - debug b => _72; +- debug b => _72; ++ debug (*(b: *const usize)) => _71; let _73: &mut *const usize; scope 50 { - debug d => _73; +- debug d => _73; ++ debug (*(*(d: &mut *const usize))) => _71; let _74: usize; scope 51 { debug c => _74; @@ -227,8 +234,8 @@ - StorageLive(_3); StorageLive(_4); _4 = const 5_usize; - StorageLive(_5); - _5 = &raw const _4; +- StorageLive(_5); +- _5 = &raw const _4; StorageLive(_6); - _6 = (*_5); + _6 = _4; @@ -243,7 +250,7 @@ StorageDead(_7); - _3 = const (); StorageDead(_6); - StorageDead(_5); +- StorageDead(_5); StorageDead(_4); - StorageDead(_3); - StorageLive(_9); @@ -282,7 +289,8 @@ StorageLive(_20); _20 = &_19; StorageLive(_21); - _21 = (*_19); +- _21 = (*_19); ++ _21 = _18; StorageLive(_22); StorageLive(_23); _23 = _20; @@ -420,11 +428,10 @@ - StorageLive(_57); StorageLive(_58); _58 = const 13_usize; - StorageLive(_59); - _59 = &raw const _58; - StorageLive(_60); +- StorageLive(_59); +- _59 = &raw const _58; +- StorageLive(_60); - _60 = &raw const (*_59); -+ _60 = &raw const _58; StorageLive(_61); - _61 = (*_60); + _61 = _58; @@ -439,19 +446,20 @@ StorageDead(_62); - _57 = const (); StorageDead(_61); - StorageDead(_60); - StorageDead(_59); +- StorageDead(_60); +- StorageDead(_59); StorageDead(_58); - StorageDead(_57); - StorageLive(_64); StorageLive(_65); _65 = const 5_usize; - StorageLive(_66); - _66 = &raw const _65; - StorageLive(_67); - _67 = &_66; +- StorageLive(_66); +- _66 = &raw const _65; +- StorageLive(_67); +- _67 = &_66; StorageLive(_68); - _68 = (*_66); +- _68 = (*_66); ++ _68 = _65; StorageLive(_69); StorageLive(_70); _70 = (); @@ -463,18 +471,19 @@ StorageDead(_69); - _64 = const (); StorageDead(_68); - StorageDead(_67); - StorageDead(_66); +- StorageDead(_67); +- StorageDead(_66); StorageDead(_65); - StorageDead(_64); StorageLive(_71); _71 = const 5_usize; - StorageLive(_72); - _72 = &raw const _71; - StorageLive(_73); - _73 = &mut _72; +- StorageLive(_72); +- _72 = &raw const _71; +- StorageLive(_73); +- _73 = &mut _72; StorageLive(_74); - _74 = (*_72); +- _74 = (*_72); ++ _74 = _71; StorageLive(_75); StorageLive(_76); _76 = (); @@ -486,8 +495,8 @@ StorageDead(_75); _0 = const (); StorageDead(_74); - StorageDead(_73); - StorageDead(_72); +- StorageDead(_73); +- StorageDead(_72); StorageDead(_71); return; } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff index 7c7f424bba2bd..fd2c3c9c3fd5a 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -52,7 +52,8 @@ debug a => _4; let _5: &mut usize; scope 2 { - debug b => _5; +- debug b => _5; ++ debug (*(b: &mut usize)) => _4; let _6: usize; scope 3 { debug c => _6; @@ -157,10 +158,12 @@ debug a => _60; let _61: &mut usize; scope 30 { - debug b => _61; +- debug b => _61; ++ debug (*(b: &mut usize)) => _60; let _62: &&mut usize; scope 31 { - debug d => _62; +- debug d => _62; ++ debug (*(*(d: &&mut usize))) => _60; let _63: usize; scope 32 { debug c => _63; @@ -172,10 +175,12 @@ debug a => _66; let mut _67: &mut usize; scope 34 { - debug b => _67; +- debug b => _67; ++ debug (*(b: &mut usize)) => _66; let _68: &mut &mut usize; scope 35 { - debug d => _68; +- debug d => _68; ++ debug (*(*(d: &mut &mut usize))) => _66; let _69: usize; scope 36 { debug c => _69; @@ -188,8 +193,8 @@ - StorageLive(_3); StorageLive(_4); _4 = const 5_usize; - StorageLive(_5); - _5 = &mut _4; +- StorageLive(_5); +- _5 = &mut _4; StorageLive(_6); - _6 = (*_5); + _6 = _4; @@ -204,7 +209,7 @@ StorageDead(_7); - _3 = const (); StorageDead(_6); - StorageDead(_5); +- StorageDead(_5); StorageDead(_4); - StorageDead(_3); - StorageLive(_9); @@ -386,12 +391,13 @@ - StorageLive(_59); StorageLive(_60); _60 = const 5_usize; - StorageLive(_61); - _61 = &mut _60; - StorageLive(_62); - _62 = &_61; +- StorageLive(_61); +- _61 = &mut _60; +- StorageLive(_62); +- _62 = &_61; StorageLive(_63); - _63 = (*_61); +- _63 = (*_61); ++ _63 = _60; StorageLive(_64); StorageLive(_65); _65 = (); @@ -403,18 +409,19 @@ StorageDead(_64); - _59 = const (); StorageDead(_63); - StorageDead(_62); - StorageDead(_61); +- StorageDead(_62); +- StorageDead(_61); StorageDead(_60); - StorageDead(_59); StorageLive(_66); _66 = const 5_usize; - StorageLive(_67); - _67 = &mut _66; - StorageLive(_68); - _68 = &mut _67; +- StorageLive(_67); +- _67 = &mut _66; +- StorageLive(_68); +- _68 = &mut _67; StorageLive(_69); - _69 = (*_67); +- _69 = (*_67); ++ _69 = _66; StorageLive(_70); StorageLive(_71); _71 = (); @@ -426,8 +433,8 @@ StorageDead(_70); _0 = const (); StorageDead(_69); - StorageDead(_68); - StorageDead(_67); +- StorageDead(_68); +- StorageDead(_67); StorageDead(_66); return; } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff index b6b2acc0b4396..bc99147adb034 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -42,7 +42,8 @@ debug a => _4; let _5: *mut usize; scope 3 { - debug b => _5; +- debug b => _5; ++ debug (*(b: *mut usize)) => _4; let _6: usize; scope 4 { debug c => _6; @@ -171,10 +172,12 @@ debug a => _58; let _59: *mut usize; scope 39 { - debug b => _59; +- debug b => _59; ++ debug (*(b: *mut usize)) => _58; let _60: &*mut usize; scope 40 { - debug d => _60; +- debug d => _60; ++ debug (*(*(d: &*mut usize))) => _58; let _61: usize; scope 41 { debug c => _61; @@ -189,10 +192,12 @@ debug a => _64; let mut _65: *mut usize; scope 44 { - debug b => _65; +- debug b => _65; ++ debug (*(b: *mut usize)) => _64; let _66: &mut *mut usize; scope 45 { - debug d => _66; +- debug d => _66; ++ debug (*(*(d: &mut *mut usize))) => _64; let _67: usize; scope 46 { debug c => _67; @@ -206,8 +211,8 @@ - StorageLive(_3); StorageLive(_4); _4 = const 5_usize; - StorageLive(_5); - _5 = &raw mut _4; +- StorageLive(_5); +- _5 = &raw mut _4; StorageLive(_6); - _6 = (*_5); + _6 = _4; @@ -222,7 +227,7 @@ StorageDead(_7); - _3 = const (); StorageDead(_6); - StorageDead(_5); +- StorageDead(_5); StorageDead(_4); - StorageDead(_3); - StorageLive(_9); @@ -396,12 +401,13 @@ - StorageLive(_57); StorageLive(_58); _58 = const 5_usize; - StorageLive(_59); - _59 = &raw mut _58; - StorageLive(_60); - _60 = &_59; +- StorageLive(_59); +- _59 = &raw mut _58; +- StorageLive(_60); +- _60 = &_59; StorageLive(_61); - _61 = (*_59); +- _61 = (*_59); ++ _61 = _58; StorageLive(_62); StorageLive(_63); _63 = (); @@ -413,18 +419,19 @@ StorageDead(_62); - _57 = const (); StorageDead(_61); - StorageDead(_60); - StorageDead(_59); +- StorageDead(_60); +- StorageDead(_59); StorageDead(_58); - StorageDead(_57); StorageLive(_64); _64 = const 5_usize; - StorageLive(_65); - _65 = &raw mut _64; - StorageLive(_66); - _66 = &mut _65; +- StorageLive(_65); +- _65 = &raw mut _64; +- StorageLive(_66); +- _66 = &mut _65; StorageLive(_67); - _67 = (*_65); +- _67 = (*_65); ++ _67 = _64; StorageLive(_68); StorageLive(_69); _69 = (); @@ -436,8 +443,8 @@ StorageDead(_68); _0 = const (); StorageDead(_67); - StorageDead(_66); - StorageDead(_65); +- StorageDead(_66); +- StorageDead(_65); StorageDead(_64); return; } diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index b71ad90abb19d..9e4a8f669cb29 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -15,7 +15,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { { // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &[[a]]; + // CHECK-NOT: {{.*}} = &{{.*}}; // CHECK: [[c:_.*]] = [[a]]; let a = 5_usize; @@ -49,7 +49,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = [[a]]; let a = 5_usize; let b = &a; @@ -136,10 +136,8 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { { // CHECK: bb8: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &[[a]]; - // CHECK: [[d:_.*]] = &[[b]]; - // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK-NOT: {{.*}} = &{{.*}}; + // CHECK: [[c:_.*]] = [[a]]; let a = 5_usize; let b = &a; @@ -152,10 +150,8 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { { // CHECK: bb9: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &[[a]]; - // CHECK: [[d:_.*]] = &mut [[b]]; - // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK-NOT: {{.*}} = &{{.*}}; + // CHECK: [[c:_.*]] = [[a]]; let a = 5_usize; let mut b = &a; @@ -172,7 +168,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m { // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &mut [[a]]; + // CHECK-NOT: {{.*}} = &{{.*}}; // CHECK: [[c:_.*]] = [[a]]; let mut a = 5_usize; @@ -293,10 +289,8 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m { // CHECK: bb8: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &mut [[a]]; - // CHECK: [[d:_.*]] = &[[b]]; - // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK-NOT: {{.*}} = &{{.*}}; + // CHECK: [[c:_.*]] = [[a]]; let mut a = 5_usize; let b = &mut a; @@ -309,10 +303,8 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m { // CHECK: bb9: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &mut [[a]]; - // CHECK: [[d:_.*]] = &mut [[b]]; - // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK-NOT: {{.*}} = &{{.*}}; + // CHECK: [[c:_.*]] = [[a]]; let mut a = 5_usize; let mut b = &mut a; @@ -329,7 +321,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con unsafe { // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK-NOT: {{.*}} = &{{.*}}; // CHECK: [[c:_.*]] = [[a]]; let a = 5_usize; @@ -363,7 +355,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = [[a]]; let a = 5_usize; let b = &raw const a; @@ -450,8 +442,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con unsafe { // CHECK: bb8: { // CHECK: [[a:_.*]] = const 13_usize; - // CHECK: [[b:_.*]] = &raw const [[a]]; - // CHECK: [[d:_.*]] = &raw const [[a]]; + // CHECK-NOT: {{.*}} = &{{.*}}; // CHECK: [[c:_.*]] = [[a]]; let a = 13_usize; @@ -465,10 +456,8 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con unsafe { // CHECK: bb9: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &raw const [[a]]; - // CHECK: [[d:_.*]] = &[[b]]; - // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK-NOT: {{.*}} = &{{.*}}; + // CHECK: [[c:_.*]] = [[a]]; let a = 5_usize; let b = &raw const a; @@ -481,10 +470,8 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con unsafe { // CHECK: bb10: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &raw const [[a]]; - // CHECK: [[d:_.*]] = &mut [[b]]; - // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK-NOT: {{.*}} = &{{.*}}; + // CHECK: [[c:_.*]] = [[a]]; let a = 5_usize; let mut b = &raw const a; @@ -501,7 +488,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) unsafe { // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &raw mut [[a]]; + // CHECK-NOT: {{.*}} = &{{.*}}; // CHECK: [[c:_.*]] = [[a]]; let mut a = 5_usize; @@ -622,10 +609,8 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) unsafe { // CHECK: bb8: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &raw mut [[a]]; - // CHECK: [[d:_.*]] = &[[b]]; - // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK-NOT: {{.*}} = &{{.*}}; + // CHECK: [[c:_.*]] = [[a]]; let mut a = 5_usize; let b = &raw mut a; @@ -638,10 +623,8 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) unsafe { // CHECK: bb9: { // CHECK: [[a:_.*]] = const 5_usize; - // CHECK: [[b:_.*]] = &raw mut [[a]]; - // CHECK: [[d:_.*]] = &mut [[b]]; - // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK-NOT: {{.*}} = &{{.*}}; + // CHECK: [[c:_.*]] = [[a]]; let mut a = 5_usize; let mut b = &raw mut a; @@ -819,15 +802,14 @@ fn unique_with_copies() { fn debuginfo() { // CHECK-LABEL: fn debuginfo( - // FIXME: This features waits for DWARF implicit pointers in LLVM. - // CHECK: debug ref_mut_u8 => _{{.*}}; - // CHECK: debug field => _{{.*}}; - // CHECK: debug reborrow => _{{.*}}; - // CHECK: debug variant_field => _{{.*}}; - // CHECK: debug constant_index => _{{.*}}; + // CHECK: debug (*(ref_mut_u8: &mut u8)) => _{{.*}}; + // CHECK: debug (*(field: &u8)) => ((*_{{.*}}).0: u8); + // CHECK: debug (*(reborrow: &mut u8)) => _{{.*}}; + // CHECK: debug (*(variant_field: &i32)) => (((*_{{.*}}) as Some).0: i32); + // CHECK: debug (*(constant_index: &i32)) => (*_{{.*}})[1 of 3]; // CHECK: debug subslice => _{{.*}}; // CHECK: debug constant_index_from_end => _{{.*}}; - // CHECK: debug multiple_borrow => _{{.*}}; + // CHECK: debug (*(*(*(multiple_borrow: &&&mut u8)))) => (_{{.*}}.0: u8); struct T(u8); @@ -852,8 +834,10 @@ fn debuginfo() { fn many_debuginfo() { // CHECK-LABEL: fn many_debuginfo( - // FIXME: This features waits for DWARF implicit pointers in LLVM. - // CHECK: debug many_borrow => _{{.*}}; + // CHECK: debug a => [[a:_.*]]; + // CHECK: debug (* + // CHECK-SAME: many_borrow + // CHECK-SAME: => [[a]]; let a = 0; @@ -894,3 +878,4 @@ fn main() { // EMIT_MIR reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff // EMIT_MIR reference_prop.unique_with_copies.ReferencePropagation.diff // EMIT_MIR reference_prop.debuginfo.ReferencePropagation.diff +// EMIT_MIR reference_prop.many_debuginfo.ReferencePropagation.diff diff --git a/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff b/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff new file mode 100644 index 0000000000000..867de16fd370d --- /dev/null +++ b/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff @@ -0,0 +1,110 @@ +- // MIR for `identity` before JumpThreading ++ // MIR for `identity` after JumpThreading + + fn identity(_1: Result) -> Result { + debug x => _1; + let mut _0: std::result::Result; + let mut _2: std::ops::ControlFlow, i32>; + let mut _3: isize; + let _4: std::result::Result; + let _5: i32; + scope 1 { + debug residual => _4; + scope 2 { + scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { + debug residual => _4; + let _10: i32; + scope 9 { + debug e => _10; + scope 10 (inlined >::from) { + debug t => _10; + } + } + } + } + } + scope 3 { + debug val => _5; + scope 4 { + } + } + scope 5 (inlined as Try>::branch) { + debug self => _1; + let mut _6: isize; + let _7: i32; + let _8: i32; + let mut _9: std::result::Result; + scope 6 { + debug v => _7; + } + scope 7 { + debug e => _8; + } + } + + bb0: { + StorageLive(_2); + StorageLive(_6); + StorageLive(_7); + StorageLive(_8); + _6 = discriminant(_1); + switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb7]; + } + + bb1: { + _5 = ((_2 as Continue).0: i32); + _0 = Result::::Ok(_5); + StorageDead(_2); + goto -> bb3; + } + + bb2: { + _4 = ((_2 as Break).0: std::result::Result); + _10 = move ((_4 as Err).0: i32); + _0 = Result::::Err(_10); + StorageDead(_2); + goto -> bb3; + } + + bb3: { + return; + } + + bb4: { + StorageDead(_8); + StorageDead(_7); + StorageDead(_6); + _3 = discriminant(_2); +- switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb7]; ++ goto -> bb1; + } + + bb5: { + _8 = move ((_1 as Err).0: i32); + StorageLive(_9); + _9 = Result::::Err(_8); + _2 = ControlFlow::, i32>::Break(move _9); + StorageDead(_9); +- goto -> bb4; ++ goto -> bb8; + } + + bb6: { + _7 = move ((_1 as Ok).0: i32); + _2 = ControlFlow::, i32>::Continue(_7); + goto -> bb4; + } + + bb7: { + unreachable; ++ } ++ ++ bb8: { ++ StorageDead(_8); ++ StorageDead(_7); ++ StorageDead(_6); ++ _3 = discriminant(_2); ++ goto -> bb2; + } + } + diff --git a/tests/mir-opt/separate_const_switch.identity.PreCodegen.diff b/tests/mir-opt/separate_const_switch.identity.PreCodegen.diff new file mode 100644 index 0000000000000..a955a3d5d14bb --- /dev/null +++ b/tests/mir-opt/separate_const_switch.identity.PreCodegen.diff @@ -0,0 +1,85 @@ +- // MIR for `identity` before PreCodegen ++ // MIR for `identity` after PreCodegen + + fn identity(_1: Result) -> Result { + debug x => _1; + let mut _0: std::result::Result; + let mut _4: std::ops::ControlFlow, i32>; + let _5: i32; + let _8: std::result::Result; + scope 1 { + debug residual => _8; + scope 2 { + scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { + debug residual => _8; + let _9: i32; + scope 9 { + debug e => _9; + scope 10 (inlined >::from) { + debug t => _9; + } + } + } + } + } + scope 3 { + debug val => _5; + scope 4 { + } + } + scope 5 (inlined as Try>::branch) { + debug self => _1; + let mut _2: isize; + let _3: i32; + let _6: i32; + let mut _7: std::result::Result; + scope 6 { + debug v => _3; + } + scope 7 { + debug e => _6; + } + } + + bb0: { + StorageLive(_4); + StorageLive(_2); + StorageLive(_3); + StorageLive(_6); + _2 = discriminant(_1); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb3]; + } + + bb1: { + _3 = move ((_1 as Ok).0: i32); + _4 = ControlFlow::, i32>::Continue(_3); + StorageDead(_6); + StorageDead(_3); + StorageDead(_2); + _5 = ((_4 as Continue).0: i32); + _0 = Result::::Ok(_5); + StorageDead(_4); + return; + } + + bb2: { + _6 = move ((_1 as Err).0: i32); + StorageLive(_7); + _7 = Result::::Err(_6); + _4 = ControlFlow::, i32>::Break(move _7); + StorageDead(_7); + StorageDead(_6); + StorageDead(_3); + StorageDead(_2); + _8 = ((_4 as Break).0: std::result::Result); + _9 = move ((_8 as Err).0: i32); + _0 = Result::::Err(_9); + StorageDead(_4); + return; + } + + bb3: { + unreachable; + } + } + diff --git a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff deleted file mode 100644 index e7280f148377c..0000000000000 --- a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff +++ /dev/null @@ -1,104 +0,0 @@ -- // MIR for `identity` before SeparateConstSwitch -+ // MIR for `identity` after SeparateConstSwitch - - fn identity(_1: Result) -> Result { - debug x => _1; - let mut _0: std::result::Result; - let mut _2: std::ops::ControlFlow, i32>; - let mut _3: std::result::Result; - let mut _4: isize; - let _5: std::result::Result; - let mut _6: std::result::Result; - let _7: i32; - scope 1 { - debug residual => _5; - scope 2 { - scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { - debug residual => _6; - let _12: i32; - scope 9 { - debug e => _12; - scope 10 (inlined >::from) { - debug t => _12; - } - } - } - } - } - scope 3 { - debug val => _7; - scope 4 { - } - } - scope 5 (inlined as Try>::branch) { - debug self => _3; - let mut _8: isize; - let _9: i32; - let _10: i32; - let mut _11: std::result::Result; - scope 6 { - debug v => _9; - } - scope 7 { - debug e => _10; - } - } - - bb0: { - StorageLive(_2); - StorageLive(_3); - _3 = _1; - StorageLive(_8); - StorageLive(_9); - StorageLive(_10); - _8 = discriminant(_1); - switchInt(move _8) -> [0: bb5, 1: bb4, otherwise: bb6]; - } - - bb1: { - _7 = ((_2 as Continue).0: i32); - _0 = Result::::Ok(_7); - StorageDead(_2); - return; - } - - bb2: { - _5 = ((_2 as Break).0: std::result::Result); - StorageLive(_6); - _6 = _5; - _12 = move ((_5 as Err).0: i32); - _0 = Result::::Err(_12); - StorageDead(_6); - StorageDead(_2); - return; - } - - bb3: { - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); - StorageDead(_3); - _4 = discriminant(_2); - switchInt(move _4) -> [0: bb1, 1: bb2, otherwise: bb6]; - } - - bb4: { - _10 = move ((_1 as Err).0: i32); - StorageLive(_11); - _11 = Result::::Err(_10); - _2 = ControlFlow::, i32>::Break(move _11); - StorageDead(_11); - goto -> bb3; - } - - bb5: { - _9 = move ((_1 as Ok).0: i32); - _2 = ControlFlow::, i32>::Continue(_9); - goto -> bb3; - } - - bb6: { - unreachable; - } - } - diff --git a/tests/mir-opt/separate_const_switch.rs b/tests/mir-opt/separate_const_switch.rs index 3f43cdf4350b7..030c2fbc14806 100644 --- a/tests/mir-opt/separate_const_switch.rs +++ b/tests/mir-opt/separate_const_switch.rs @@ -2,11 +2,10 @@ #![feature(control_flow_enum)] #![feature(try_trait_v2)] -// compile-flags: -Zunsound-mir-opts - use std::ops::ControlFlow; -// EMIT_MIR separate_const_switch.too_complex.SeparateConstSwitch.diff +// EMIT_MIR separate_const_switch.too_complex.JumpThreading.diff +// EMIT_MIR separate_const_switch.too_complex.PreCodegen.diff fn too_complex(x: Result) -> Option { // The pass should break the outer match into // two blocks that only have one parent each. @@ -23,7 +22,8 @@ fn too_complex(x: Result) -> Option { } } -// EMIT_MIR separate_const_switch.identity.SeparateConstSwitch.diff +// EMIT_MIR separate_const_switch.identity.JumpThreading.diff +// EMIT_MIR separate_const_switch.identity.PreCodegen.diff fn identity(x: Result) -> Result { Ok(x?) } diff --git a/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.too_complex.JumpThreading.diff similarity index 83% rename from tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff rename to tests/mir-opt/separate_const_switch.too_complex.JumpThreading.diff index 294bfa661cfa4..1ac527e9338a1 100644 --- a/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff +++ b/tests/mir-opt/separate_const_switch.too_complex.JumpThreading.diff @@ -1,5 +1,5 @@ -- // MIR for `too_complex` before SeparateConstSwitch -+ // MIR for `too_complex` after SeparateConstSwitch +- // MIR for `too_complex` before JumpThreading ++ // MIR for `too_complex` after JumpThreading fn too_complex(_1: Result) -> Option { debug x => _1; @@ -33,7 +33,8 @@ bb1: { _5 = ((_1 as Err).0: usize); _2 = ControlFlow::::Break(_5); - goto -> bb3; +- goto -> bb3; ++ goto -> bb8; } bb2: { @@ -44,7 +45,8 @@ bb3: { _6 = discriminant(_2); - switchInt(move _6) -> [0: bb5, 1: bb4, otherwise: bb7]; +- switchInt(move _6) -> [0: bb5, 1: bb4, otherwise: bb7]; ++ goto -> bb5; } bb4: { @@ -68,6 +70,11 @@ bb7: { unreachable; ++ } ++ ++ bb8: { ++ _6 = discriminant(_2); ++ goto -> bb4; } } diff --git a/tests/mir-opt/separate_const_switch.too_complex.PreCodegen.diff b/tests/mir-opt/separate_const_switch.too_complex.PreCodegen.diff new file mode 100644 index 0000000000000..71e1855ff510b --- /dev/null +++ b/tests/mir-opt/separate_const_switch.too_complex.PreCodegen.diff @@ -0,0 +1,63 @@ +- // MIR for `too_complex` before PreCodegen ++ // MIR for `too_complex` after PreCodegen + + fn too_complex(_1: Result) -> Option { + debug x => _1; + let mut _0: std::option::Option; + let mut _2: isize; + let _3: i32; + let mut _4: std::ops::ControlFlow; + let _5: i32; + let _6: usize; + let _7: usize; + scope 1 { + debug v => _3; + } + scope 2 { + debug r => _6; + } + scope 3 { + debug v => _5; + } + scope 4 { + debug r => _7; + } + + bb0: { + StorageLive(_4); + _2 = discriminant(_1); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; + } + + bb1: { + _3 = ((_1 as Ok).0: i32); + _4 = ControlFlow::::Continue(_3); + _5 = ((_4 as Continue).0: i32); + _0 = Option::::Some(_5); + goto -> bb3; + } + + bb2: { + _6 = ((_1 as Err).0: usize); + _4 = ControlFlow::::Break(_6); + StorageLive(_7); + _7 = ((_4 as Break).0: usize); + _0 = const Option::::None; + StorageDead(_7); + goto -> bb3; + } + + bb3: { + StorageDead(_4); + return; + } + + bb4: { + unreachable; + } + } + + ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ + } + diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff deleted file mode 100644 index c3076fb67c231..0000000000000 --- a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff +++ /dev/null @@ -1,21 +0,0 @@ -- // MIR for `main` before SimplifyConstCondition-after-const-prop -+ // MIR for `main` after SimplifyConstCondition-after-const-prop - - fn main() -> () { - let mut _0: (); - let _1: (); - - bb0: { -- switchInt(const false) -> [0: bb2, otherwise: bb1]; -+ goto -> bb2; - } - - bb1: { - _1 = noop() -> [return: bb2, unwind unreachable]; - } - - bb2: { - return; - } - } - diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff deleted file mode 100644 index 6c346e20e5893..0000000000000 --- a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff +++ /dev/null @@ -1,21 +0,0 @@ -- // MIR for `main` before SimplifyConstCondition-after-const-prop -+ // MIR for `main` after SimplifyConstCondition-after-const-prop - - fn main() -> () { - let mut _0: (); - let _1: (); - - bb0: { -- switchInt(const false) -> [0: bb2, otherwise: bb1]; -+ goto -> bb2; - } - - bb1: { - _1 = noop() -> [return: bb2, unwind continue]; - } - - bb2: { - return; - } - } - diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-gvn.panic-abort.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-gvn.panic-abort.diff new file mode 100644 index 0000000000000..a0059906d09ef --- /dev/null +++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-gvn.panic-abort.diff @@ -0,0 +1,37 @@ +- // MIR for `main` before SimplifyConstCondition-after-gvn ++ // MIR for `main` after SimplifyConstCondition-after-gvn + + fn main() -> () { + let mut _0: (); + let mut _1: bool; + let _2: (); + + bb0: { + StorageLive(_1); + _1 = const false; +- switchInt(const false) -> [0: bb3, otherwise: bb1]; ++ goto -> bb3; + } + + bb1: { + StorageLive(_2); + _2 = noop() -> [return: bb2, unwind unreachable]; + } + + bb2: { + StorageDead(_2); + _0 = const (); + goto -> bb4; + } + + bb3: { + _0 = const (); + goto -> bb4; + } + + bb4: { + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-gvn.panic-unwind.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-gvn.panic-unwind.diff new file mode 100644 index 0000000000000..6263c26d33518 --- /dev/null +++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-gvn.panic-unwind.diff @@ -0,0 +1,37 @@ +- // MIR for `main` before SimplifyConstCondition-after-gvn ++ // MIR for `main` after SimplifyConstCondition-after-gvn + + fn main() -> () { + let mut _0: (); + let mut _1: bool; + let _2: (); + + bb0: { + StorageLive(_1); + _1 = const false; +- switchInt(const false) -> [0: bb3, otherwise: bb1]; ++ goto -> bb3; + } + + bb1: { + StorageLive(_2); + _2 = noop() -> [return: bb2, unwind continue]; + } + + bb2: { + StorageDead(_2); + _0 = const (); + goto -> bb4; + } + + bb3: { + _0 = const (); + goto -> bb4; + } + + bb4: { + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/simplify_if.rs b/tests/mir-opt/simplify_if.rs index 19b5806f72094..08ce2383a64a5 100644 --- a/tests/mir-opt/simplify_if.rs +++ b/tests/mir-opt/simplify_if.rs @@ -1,9 +1,10 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// compile-flags: -Zmir-opt-level=0 -Zmir-enable-passes=+GVN,+SimplifyConstCondition-after-gvn #[inline(never)] fn noop() {} -// EMIT_MIR simplify_if.main.SimplifyConstCondition-after-const-prop.diff +// EMIT_MIR simplify_if.main.SimplifyConstCondition-after-gvn.diff fn main() { if false { noop(); diff --git a/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff b/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff index 33b36f660cb3a..9b2a3f9b66c67 100644 --- a/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff +++ b/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff @@ -6,7 +6,8 @@ let mut _1: bool; let _2: bool; scope 1 { - debug x => _2; +- debug x => _2; ++ debug x => const false; } bb0: { @@ -16,17 +17,22 @@ _2 = const false; - _1 = _2; - StorageDead(_2); -- switchInt(_1) -> [0: bb2, otherwise: bb1]; +- switchInt(_1) -> [0: bb1, otherwise: bb2]; + _1 = const false; + nop; -+ switchInt(const false) -> [0: bb2, otherwise: bb1]; ++ switchInt(const false) -> [0: bb1, otherwise: bb2]; } bb1: { - _0 = noop() -> [return: bb2, unwind unreachable]; + _0 = const (); + goto -> bb3; } bb2: { + _0 = noop() -> [return: bb3, unwind unreachable]; + } + + bb3: { StorageDead(_1); return; } diff --git a/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff b/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff index e5c3adff62369..5ffad1ef266f5 100644 --- a/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff @@ -6,7 +6,8 @@ let mut _1: bool; let _2: bool; scope 1 { - debug x => _2; +- debug x => _2; ++ debug x => const false; } bb0: { @@ -16,17 +17,22 @@ _2 = const false; - _1 = _2; - StorageDead(_2); -- switchInt(_1) -> [0: bb2, otherwise: bb1]; +- switchInt(_1) -> [0: bb1, otherwise: bb2]; + _1 = const false; + nop; -+ switchInt(const false) -> [0: bb2, otherwise: bb1]; ++ switchInt(const false) -> [0: bb1, otherwise: bb2]; } bb1: { - _0 = noop() -> [return: bb2, unwind continue]; + _0 = const (); + goto -> bb3; } bb2: { + _0 = noop() -> [return: bb3, unwind continue]; + } + + bb3: { StorageDead(_1); return; } diff --git a/tests/mir-opt/simplify_match.rs b/tests/mir-opt/simplify_match.rs index 2eac93edbb8e3..99a22db76faa0 100644 --- a/tests/mir-opt/simplify_match.rs +++ b/tests/mir-opt/simplify_match.rs @@ -1,4 +1,5 @@ // skip-filecheck +// unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #[inline(never)] fn noop() {} diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff index b020d1baafa16..e54f379155251 100644 --- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff @@ -31,6 +31,9 @@ let mut _30: isize; + let _31: std::result::Result, ::Err>; + let _32: u32; ++ let _33: &str; ++ let _34: &str; ++ let _35: &str; scope 1 { - debug foo => _1; + debug ((foo: Foo).0: std::result::Result, ::Err>) => _31;