diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index 8173e41aff457..b6482e6e137b5 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -233,8 +233,9 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { }) } + #[instrument(level = "trace", skip(self), ret)] fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: &'ll Type) -> &'ll Value { - let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() }; + let bitsize = if llty == self.type_i1() { 1 } else { layout.size(self).bits() }; match cv { Scalar::Int(int) => { let data = int.assert_bits(layout.size(self)); diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index d724f9503bb6c..df19d68119528 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -84,6 +84,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { OperandRef { val: OperandValue::ZeroSized, layout } } + #[instrument(level = "debug", skip(bx))] pub fn from_const>( bx: &mut Bx, val: mir::ConstValue<'tcx>, @@ -125,6 +126,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { OperandRef { val, layout } } + #[instrument(level = "debug", skip(bx), ret)] fn from_const_alloc>( bx: &mut Bx, layout: TyAndLayout<'tcx>, @@ -560,13 +562,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx.load_operand(place) } + #[instrument(level = "debug", skip(self, bx))] pub fn codegen_operand( &mut self, bx: &mut Bx, operand: &mir::Operand<'tcx>, ) -> OperandRef<'tcx, Bx::Value> { - debug!("codegen_operand(operand={:?})", operand); - match *operand { mir::Operand::Copy(ref place) | mir::Operand::Move(ref place) => { self.codegen_consume(bx, place.as_ref()) diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index d88b33cc9734c..4963f24fb7c4b 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -1,30 +1,22 @@ //! Propagates constants for early reporting of statically known //! assertion failures -use either::Right; -use rustc_const_eval::ReportErrorExt; +use rustc_const_eval::interpret::{ + self, compile_time_machine, AllocId, ConstAllocation, FnArg, Frame, ImmTy, InterpCx, + InterpResult, OpTy, PlaceTy, Pointer, +}; use rustc_data_structures::fx::FxHashSet; -use rustc_hir::def::DefKind; use rustc_index::bit_set::BitSet; -use rustc_index::{IndexSlice, IndexVec}; -use rustc_middle::mir::visit::{ - MutVisitor, MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor, -}; +use rustc_index::IndexVec; +use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor}; use rustc_middle::mir::*; use rustc_middle::query::TyCtxtAt; -use rustc_middle::ty::layout::{LayoutError, LayoutOf, LayoutOfHelpers, TyAndLayout}; -use rustc_middle::ty::{self, GenericArgs, Instance, ParamEnv, Ty, TyCtxt, TypeVisitableExt}; -use rustc_span::{def_id::DefId, Span}; -use rustc_target::abi::{self, HasDataLayout, Size, TargetDataLayout}; +use rustc_middle::ty::layout::TyAndLayout; +use rustc_middle::ty::{self, ParamEnv, TyCtxt}; +use rustc_span::def_id::DefId; +use rustc_target::abi::Size; use rustc_target::spec::abi::Abi as CallAbi; -use crate::dataflow_const_prop::Patch; -use crate::MirPass; -use rustc_const_eval::interpret::{ - self, compile_time_machine, AllocId, ConstAllocation, FnArg, Frame, ImmTy, Immediate, InterpCx, - InterpResult, MemoryKind, OpTy, PlaceTy, Pointer, Scalar, StackPopCleanup, -}; - /// The maximum number of bytes that we'll allocate space for a local or the return value. /// Needed for #66397, because otherwise we eval into large places and that can cause OOM or just /// Severely regress performance. @@ -57,62 +49,7 @@ pub(crate) macro throw_machine_stop_str($($tt:tt)*) {{ throw_machine_stop!(Zst) }} -pub struct ConstProp; - -impl<'tcx> MirPass<'tcx> for ConstProp { - fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - sess.mir_opt_level() >= 2 - } - - #[instrument(skip(self, tcx), level = "debug")] - fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - // will be evaluated by miri and produce its errors there - if body.source.promoted.is_some() { - return; - } - - let def_id = body.source.def_id().expect_local(); - let def_kind = tcx.def_kind(def_id); - let is_fn_like = def_kind.is_fn_like(); - let is_assoc_const = def_kind == DefKind::AssocConst; - - // Only run const prop on functions, methods, closures and associated constants - if !is_fn_like && !is_assoc_const { - // skip anon_const/statics/consts because they'll be evaluated by miri anyway - trace!("ConstProp skipped for {:?}", def_id); - return; - } - - // FIXME(welseywiser) const prop doesn't work on coroutines because of query cycles - // computing their layout. - if tcx.is_coroutine(def_id.to_def_id()) { - trace!("ConstProp skipped for coroutine {:?}", def_id); - return; - } - - trace!("ConstProp starting for {:?}", def_id); - - // FIXME(oli-obk, eddyb) Optimize locals (or even local paths) to hold - // constants, instead of just checking for const-folding succeeding. - // That would require a uniform one-def no-mutation analysis - // and RPO (or recursing when needing the value of a local). - let mut optimization_finder = ConstPropagator::new(body, tcx); - - // Traverse the body in reverse post-order, to ensure that `FullConstProp` locals are - // assigned before being read. - for &bb in body.basic_blocks.reverse_postorder() { - let data = &body.basic_blocks[bb]; - optimization_finder.visit_basic_block_data(bb, data); - } - - let mut patch = optimization_finder.patch; - patch.visit_body_preserves_cfg(body); - - trace!("ConstProp done for {:?}", def_id); - } -} - -pub struct ConstPropMachine<'mir, 'tcx> { +pub(crate) struct ConstPropMachine<'mir, 'tcx> { /// The virtual call stack. stack: Vec>, pub written_only_inside_own_block_locals: FxHashSet, @@ -268,300 +205,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine<'mir, 'tcx> } } -/// Finds optimization opportunities on the MIR. -struct ConstPropagator<'mir, 'tcx> { - ecx: InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>, - tcx: TyCtxt<'tcx>, - param_env: ParamEnv<'tcx>, - local_decls: &'mir IndexSlice>, - patch: Patch<'tcx>, -} - -impl<'tcx> LayoutOfHelpers<'tcx> for ConstPropagator<'_, 'tcx> { - type LayoutOfResult = Result, LayoutError<'tcx>>; - - #[inline] - fn handle_layout_err(&self, err: LayoutError<'tcx>, _: Span, _: Ty<'tcx>) -> LayoutError<'tcx> { - err - } -} - -impl HasDataLayout for ConstPropagator<'_, '_> { - #[inline] - fn data_layout(&self) -> &TargetDataLayout { - &self.tcx.data_layout - } -} - -impl<'tcx> ty::layout::HasTyCtxt<'tcx> for ConstPropagator<'_, 'tcx> { - #[inline] - fn tcx(&self) -> TyCtxt<'tcx> { - self.tcx - } -} - -impl<'tcx> ty::layout::HasParamEnv<'tcx> for ConstPropagator<'_, 'tcx> { - #[inline] - fn param_env(&self) -> ty::ParamEnv<'tcx> { - self.param_env - } -} - -impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { - fn new(body: &'mir Body<'tcx>, tcx: TyCtxt<'tcx>) -> ConstPropagator<'mir, 'tcx> { - let def_id = body.source.def_id(); - let args = &GenericArgs::identity_for_item(tcx, def_id); - let param_env = tcx.param_env_reveal_all_normalized(def_id); - - let can_const_prop = CanConstProp::check(tcx, param_env, body); - let mut ecx = InterpCx::new( - tcx, - tcx.def_span(def_id), - param_env, - ConstPropMachine::new(can_const_prop), - ); - - let ret_layout = ecx - .layout_of(body.bound_return_ty().instantiate(tcx, args)) - .ok() - // Don't bother allocating memory for large values. - // I don't know how return types can seem to be unsized but this happens in the - // `type/type-unsatisfiable.rs` test. - .filter(|ret_layout| { - ret_layout.is_sized() && ret_layout.size < Size::from_bytes(MAX_ALLOC_LIMIT) - }) - .unwrap_or_else(|| ecx.layout_of(tcx.types.unit).unwrap()); - - let ret = ecx - .allocate(ret_layout, MemoryKind::Stack) - .expect("couldn't perform small allocation") - .into(); - - ecx.push_stack_frame( - Instance::new(def_id, args), - body, - &ret, - StackPopCleanup::Root { cleanup: false }, - ) - .expect("failed to push initial stack frame"); - - for local in body.local_decls.indices() { - // Mark everything initially live. - // This is somewhat dicey since some of them might be unsized and it is incoherent to - // mark those as live... We rely on `local_to_place`/`local_to_op` in the interpreter - // stopping us before those unsized immediates can cause issues deeper in the - // interpreter. - ecx.frame_mut().locals[local].make_live_uninit(); - } - - let patch = Patch::new(tcx); - ConstPropagator { ecx, tcx, param_env, local_decls: &body.local_decls, patch } - } - - fn get_const(&self, place: Place<'tcx>) -> Option> { - let op = match self.ecx.eval_place_to_op(place, None) { - Ok(op) => { - if op - .as_mplace_or_imm() - .right() - .is_some_and(|imm| matches!(*imm, Immediate::Uninit)) - { - // Make sure nobody accidentally uses this value. - return None; - } - op - } - Err(e) => { - trace!("get_const failed: {:?}", e.into_kind().debug()); - return None; - } - }; - - // Try to read the local as an immediate so that if it is representable as a scalar, we can - // handle it as such, but otherwise, just return the value as is. - Some(match self.ecx.read_immediate_raw(&op) { - Ok(Right(imm)) => imm.into(), - _ => op, - }) - } - - /// Remove `local` from the pool of `Locals`. Allows writing to them, - /// but not reading from them anymore. - fn remove_const(ecx: &mut InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>, local: Local) { - ecx.frame_mut().locals[local].make_live_uninit(); - ecx.machine.written_only_inside_own_block_locals.remove(&local); - } - - fn check_rvalue(&mut self, rvalue: &Rvalue<'tcx>) -> Option<()> { - // Perform any special handling for specific Rvalue types. - // Generally, checks here fall into one of two categories: - // 1. Additional checking to provide useful lints to the user - // - In this case, we will do some validation and then fall through to the - // end of the function which evals the assignment. - // 2. Working around bugs in other parts of the compiler - // - In this case, we'll return `None` from this function to stop evaluation. - match rvalue { - // Do not try creating references (#67862) - Rvalue::AddressOf(_, place) | Rvalue::Ref(_, _, place) => { - trace!("skipping AddressOf | Ref for {:?}", place); - - // This may be creating mutable references or immutable references to cells. - // If that happens, the pointed to value could be mutated via that reference. - // Since we aren't tracking references, the const propagator loses track of what - // value the local has right now. - // Thus, all locals that have their reference taken - // must not take part in propagation. - Self::remove_const(&mut self.ecx, place.local); - - return None; - } - Rvalue::ThreadLocalRef(def_id) => { - trace!("skipping ThreadLocalRef({:?})", def_id); - - return None; - } - // There's no other checking to do at this time. - Rvalue::Aggregate(..) - | Rvalue::Use(..) - | Rvalue::CopyForDeref(..) - | Rvalue::Repeat(..) - | Rvalue::Len(..) - | Rvalue::Cast(..) - | Rvalue::ShallowInitBox(..) - | Rvalue::Discriminant(..) - | Rvalue::NullaryOp(..) - | Rvalue::UnaryOp(..) - | Rvalue::BinaryOp(..) - | Rvalue::CheckedBinaryOp(..) => {} - } - - // FIXME we need to revisit this for #67176 - if rvalue.has_param() { - trace!("skipping, has param"); - return None; - } - if !rvalue - .ty(&self.ecx.frame().body.local_decls, *self.ecx.tcx) - .is_sized(*self.ecx.tcx, self.param_env) - { - // the interpreter doesn't support unsized locals (only unsized arguments), - // but rustc does (in a kinda broken way), so we have to skip them here - return None; - } - - Some(()) - } - - // Attempt to use algebraic identities to eliminate constant expressions - fn eval_rvalue_with_identities( - &mut self, - rvalue: &Rvalue<'tcx>, - place: Place<'tcx>, - ) -> Option<()> { - match rvalue { - Rvalue::BinaryOp(op, box (left, right)) - | Rvalue::CheckedBinaryOp(op, box (left, right)) => { - let l = self.ecx.eval_operand(left, None).and_then(|x| self.ecx.read_immediate(&x)); - let r = - self.ecx.eval_operand(right, None).and_then(|x| self.ecx.read_immediate(&x)); - - let const_arg = match (l, r) { - (Ok(x), Err(_)) | (Err(_), Ok(x)) => x, // exactly one side is known - (Err(_), Err(_)) => return None, // neither side is known - (Ok(_), Ok(_)) => return self.ecx.eval_rvalue_into_place(rvalue, place).ok(), // both sides are known - }; - - if !matches!(const_arg.layout.abi, abi::Abi::Scalar(..)) { - // We cannot handle Scalar Pair stuff. - // No point in calling `eval_rvalue_into_place`, since only one side is known - return None; - } - - let arg_value = const_arg.to_scalar().to_bits(const_arg.layout.size).ok()?; - let dest = self.ecx.eval_place(place).ok()?; - - match op { - BinOp::BitAnd if arg_value == 0 => { - self.ecx.write_immediate(*const_arg, &dest).ok() - } - BinOp::BitOr - if arg_value == const_arg.layout.size.truncate(u128::MAX) - || (const_arg.layout.ty.is_bool() && arg_value == 1) => - { - self.ecx.write_immediate(*const_arg, &dest).ok() - } - BinOp::Mul if const_arg.layout.ty.is_integral() && arg_value == 0 => { - if let Rvalue::CheckedBinaryOp(_, _) = rvalue { - let val = Immediate::ScalarPair( - const_arg.to_scalar(), - Scalar::from_bool(false), - ); - self.ecx.write_immediate(val, &dest).ok() - } else { - self.ecx.write_immediate(*const_arg, &dest).ok() - } - } - _ => None, - } - } - _ => self.ecx.eval_rvalue_into_place(rvalue, place).ok(), - } - } - - fn replace_with_const(&mut self, place: Place<'tcx>) -> Option> { - // This will return None if the above `const_prop` invocation only "wrote" a - // type whose creation requires no write. E.g. a coroutine whose initial state - // consists solely of uninitialized memory (so it doesn't capture any locals). - let value = self.get_const(place)?; - if !self.tcx.consider_optimizing(|| format!("ConstantPropagation - {value:?}")) { - return None; - } - trace!("replacing {:?} with {:?}", place, value); - - // FIXME: figure out what to do when read_immediate_raw fails - let imm = self.ecx.read_immediate_raw(&value).ok()?; - - let Right(imm) = imm else { return None }; - match *imm { - Immediate::Scalar(scalar) if scalar.try_to_int().is_ok() => { - Some(Const::from_scalar(self.tcx, scalar, value.layout.ty)) - } - Immediate::ScalarPair(l, r) if l.try_to_int().is_ok() && r.try_to_int().is_ok() => { - let alloc_id = self - .ecx - .intern_with_temp_alloc(value.layout, |ecx, dest| { - ecx.write_immediate(*imm, dest) - }) - .ok()?; - - Some(Const::Val( - ConstValue::Indirect { alloc_id, offset: Size::ZERO }, - value.layout.ty, - )) - } - // Scalars or scalar pairs that contain undef values are assumed to not have - // successfully evaluated and are thus not propagated. - _ => None, - } - } - - fn ensure_not_propagated(&self, local: Local) { - if cfg!(debug_assertions) { - assert!( - self.get_const(local.into()).is_none() - || self - .layout_of(self.local_decls[local].ty) - .map_or(true, |layout| layout.is_zst()), - "failed to remove values for `{local:?}`, value={:?}", - self.get_const(local.into()), - ) - } - } -} - /// The mode that `ConstProp` is allowed to run in for a given `Local`. #[derive(Clone, Copy, Debug, PartialEq)] -pub enum ConstPropMode { +pub(crate) enum ConstPropMode { /// The `Local` can be propagated into and reads of this `Local` can also be propagated. FullConstProp, /// The `Local` can only be propagated into and from its own block. @@ -571,7 +217,7 @@ pub enum ConstPropMode { NoPropagation, } -pub struct CanConstProp { +pub(crate) struct CanConstProp { can_const_prop: IndexVec, // False at the beginning. Once set, no more assignments are allowed to that local. found_assignment: BitSet, @@ -678,154 +324,3 @@ impl<'tcx> Visitor<'tcx> for CanConstProp { } } } - -impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> { - fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) { - self.super_operand(operand, location); - if let Some(place) = operand.place() - && let Some(value) = self.replace_with_const(place) - { - self.patch.before_effect.insert((location, place), value); - } - } - - fn visit_projection_elem( - &mut self, - _: PlaceRef<'tcx>, - elem: PlaceElem<'tcx>, - _: PlaceContext, - location: Location, - ) { - if let PlaceElem::Index(local) = elem - && let Some(value) = self.replace_with_const(local.into()) - { - self.patch.before_effect.insert((location, local.into()), value); - } - } - - fn visit_assign(&mut self, place: &Place<'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { - self.super_assign(place, rvalue, location); - - let Some(()) = self.check_rvalue(rvalue) else { - trace!("rvalue check failed, removing const"); - Self::remove_const(&mut self.ecx, place.local); - return; - }; - - match self.ecx.machine.can_const_prop[place.local] { - // Do nothing if the place is indirect. - _ if place.is_indirect() => {} - ConstPropMode::NoPropagation => self.ensure_not_propagated(place.local), - ConstPropMode::OnlyInsideOwnBlock | ConstPropMode::FullConstProp => { - if let Some(()) = self.eval_rvalue_with_identities(rvalue, *place) { - // If this was already an evaluated constant, keep it. - if let Rvalue::Use(Operand::Constant(c)) = rvalue - && let Const::Val(..) = c.const_ - { - trace!( - "skipping replace of Rvalue::Use({:?} because it is already a const", - c - ); - } else if let Some(operand) = self.replace_with_const(*place) { - self.patch.assignments.insert(location, operand); - } - } else { - // Const prop failed, so erase the destination, ensuring that whatever happens - // from here on, does not know about the previous value. - // This is important in case we have - // ```rust - // let mut x = 42; - // x = SOME_MUTABLE_STATIC; - // // x must now be uninit - // ``` - // FIXME: we overzealously erase the entire local, because that's easier to - // implement. - trace!( - "propagation into {:?} failed. - Nuking the entire site from orbit, it's the only way to be sure", - place, - ); - Self::remove_const(&mut self.ecx, place.local); - } - } - } - } - - fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) { - trace!("visit_statement: {:?}", statement); - - // We want to evaluate operands before any change to the assigned-to value, - // so we recurse first. - self.super_statement(statement, location); - - match statement.kind { - StatementKind::SetDiscriminant { ref place, .. } => { - match self.ecx.machine.can_const_prop[place.local] { - // Do nothing if the place is indirect. - _ if place.is_indirect() => {} - ConstPropMode::NoPropagation => self.ensure_not_propagated(place.local), - ConstPropMode::FullConstProp | ConstPropMode::OnlyInsideOwnBlock => { - if self.ecx.statement(statement).is_ok() { - trace!("propped discriminant into {:?}", place); - } else { - Self::remove_const(&mut self.ecx, place.local); - } - } - } - } - StatementKind::StorageLive(local) => { - Self::remove_const(&mut self.ecx, local); - } - // We do not need to mark dead locals as such. For `FullConstProp` locals, - // this allows to propagate the single assigned value in this case: - // ``` - // let x = SOME_CONST; - // if a { - // f(copy x); - // StorageDead(x); - // } else { - // g(copy x); - // StorageDead(x); - // } - // ``` - // - // This may propagate a constant where the local would be uninit or dead. - // In both cases, this does not matter, as those reads would be UB anyway. - _ => {} - } - } - - fn visit_basic_block_data(&mut self, block: BasicBlock, data: &BasicBlockData<'tcx>) { - self.super_basic_block_data(block, data); - - // We remove all Locals which are restricted in propagation to their containing blocks and - // which were modified in the current block. - // Take it out of the ecx so we can get a mutable reference to the ecx for `remove_const`. - let mut written_only_inside_own_block_locals = - std::mem::take(&mut self.ecx.machine.written_only_inside_own_block_locals); - - // This loop can get very hot for some bodies: it check each local in each bb. - // To avoid this quadratic behaviour, we only clear the locals that were modified inside - // the current block. - for local in written_only_inside_own_block_locals.drain() { - debug_assert_eq!( - self.ecx.machine.can_const_prop[local], - ConstPropMode::OnlyInsideOwnBlock - ); - Self::remove_const(&mut self.ecx, local); - } - self.ecx.machine.written_only_inside_own_block_locals = - written_only_inside_own_block_locals; - - if cfg!(debug_assertions) { - for (local, &mode) in self.ecx.machine.can_const_prop.iter_enumerated() { - match mode { - ConstPropMode::FullConstProp => {} - ConstPropMode::NoPropagation | ConstPropMode::OnlyInsideOwnBlock => { - self.ensure_not_propagated(local); - } - } - } - } - } -} diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index e9949ebbc873c..37b4c17748aa2 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -24,23 +24,18 @@ use crate::MirPass; // 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; +pub struct ConstProp; -impl<'tcx> MirPass<'tcx> for DataflowConstProp { +impl<'tcx> MirPass<'tcx> for ConstProp { 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 diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 89e897191e852..fc08c70eb9d9c 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -581,16 +581,14 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { // inst combine is after MatchBranchSimplification to clean up Ne(_1, false) &multiple_return_terminators::MultipleReturnTerminators, &instsimplify::InstSimplify, - &simplify::SimplifyLocals::BeforeConstProp, - ©_prop::CopyProp, + &o1(simplify::SimplifyLocals::BeforeConstProp), + &gvn::GVN, + &o1(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, - &const_prop::ConstProp, - &gvn::GVN, - &simplify::SimplifyLocals::AfterGVN, - &dataflow_const_prop::DataflowConstProp, + &dataflow_const_prop::ConstProp, &const_debuginfo::ConstDebugInfo, &o1(simplify_branches::SimplifyConstCondition::AfterConstProp), &jump_threading::JumpThreading, @@ -605,6 +603,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &simplify::SimplifyLocals::Final, &multiple_return_terminators::MultipleReturnTerminators, &deduplicate_blocks::DeduplicateBlocks, + ©_prop::CopyProp, &large_enums::EnumSizeOpt { discrepancy: 128 }, // Some cleanup necessary at least for LLVM and potentially other codegen backends. &add_call_guards::CriticalCallEdges, diff --git a/tests/coverage/async2.cov-map b/tests/coverage/async2.cov-map index 23f26ee4e5f66..4822be65c064c 100644 --- a/tests/coverage/async2.cov-map +++ b/tests/coverage/async2.cov-map @@ -7,19 +7,17 @@ Number of file 0 mappings: 1 - Code(Counter(0)) at (prev + 11, 1) to (start + 0, 23) Function name: async2::async_func::{closure#0} -Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0b, 17, 03, 09, 05, 03, 0a, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02] +Raw bytes (26): 0x[01, 01, 01, 05, 00, 04, 01, 0b, 17, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 03, 01, 01, 00, 02] 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: 1 +- expression 0 operands: lhs = Counter(1), rhs = Zero Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 11, 23) to (start + 3, 9) - Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6) -- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7) - = (c0 - c1) -- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2) - = (c1 + (c0 - c1)) +- Code(Zero) at (prev + 2, 6) to (start + 0, 7) +- Code(Expression(0, Add)) at (prev + 1, 1) to (start + 0, 2) + = (c1 + Zero) Function name: async2::async_func_just_println Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 00, 24] diff --git a/tests/coverage/closure.cov-map b/tests/coverage/closure.cov-map index 522c1e73afe3d..484fbe4ee4e4a 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] @@ -154,20 +150,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/match_or_pattern.cov-map b/tests/coverage/match_or_pattern.cov-map index d63407a99c35f..6c119f8508ffa 100644 --- a/tests/coverage/match_or_pattern.cov-map +++ b/tests/coverage/match_or_pattern.cov-map @@ -1,29 +1,29 @@ 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, 19, 1d, 57, 00, 19, 1d, 53, 25, 57, 00, 19, 1d, 25, 4e, 53, 25, 57, 00, 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, 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, 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] 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 13 operands: lhs = Expression(21, Add), rhs = Zero - expression 14 operands: lhs = Counter(6), rhs = Counter(7) - expression 15 operands: lhs = Expression(20, Add), rhs = Counter(9) -- expression 16 operands: lhs = Expression(21, Add), rhs = Counter(8) +- expression 16 operands: lhs = Expression(21, Add), rhs = Zero - expression 17 operands: lhs = Counter(6), 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 20 operands: lhs = Expression(21, Add), rhs = Zero - expression 21 operands: lhs = Counter(6), rhs = Counter(7) - expression 22 operands: lhs = Counter(10), rhs = Counter(11) - expression 23 operands: lhs = Expression(31, Add), rhs = Counter(12) @@ -45,26 +45,26 @@ 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) - Code(Expression(20, Add)) at (prev + 2, 8) to (start + 0, 15) - = ((c6 + c7) + c8) + = ((c6 + 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) + = (((c6 + c7) + Zero) - c9) - Code(Expression(18, Add)) at (prev + 1, 11) to (start + 0, 17) - = (c9 + (((c6 + c7) + c8) - c9)) + = (c9 + (((c6 + c7) + Zero) - c9)) - Code(Counter(12)) at (prev + 1, 27) to (start + 0, 29) - Code(Expression(31, Add)) at (prev + 1, 14) to (start + 0, 16) = (c10 + c11) diff --git a/tests/coverage/partial_eq.cov-map b/tests/coverage/partial_eq.cov-map index 3549116db7ad3..3a803e3c18fbd 100644 --- a/tests/coverage/partial_eq.cov-map +++ b/tests/coverage/partial_eq.cov-map @@ -25,18 +25,18 @@ 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, 05, 09, 0f, 15, 0d, 11, 02, 01, 04, 27, 00, 28, 03, 00, 30, 00, 31] +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] 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 = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Zero, rhs = Counter(2) - expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5) -- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 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) - = ((c1 + c2) + ((c3 + c4) + c5)) + = ((Zero + c2) + ((Zero + c4) + c5)) 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/incremental/hashes/match_expressions.rs b/tests/incremental/hashes/match_expressions.rs index ecb19480d6547..4d1b3b68330c3 100644 --- a/tests/incremental/hashes/match_expressions.rs +++ b/tests/incremental/hashes/match_expressions.rs @@ -227,7 +227,7 @@ pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { // Ignore optimized_mir in cfail2, the only change to optimized MIR is a span. #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail6")] diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff index 87c07279552f4..bd6ba000c0433 100644 --- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff +++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff @@ -34,7 +34,8 @@ debug f => _10; let _11: std::option::Option; scope 7 { - debug o => _11; +- debug o => _11; ++ debug o => const Option::::Some(99_u16); let _12: Point; scope 8 { - debug p => _12; @@ -79,7 +80,7 @@ StorageLive(_10); _10 = (const true, const false, const 123_u32); StorageLive(_11); - _11 = Option::::Some(const 99_u16); + _11 = const Option::::Some(99_u16); StorageLive(_12); _12 = const Point {{ x: 32_u32, y: 32_u32 }}; StorageLive(_13); @@ -108,3 +109,7 @@ 20 00 00 00 20 00 00 00 │ ... ... } + ALLOC1 (size: 4, align: 2) { + 01 00 63 00 │ ..c. + } + diff --git a/tests/mir-opt/const_debuginfo.rs b/tests/mir-opt/const_debuginfo.rs index 0e5ac4b8bd60d..be10083bf5087 100644 --- a/tests/mir-opt/const_debuginfo.rs +++ b/tests/mir-opt/const_debuginfo.rs @@ -15,7 +15,7 @@ fn main() { // CHECK: debug sum => const 6_u8; // CHECK: debug s => const "hello, world!"; // CHECK: debug f => {{_.*}}; - // CHECK: debug o => {{_.*}}; + // CHECK: debug o => const Option::::Some(99_u16); // CHECK: debug p => const Point // CHECK: debug a => const 64_u32; let x = 1u8; diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff index b2f58f8f771d7..52aedbcc82014 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff @@ -28,7 +28,7 @@ bb1: { - _1 = _2[_3]; -+ _1 = const 2_u32; ++ _1 = _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff index f9e3f8f171ad4..a44c95b918227 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff @@ -28,7 +28,7 @@ bb1: { - _1 = _2[_3]; -+ _1 = const 2_u32; ++ _1 = _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff index b2f58f8f771d7..52aedbcc82014 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff @@ -28,7 +28,7 @@ bb1: { - _1 = _2[_3]; -+ _1 = const 2_u32; ++ _1 = _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff index f9e3f8f171ad4..a44c95b918227 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff @@ -28,7 +28,7 @@ bb1: { - _1 = _2[_3]; -+ _1 = const 2_u32; ++ _1 = _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff index e443c8991f9a6..54b9b6cc0d467 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff @@ -34,11 +34,12 @@ StorageLive(_5); StorageLive(_6); _6 = const 3_usize; - _7 = Len((*_1)); +- _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: bb1, unwind unreachable]; -+ _8 = Lt(const 3_usize, _7); -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable]; ++ _7 = const 3_usize; ++ _8 = const false; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff index 592f43f473979..483ad8012c29b 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff @@ -34,11 +34,12 @@ StorageLive(_5); StorageLive(_6); _6 = const 3_usize; - _7 = Len((*_1)); +- _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: bb1, unwind continue]; -+ _8 = Lt(const 3_usize, _7); -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue]; ++ _7 = const 3_usize; ++ _8 = const false; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff index e443c8991f9a6..54b9b6cc0d467 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff @@ -34,11 +34,12 @@ StorageLive(_5); StorageLive(_6); _6 = const 3_usize; - _7 = Len((*_1)); +- _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: bb1, unwind unreachable]; -+ _8 = Lt(const 3_usize, _7); -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable]; ++ _7 = const 3_usize; ++ _8 = const false; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff index 592f43f473979..483ad8012c29b 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff @@ -34,11 +34,12 @@ StorageLive(_5); StorageLive(_6); _6 = const 3_usize; - _7 = Len((*_1)); +- _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: bb1, unwind continue]; -+ _8 = Lt(const 3_usize, _7); -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue]; ++ _7 = const 3_usize; ++ _8 = const false; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff b/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff index d805341991d83..56f3e09e6b8dd 100644 --- a/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff +++ b/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff @@ -7,19 +7,17 @@ let mut _0: bool; let mut _3: bool; let mut _4: bool; - let mut _5: bool; - let mut _6: bool; bb0: { StorageLive(_3); - _3 = BitOr(_2, const true); + _3 = const true; - StorageLive(_5); -- _5 = BitAnd(_1, const false); -- _0 = BitAnd(move _3, move _5); -+ _5 = const false; + StorageLive(_4); +- _4 = BitAnd(_1, const false); +- _0 = BitAnd(move _3, move _4); ++ _4 = const false; + _0 = const false; - StorageDead(_5); + StorageDead(_4); StorageDead(_3); return; } diff --git a/tests/mir-opt/const_prop/cast.main.ConstProp.diff b/tests/mir-opt/const_prop/cast.main.ConstProp.diff index c63adcf1191e0..fb2f31db1c14e 100644 --- a/tests/mir-opt/const_prop/cast.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/cast.main.ConstProp.diff @@ -4,11 +4,21 @@ fn main() -> () { let mut _0: (); let _1: u32; + let mut _5: u8; + let mut _6: i32; scope 1 { debug x => _1; let _2: u8; scope 2 { debug y => _2; + let _3: i32; + scope 3 { + debug a => _3; + let _4: u8; + scope 4 { + debug b => _4; + } + } } } @@ -19,7 +29,22 @@ StorageLive(_2); - _2 = const 42_u32 as u8 (IntToInt); + _2 = const 42_u8; + StorageLive(_3); + _3 = const 257_i32; + StorageLive(_4); + StorageLive(_5); + StorageLive(_6); +- _6 = _3; +- _5 = move _6 as u8 (IntToInt); ++ _6 = const 257_i32; ++ _5 = const 1_u8; + StorageDead(_6); +- _4 = Add(move _5, const 1_u8); ++ _4 = const 2_u8; + StorageDead(_5); _0 = const (); + StorageDead(_4); + StorageDead(_3); StorageDead(_2); StorageDead(_1); return; diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs index 3d543badace1e..60e08dda54b1b 100644 --- a/tests/mir-opt/const_prop/cast.rs +++ b/tests/mir-opt/const_prop/cast.rs @@ -4,6 +4,8 @@ fn main() { let x = 42u8 as u32; - let y = 42u32 as u8; + + let a = 257; + let b = a as u8 + 1; } diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/const_prop/checked.main.ConstProp.panic-abort.diff similarity index 96% rename from tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff rename to tests/mir-opt/const_prop/checked.main.ConstProp.panic-abort.diff index 4569ffe483b38..3265ba0bc17ba 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/checked.main.ConstProp.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/checked.main.ConstProp.panic-unwind.diff similarity index 96% rename from tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff rename to tests/mir-opt/const_prop/checked.main.ConstProp.panic-unwind.diff index aa7e404eb9f50..52890cb8a5234 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/checked.main.ConstProp.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/checked.rs b/tests/mir-opt/const_prop/checked.rs similarity index 74% rename from tests/mir-opt/dataflow-const-prop/checked.rs rename to tests/mir-opt/const_prop/checked.rs index f7fac8890a057..81658418299bb 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.rs +++ b/tests/mir-opt/const_prop/checked.rs @@ -1,9 +1,9 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp // compile-flags: -Coverflow-checks=on // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// EMIT_MIR checked.main.DataflowConstProp.diff +// EMIT_MIR checked.main.ConstProp.diff #[allow(arithmetic_overflow)] fn main() { let a = 1; diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_prop/const_allocation.main.ConstProp.after.32bit.mir similarity index 100% rename from tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir rename to tests/mir-opt/const_prop/const_allocation.main.ConstProp.after.32bit.mir diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_prop/const_allocation.main.ConstProp.after.64bit.mir similarity index 100% rename from tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir rename to tests/mir-opt/const_prop/const_allocation.main.ConstProp.after.64bit.mir diff --git a/tests/mir-opt/const_allocation.rs b/tests/mir-opt/const_prop/const_allocation.rs similarity index 100% rename from tests/mir-opt/const_allocation.rs rename to tests/mir-opt/const_prop/const_allocation.rs diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_prop/const_allocation2.main.ConstProp.after.32bit.mir similarity index 100% rename from tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir rename to tests/mir-opt/const_prop/const_allocation2.main.ConstProp.after.32bit.mir diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_prop/const_allocation2.main.ConstProp.after.64bit.mir similarity index 100% rename from tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir rename to tests/mir-opt/const_prop/const_allocation2.main.ConstProp.after.64bit.mir diff --git a/tests/mir-opt/const_allocation2.rs b/tests/mir-opt/const_prop/const_allocation2.rs similarity index 100% rename from tests/mir-opt/const_allocation2.rs rename to tests/mir-opt/const_prop/const_allocation2.rs diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_prop/const_allocation3.main.ConstProp.after.32bit.mir similarity index 100% rename from tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir rename to tests/mir-opt/const_prop/const_allocation3.main.ConstProp.after.32bit.mir diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_prop/const_allocation3.main.ConstProp.after.64bit.mir similarity index 100% rename from tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir rename to tests/mir-opt/const_prop/const_allocation3.main.ConstProp.after.64bit.mir diff --git a/tests/mir-opt/const_allocation3.rs b/tests/mir-opt/const_prop/const_allocation3.rs similarity index 100% rename from tests/mir-opt/const_allocation3.rs rename to tests/mir-opt/const_prop/const_allocation3.rs diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff index ba2e89f0a7445..e77c09848b7b8 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff @@ -8,9 +8,8 @@ bb0: { StorageLive(_1); -- _1 = const _; + _1 = const _; - switchInt(move _1) -> [0: bb2, otherwise: bb1]; -+ _1 = const false; + switchInt(const false) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff index e0a610f60a795..7496d25430977 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff @@ -8,9 +8,8 @@ bb0: { StorageLive(_1); -- _1 = const _; + _1 = const _; - switchInt(move _1) -> [0: bb2, otherwise: bb1]; -+ _1 = const false; + switchInt(const false) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff similarity index 60% rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff rename to tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff index ddfe2e8c83119..4cde3d09e6556 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); @@ -11,34 +11,36 @@ scope 2 (inlined as Default>::default) { let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; + let mut _5: std::ptr::Unique<[bool]>; scope 3 { debug ptr => _3; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; + let mut _6: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _7: usize; + let mut _8: usize; scope 6 { - let _6: *mut [bool; 0]; + let _7: *mut [bool; 0]; scope 7 { - debug ptr => _6; + debug ptr => _7; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: *const [bool; 0]; + debug ptr => _7; + let mut _9: *const [bool; 0]; + let mut _10: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _6; + debug ptr => _10; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _6; - let mut _9: *mut u8; + debug self => _10; + let mut _11: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _9; + debug ptr => _11; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _9; + debug self => _11; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _9; + debug self => _11; } } } @@ -52,7 +54,7 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; + debug addr => _8; scope 10 { } } @@ -65,27 +67,34 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); StorageLive(_5); + StorageLive(_4); StorageLive(_6); StorageLive(_7); - _7 = const 1_usize; - _6 = const {0x1 as *mut [bool; 0]}; - StorageDead(_7); StorageLive(_8); +- _8 = AlignOf([bool; 0]); +- _7 = _8 as *mut [bool; 0] (Transmute); ++ _8 = const 1_usize; ++ _7 = const {0x1 as *mut [bool; 0]}; + StorageDead(_8); StorageLive(_9); - _8 = const {0x1 as *const [bool; 0]}; - _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageLive(_10); + StorageLive(_11); +- _9 = _7 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); ++ _9 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _6 = NonNull::<[bool; 0]> { pointer: _9 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_9); - StorageDead(_8); + StorageDead(_7); + _4 = Unique::<[bool; 0]> { pointer: move _6, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_6); - _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; - StorageDead(_5); - _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; + _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); - _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); + _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_5); StorageDead(_3); - _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }; + _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; @@ -97,15 +106,3 @@ } } - 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/const_prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff similarity index 60% rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff rename to tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff index 861295faa5a16..584cc207fc5cb 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); @@ -11,34 +11,36 @@ scope 2 (inlined as Default>::default) { let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; + let mut _5: std::ptr::Unique<[bool]>; scope 3 { debug ptr => _3; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; + let mut _6: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _7: usize; + let mut _8: usize; scope 6 { - let _6: *mut [bool; 0]; + let _7: *mut [bool; 0]; scope 7 { - debug ptr => _6; + debug ptr => _7; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: *const [bool; 0]; + debug ptr => _7; + let mut _9: *const [bool; 0]; + let mut _10: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _6; + debug ptr => _10; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _6; - let mut _9: *mut u8; + debug self => _10; + let mut _11: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _9; + debug ptr => _11; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _9; + debug self => _11; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _9; + debug self => _11; } } } @@ -52,7 +54,7 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; + debug addr => _8; scope 10 { } } @@ -65,27 +67,34 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); StorageLive(_5); + StorageLive(_4); StorageLive(_6); StorageLive(_7); - _7 = const 1_usize; - _6 = const {0x1 as *mut [bool; 0]}; - StorageDead(_7); StorageLive(_8); +- _8 = AlignOf([bool; 0]); +- _7 = _8 as *mut [bool; 0] (Transmute); ++ _8 = const 1_usize; ++ _7 = const {0x1 as *mut [bool; 0]}; + StorageDead(_8); StorageLive(_9); - _8 = const {0x1 as *const [bool; 0]}; - _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageLive(_10); + StorageLive(_11); +- _9 = _7 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); ++ _9 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _6 = NonNull::<[bool; 0]> { pointer: _9 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_9); - StorageDead(_8); + StorageDead(_7); + _4 = Unique::<[bool; 0]> { pointer: move _6, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_6); - _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; - StorageDead(_5); - _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; + _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); - _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); + _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_5); StorageDead(_3); - _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }; + _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; @@ -101,15 +110,3 @@ } } - 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/const_prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff similarity index 59% rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff rename to tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff index cbb639edc53a6..4cde3d09e6556 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); @@ -11,34 +11,36 @@ scope 2 (inlined as Default>::default) { let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; + let mut _5: std::ptr::Unique<[bool]>; scope 3 { debug ptr => _3; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; + let mut _6: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _7: usize; + let mut _8: usize; scope 6 { - let _6: *mut [bool; 0]; + let _7: *mut [bool; 0]; scope 7 { - debug ptr => _6; + debug ptr => _7; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: *const [bool; 0]; + debug ptr => _7; + let mut _9: *const [bool; 0]; + let mut _10: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _6; + debug ptr => _10; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _6; - let mut _9: *mut u8; + debug self => _10; + let mut _11: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _9; + debug ptr => _11; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _9; + debug self => _11; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _9; + debug self => _11; } } } @@ -52,7 +54,7 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; + debug addr => _8; scope 10 { } } @@ -65,27 +67,34 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); StorageLive(_5); + StorageLive(_4); StorageLive(_6); StorageLive(_7); - _7 = const 1_usize; - _6 = const {0x1 as *mut [bool; 0]}; - StorageDead(_7); StorageLive(_8); +- _8 = AlignOf([bool; 0]); +- _7 = _8 as *mut [bool; 0] (Transmute); ++ _8 = const 1_usize; ++ _7 = const {0x1 as *mut [bool; 0]}; + StorageDead(_8); StorageLive(_9); - _8 = const {0x1 as *const [bool; 0]}; - _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageLive(_10); + StorageLive(_11); +- _9 = _7 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); ++ _9 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _6 = NonNull::<[bool; 0]> { pointer: _9 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_9); - StorageDead(_8); + StorageDead(_7); + _4 = Unique::<[bool; 0]> { pointer: move _6, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_6); - _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; - StorageDead(_5); - _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; + _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); - _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); + _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_5); StorageDead(_3); - _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }; + _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; @@ -97,15 +106,3 @@ } } - 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/const_prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff similarity index 60% rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff rename to tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff index 656846e9f976c..584cc207fc5cb 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); @@ -11,34 +11,36 @@ scope 2 (inlined as Default>::default) { let _3: std::ptr::Unique<[bool]>; let mut _4: std::ptr::Unique<[bool; 0]>; + let mut _5: std::ptr::Unique<[bool]>; scope 3 { debug ptr => _3; } scope 4 (inlined Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; + let mut _6: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _7: usize; + let mut _8: usize; scope 6 { - let _6: *mut [bool; 0]; + let _7: *mut [bool; 0]; scope 7 { - debug ptr => _6; + debug ptr => _7; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: *const [bool; 0]; + debug ptr => _7; + let mut _9: *const [bool; 0]; + let mut _10: *mut [bool; 0]; scope 12 { scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _6; + debug ptr => _10; scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _6; - let mut _9: *mut u8; + debug self => _10; + let mut _11: *mut u8; scope 15 { scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _9; + debug ptr => _11; scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _9; + debug self => _11; scope 18 { scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _9; + debug self => _11; } } } @@ -52,7 +54,7 @@ scope 8 (inlined align_of::<[bool; 0]>) { } scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; + debug addr => _8; scope 10 { } } @@ -65,27 +67,34 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); StorageLive(_5); + StorageLive(_4); StorageLive(_6); StorageLive(_7); - _7 = const 1_usize; - _6 = const {0x1 as *mut [bool; 0]}; - StorageDead(_7); StorageLive(_8); +- _8 = AlignOf([bool; 0]); +- _7 = _8 as *mut [bool; 0] (Transmute); ++ _8 = const 1_usize; ++ _7 = const {0x1 as *mut [bool; 0]}; + StorageDead(_8); StorageLive(_9); - _8 = const {0x1 as *const [bool; 0]}; - _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageLive(_10); + StorageLive(_11); +- _9 = _7 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); ++ _9 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _6 = NonNull::<[bool; 0]> { pointer: _9 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_9); - StorageDead(_8); + StorageDead(_7); + _4 = Unique::<[bool; 0]> { pointer: move _6, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_6); - _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; - StorageDead(_5); - _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; + _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); - _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); + _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_5); StorageDead(_3); - _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }; + _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; @@ -101,15 +110,3 @@ } } - 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.rs b/tests/mir-opt/const_prop/default_boxed_slice.rs similarity index 69% rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs rename to tests/mir-opt/const_prop/default_boxed_slice.rs index 1bb052736c05d..13948b2a199ce 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs +++ b/tests/mir-opt/const_prop/default_boxed_slice.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp // compile-flags: -Zmir-enable-passes=+ConstProp,+Inline // ignore-debug assertions change the output MIR // EMIT_MIR_FOR_EACH_BIT_WIDTH @@ -10,9 +10,8 @@ struct A { } // EMIT_MIR default_boxed_slice.main.ConstProp.diff -// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff fn main() { // ConstProp will create a constant of type `Box<[bool]>`. - // Verify that `DataflowConstProp` does not ICE trying to dereference it directly. + // Verify that `ConstProp` does not ICE trying to dereference it directly. let a: A = A { foo: Box::default() }; } diff --git a/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index e02e7f320b865..33055118541f9 100644 --- a/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -41,12 +41,17 @@ } bb4: { - _1 = Add(move _2, const 0_i32); +- _1 = Add(move _2, const 0_i32); ++ _1 = const 42_i32; StorageDead(_2); StorageDead(_3); _0 = const (); StorageDead(_1); return; } ++ } ++ ++ ALLOC0 (size: 1, align: 1) { ++ 01 │ . } diff --git a/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index e02e7f320b865..33055118541f9 100644 --- a/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -41,12 +41,17 @@ } bb4: { - _1 = Add(move _2, const 0_i32); +- _1 = Add(move _2, const 0_i32); ++ _1 = const 42_i32; StorageDead(_2); StorageDead(_3); _0 = const (); StorageDead(_1); return; } ++ } ++ ++ ALLOC0 (size: 1, align: 1) { ++ 01 │ . } diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff b/tests/mir-opt/const_prop/enum.constant.ConstProp.32bit.diff similarity index 92% rename from tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff rename to tests/mir-opt/const_prop/enum.constant.ConstProp.32bit.diff index 07ac5b72e244c..e28aed11cfc0f 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/enum.constant.ConstProp.32bit.diff @@ -1,5 +1,5 @@ -- // MIR for `constant` before DataflowConstProp -+ // MIR for `constant` after DataflowConstProp +- // MIR for `constant` before ConstProp ++ // MIR for `constant` after ConstProp fn constant() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff b/tests/mir-opt/const_prop/enum.constant.ConstProp.64bit.diff similarity index 92% rename from tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff rename to tests/mir-opt/const_prop/enum.constant.ConstProp.64bit.diff index 07ac5b72e244c..e28aed11cfc0f 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/enum.constant.ConstProp.64bit.diff @@ -1,5 +1,5 @@ -- // MIR for `constant` before DataflowConstProp -+ // MIR for `constant` after DataflowConstProp +- // MIR for `constant` before ConstProp ++ // MIR for `constant` after ConstProp fn constant() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff b/tests/mir-opt/const_prop/enum.multiple.ConstProp.32bit.diff similarity index 94% rename from tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff rename to tests/mir-opt/const_prop/enum.multiple.ConstProp.32bit.diff index 775325c4d0626..f71587efe576c 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/enum.multiple.ConstProp.32bit.diff @@ -1,5 +1,5 @@ -- // MIR for `multiple` before DataflowConstProp -+ // MIR for `multiple` after DataflowConstProp +- // MIR for `multiple` before ConstProp ++ // MIR for `multiple` after ConstProp fn multiple(_1: bool, _2: u8) -> () { debug x => _1; diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff b/tests/mir-opt/const_prop/enum.multiple.ConstProp.64bit.diff similarity index 94% rename from tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff rename to tests/mir-opt/const_prop/enum.multiple.ConstProp.64bit.diff index 775325c4d0626..f71587efe576c 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/enum.multiple.ConstProp.64bit.diff @@ -1,5 +1,5 @@ -- // MIR for `multiple` before DataflowConstProp -+ // MIR for `multiple` after DataflowConstProp +- // MIR for `multiple` before ConstProp ++ // MIR for `multiple` after ConstProp fn multiple(_1: bool, _2: u8) -> () { debug x => _1; diff --git a/tests/mir-opt/const_prop/enum.multiple.ConstProp.diff b/tests/mir-opt/const_prop/enum.multiple.ConstProp.diff new file mode 100644 index 0000000000000..f71587efe576c --- /dev/null +++ b/tests/mir-opt/const_prop/enum.multiple.ConstProp.diff @@ -0,0 +1,82 @@ +- // MIR for `multiple` before ConstProp ++ // MIR for `multiple` after ConstProp + + fn multiple(_1: bool, _2: u8) -> () { + debug x => _1; + debug i => _2; + let mut _0: (); + let _3: std::option::Option; + let mut _4: bool; + let mut _5: u8; + let mut _7: isize; + scope 1 { + debug e => _3; + let _6: u8; + let _8: u8; + scope 2 { + debug x => _6; + let _9: u8; + scope 4 { + debug y => _9; + } + } + scope 3 { + debug i => _8; + } + } + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + switchInt(move _4) -> [0: bb2, otherwise: bb1]; + } + + bb1: { + StorageLive(_5); + _5 = _2; + _3 = Option::::Some(move _5); + StorageDead(_5); + goto -> bb3; + } + + bb2: { + _3 = Option::::None; + goto -> bb3; + } + + bb3: { + StorageDead(_4); + StorageLive(_6); + _7 = discriminant(_3); + switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5]; + } + + bb4: { + _6 = const 0_u8; + goto -> bb7; + } + + bb5: { + unreachable; + } + + bb6: { + StorageLive(_8); + _8 = ((_3 as Some).0: u8); + _6 = _8; + StorageDead(_8); + goto -> bb7; + } + + bb7: { + StorageLive(_9); + _9 = _6; + _0 = const (); + StorageDead(_9); + StorageDead(_6); + StorageDead(_3); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff b/tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.32bit.diff similarity index 80% rename from tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff rename to tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.32bit.diff index 960e69ee9165e..8761a4d2cbbb9 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.32bit.diff @@ -1,5 +1,5 @@ -- // MIR for `mutate_discriminant` before DataflowConstProp -+ // MIR for `mutate_discriminant` after DataflowConstProp +- // MIR for `mutate_discriminant` before ConstProp ++ // MIR for `mutate_discriminant` after ConstProp fn mutate_discriminant() -> u8 { let mut _0: u8; diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff b/tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.64bit.diff similarity index 80% rename from tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff rename to tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.64bit.diff index 960e69ee9165e..8761a4d2cbbb9 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.64bit.diff @@ -1,5 +1,5 @@ -- // MIR for `mutate_discriminant` before DataflowConstProp -+ // MIR for `mutate_discriminant` after DataflowConstProp +- // MIR for `mutate_discriminant` before ConstProp ++ // MIR for `mutate_discriminant` after ConstProp fn mutate_discriminant() -> u8 { let mut _0: u8; diff --git a/tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.diff b/tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.diff new file mode 100644 index 0000000000000..8761a4d2cbbb9 --- /dev/null +++ b/tests/mir-opt/const_prop/enum.mutate_discriminant.ConstProp.diff @@ -0,0 +1,26 @@ +- // MIR for `mutate_discriminant` before ConstProp ++ // MIR for `mutate_discriminant` after ConstProp + + fn mutate_discriminant() -> u8 { + let mut _0: u8; + let mut _1: std::option::Option; + let mut _2: isize; + + bb0: { + discriminant(_1) = 1; + (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize; + _2 = discriminant(_1); + switchInt(_2) -> [0: bb1, otherwise: bb2]; + } + + bb1: { + _0 = const 1_u8; + return; + } + + bb2: { + _0 = const 2_u8; + unreachable; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/const_prop/enum.rs similarity index 86% rename from tests/mir-opt/dataflow-const-prop/enum.rs rename to tests/mir-opt/const_prop/enum.rs index e35c0e6e85bed..e244fa63eb416 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.rs +++ b/tests/mir-opt/const_prop/enum.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH #![feature(custom_mir, core_intrinsics, rustc_attrs)] @@ -12,20 +12,20 @@ enum E { V2(i32) } -// EMIT_MIR enum.simple.DataflowConstProp.diff +// EMIT_MIR enum.simple.ConstProp.diff fn simple() { let e = E::V1(0); let x = match e { E::V1(x) => x, E::V2(x) => x }; } -// EMIT_MIR enum.constant.DataflowConstProp.diff +// EMIT_MIR enum.constant.ConstProp.diff fn constant() { const C: E = E::V1(0); let e = C; let x = match e { E::V1(x) => x, E::V2(x) => x }; } -// EMIT_MIR enum.statics.DataflowConstProp.diff +// EMIT_MIR enum.statics.ConstProp.diff fn statics() { static C: E = E::V1(0); let e = C; @@ -40,7 +40,7 @@ fn statics() { #[rustc_nonnull_optimization_guaranteed] struct NonZeroUsize(usize); -// EMIT_MIR enum.mutate_discriminant.DataflowConstProp.diff +// EMIT_MIR enum.mutate_discriminant.ConstProp.diff #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn mutate_discriminant() -> u8 { mir!( @@ -67,7 +67,7 @@ fn mutate_discriminant() -> u8 { ) } -// EMIT_MIR enum.multiple.DataflowConstProp.diff +// EMIT_MIR enum.multiple.ConstProp.diff fn multiple(x: bool, i: u8) { let e = if x { Some(i) diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff b/tests/mir-opt/const_prop/enum.simple.ConstProp.32bit.diff similarity index 93% rename from tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff rename to tests/mir-opt/const_prop/enum.simple.ConstProp.32bit.diff index 798b0c041b4ec..f3e75ee4b60dc 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/enum.simple.ConstProp.32bit.diff @@ -1,5 +1,5 @@ -- // MIR for `simple` before DataflowConstProp -+ // MIR for `simple` after DataflowConstProp +- // MIR for `simple` before ConstProp ++ // MIR for `simple` after ConstProp fn simple() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff b/tests/mir-opt/const_prop/enum.simple.ConstProp.64bit.diff similarity index 93% rename from tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff rename to tests/mir-opt/const_prop/enum.simple.ConstProp.64bit.diff index 798b0c041b4ec..f3e75ee4b60dc 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/enum.simple.ConstProp.64bit.diff @@ -1,5 +1,5 @@ -- // MIR for `simple` before DataflowConstProp -+ // MIR for `simple` after DataflowConstProp +- // MIR for `simple` before ConstProp ++ // MIR for `simple` after ConstProp fn simple() -> () { let mut _0: (); diff --git a/tests/mir-opt/const_prop/enum.simple.ConstProp.diff b/tests/mir-opt/const_prop/enum.simple.ConstProp.diff new file mode 100644 index 0000000000000..f3e75ee4b60dc --- /dev/null +++ b/tests/mir-opt/const_prop/enum.simple.ConstProp.diff @@ -0,0 +1,68 @@ +- // MIR for `simple` before ConstProp ++ // MIR for `simple` after ConstProp + + fn simple() -> () { + let mut _0: (); + let _1: E; + let mut _3: isize; + scope 1 { + debug e => _1; + let _2: i32; + let _4: i32; + let _5: i32; + scope 2 { + debug x => _2; + } + scope 3 { + debug x => _4; + } + scope 4 { + debug x => _5; + } + } + + bb0: { + StorageLive(_1); +- _1 = E::V1(const 0_i32); ++ _1 = const E::V1(0_i32); + StorageLive(_2); +- _3 = discriminant(_1); +- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; ++ _3 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; + } + + bb1: { + StorageLive(_5); + _5 = ((_1 as V2).0: i32); + _2 = _5; + StorageDead(_5); + goto -> bb4; + } + + bb2: { + unreachable; + } + + bb3: { + StorageLive(_4); +- _4 = ((_1 as V1).0: i32); +- _2 = _4; ++ _4 = const 0_i32; ++ _2 = const 0_i32; + StorageDead(_4); + goto -> bb4; + } + + bb4: { + _0 = const (); + StorageDead(_2); + StorageDead(_1); + return; + } ++ } ++ ++ ALLOC0 (size: 8, align: 4) { ++ 00 00 00 00 00 00 00 00 │ ........ + } + diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff b/tests/mir-opt/const_prop/enum.statics.ConstProp.32bit.diff similarity index 96% rename from tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff rename to tests/mir-opt/const_prop/enum.statics.ConstProp.32bit.diff index 053981abea3ec..5987634121247 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/enum.statics.ConstProp.32bit.diff @@ -1,5 +1,5 @@ -- // MIR for `statics` before DataflowConstProp -+ // MIR for `statics` after DataflowConstProp +- // MIR for `statics` before ConstProp ++ // MIR for `statics` after ConstProp fn statics() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff b/tests/mir-opt/const_prop/enum.statics.ConstProp.64bit.diff similarity index 96% rename from tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff rename to tests/mir-opt/const_prop/enum.statics.ConstProp.64bit.diff index d862bd93ff577..6bc735bd6876a 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/enum.statics.ConstProp.64bit.diff @@ -1,5 +1,5 @@ -- // MIR for `statics` before DataflowConstProp -+ // MIR for `statics` after DataflowConstProp +- // MIR for `statics` before ConstProp ++ // MIR for `statics` after ConstProp fn statics() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff b/tests/mir-opt/const_prop/if.main.ConstProp.diff similarity index 96% rename from tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff rename to tests/mir-opt/const_prop/if.main.ConstProp.diff index 355f28b03db53..14dbb170ac6e9 100644 --- a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff +++ b/tests/mir-opt/const_prop/if.main.ConstProp.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/if.rs b/tests/mir-opt/const_prop/if.rs similarity index 69% rename from tests/mir-opt/dataflow-const-prop/if.rs rename to tests/mir-opt/const_prop/if.rs index 72aabbccf56c8..4c24ede7edd16 100644 --- a/tests/mir-opt/dataflow-const-prop/if.rs +++ b/tests/mir-opt/const_prop/if.rs @@ -1,7 +1,7 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp -// EMIT_MIR if.main.DataflowConstProp.diff +// EMIT_MIR if.main.ConstProp.diff fn main() { let a = 1; let b = if a == 1 { 2 } else { 3 }; diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff index 11cdf9e09db0c..65eae0d41434e 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff @@ -11,7 +11,9 @@ scope 2 (inlined #[track_caller] ::add) { debug self => _2; debug other => _3; - let mut _4: (u8, bool); + let mut _4: u8; + let mut _5: u8; + let mut _6: (u8, bool); } bb0: { @@ -21,15 +23,19 @@ StorageLive(_3); _3 = const 1_u8; StorageLive(_4); -- _4 = CheckedAdd(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; -+ _4 = const (0_u8, true); + StorageLive(_5); + StorageLive(_6); +- _6 = CheckedAdd(_2, _3); +- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; ++ _6 = const (0_u8, true); + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = move (_4.0: u8); +- _1 = move (_6.0: u8); + _1 = const 0_u8; + StorageDead(_6); + StorageDead(_5); StorageDead(_4); StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff index 181a2f287d66a..f20816ac08978 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff @@ -11,7 +11,9 @@ scope 2 (inlined #[track_caller] ::add) { debug self => _2; debug other => _3; - let mut _4: (u8, bool); + let mut _4: u8; + let mut _5: u8; + let mut _6: (u8, bool); } bb0: { @@ -21,15 +23,19 @@ StorageLive(_3); _3 = const 1_u8; StorageLive(_4); -- _4 = CheckedAdd(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; -+ _4 = const (0_u8, true); + StorageLive(_5); + StorageLive(_6); +- _6 = CheckedAdd(_2, _3); +- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; ++ _6 = const (0_u8, true); + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue]; } bb1: { -- _1 = move (_4.0: u8); +- _1 = move (_6.0: u8); + _1 = const 0_u8; + StorageDead(_6); + StorageDead(_5); StorageDead(_4); StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff index 10e978a683acc..90adb07103d0d 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff @@ -35,17 +35,14 @@ StorageLive(_1); StorageLive(_2); _2 = InvalidChar { int: const 1114113_u32 }; -- _1 = (_2.1: char); -+ _1 = const {transmute(0x00110001): char}; + _1 = (_2.1: char); StorageDead(_2); StorageLive(_3); StorageLive(_4); StorageLive(_5); _5 = InvalidTag { int: const 4_u32 }; -- _4 = (_5.1: E); -- _3 = [move _4]; -+ _4 = const Scalar(0x00000004): E; -+ _3 = [const Scalar(0x00000004): E]; + _4 = (_5.1: E); + _3 = [move _4]; StorageDead(_4); StorageDead(_5); nop; diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff index 6484b4b67af95..516f13586d3ff 100644 --- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff @@ -8,23 +8,13 @@ bb0: { StorageLive(_2); -- _2 = (const (), const 0_u8, const 0_u8); -- _1 = encode(move _2) -> [return: bb1, unwind unreachable]; -+ _2 = const ((), 0_u8, 0_u8); -+ _1 = encode(const ((), 0_u8, 0_u8)) -> [return: bb1, unwind unreachable]; + _2 = (const (), const 0_u8, const 0_u8); + _1 = encode(move _2) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_2); return; } -+ } -+ -+ ALLOC0 (size: 2, align: 1) { -+ 00 00 │ .. -+ } -+ -+ ALLOC1 (size: 2, align: 1) { -+ 00 00 │ .. } diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff index b02f040783985..5e3443228cd25 100644 --- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff @@ -8,23 +8,13 @@ bb0: { StorageLive(_2); -- _2 = (const (), const 0_u8, const 0_u8); -- _1 = encode(move _2) -> [return: bb1, unwind continue]; -+ _2 = const ((), 0_u8, 0_u8); -+ _1 = encode(const ((), 0_u8, 0_u8)) -> [return: bb1, unwind continue]; + _2 = (const (), const 0_u8, const 0_u8); + _1 = encode(move _2) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_2); return; } -+ } -+ -+ ALLOC0 (size: 2, align: 1) { -+ 00 00 │ .. -+ } -+ -+ ALLOC1 (size: 2, align: 1) { -+ 00 00 │ .. } diff --git a/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff b/tests/mir-opt/const_prop/issue_81605.f.ConstProp.diff similarity index 88% rename from tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff rename to tests/mir-opt/const_prop/issue_81605.f.ConstProp.diff index 3f65d3fff7e4b..c5e37b43aa88b 100644 --- a/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff +++ b/tests/mir-opt/const_prop/issue_81605.f.ConstProp.diff @@ -1,5 +1,5 @@ -- // MIR for `f` before DataflowConstProp -+ // MIR for `f` after DataflowConstProp +- // MIR for `f` before ConstProp ++ // MIR for `f` after ConstProp fn f() -> usize { let mut _0: usize; diff --git a/tests/mir-opt/dataflow-const-prop/issue_81605.rs b/tests/mir-opt/const_prop/issue_81605.rs similarity index 54% rename from tests/mir-opt/dataflow-const-prop/issue_81605.rs rename to tests/mir-opt/const_prop/issue_81605.rs index 7c5eceb8a2b68..7d7de9841c5aa 100644 --- a/tests/mir-opt/dataflow-const-prop/issue_81605.rs +++ b/tests/mir-opt/const_prop/issue_81605.rs @@ -1,7 +1,7 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp -// EMIT_MIR issue_81605.f.DataflowConstProp.diff +// EMIT_MIR issue_81605.f.ConstProp.diff fn f() -> usize { 1 + if true { 1 } else { 2 } } diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff index 768970a7250f0..1337573c9942e 100644 --- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff @@ -58,16 +58,20 @@ StorageDead(_4); StorageLive(_5); StorageLive(_6); - _6 = OffsetOf(Delta, [(0, 1)]); - _5 = must_use::(move _6) -> [return: bb3, unwind unreachable]; +- _6 = OffsetOf(Delta, [(0, 1)]); +- _5 = must_use::(move _6) -> [return: bb3, unwind unreachable]; ++ _6 = const 0_usize; ++ _5 = must_use::(const 0_usize) -> [return: bb3, unwind unreachable]; } bb3: { StorageDead(_6); StorageLive(_7); StorageLive(_8); - _8 = OffsetOf(Delta, [(0, 2)]); - _7 = must_use::(move _8) -> [return: bb4, unwind unreachable]; +- _8 = OffsetOf(Delta, [(0, 2)]); +- _7 = must_use::(move _8) -> [return: bb4, unwind unreachable]; ++ _8 = const 2_usize; ++ _7 = must_use::(const 2_usize) -> [return: bb4, unwind unreachable]; } bb4: { diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff index 04ccd2b36e0d8..4ae40590296a9 100644 --- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff @@ -58,16 +58,20 @@ StorageDead(_4); StorageLive(_5); StorageLive(_6); - _6 = OffsetOf(Delta, [(0, 1)]); - _5 = must_use::(move _6) -> [return: bb3, unwind continue]; +- _6 = OffsetOf(Delta, [(0, 1)]); +- _5 = must_use::(move _6) -> [return: bb3, unwind continue]; ++ _6 = const 0_usize; ++ _5 = must_use::(const 0_usize) -> [return: bb3, unwind continue]; } bb3: { StorageDead(_6); StorageLive(_7); StorageLive(_8); - _8 = OffsetOf(Delta, [(0, 2)]); - _7 = must_use::(move _8) -> [return: bb4, unwind continue]; +- _8 = OffsetOf(Delta, [(0, 2)]); +- _7 = must_use::(move _8) -> [return: bb4, unwind continue]; ++ _8 = const 2_usize; ++ _7 = must_use::(const 2_usize) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/const_prop/ref_without_sb.main.ConstProp.panic-abort.diff similarity index 91% rename from tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff rename to tests/mir-opt/const_prop/ref_without_sb.main.ConstProp.panic-abort.diff index fbbfd61bbedc1..29204e48693c5 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/ref_without_sb.main.ConstProp.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/ref_without_sb.main.ConstProp.panic-unwind.diff similarity index 91% rename from tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff rename to tests/mir-opt/const_prop/ref_without_sb.main.ConstProp.panic-unwind.diff index 4e1d26acfa3fc..c9684ce2834ff 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/ref_without_sb.main.ConstProp.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/const_prop/ref_without_sb.rs similarity index 76% rename from tests/mir-opt/dataflow-const-prop/ref_without_sb.rs rename to tests/mir-opt/const_prop/ref_without_sb.rs index 2851c0590ad5f..a452abb4a9ed5 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs +++ b/tests/mir-opt/const_prop/ref_without_sb.rs @@ -1,6 +1,6 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp +// unit-test: ConstProp #[inline(never)] fn escape(x: &T) {} @@ -8,7 +8,7 @@ fn escape(x: &T) {} #[inline(never)] fn some_function() {} -// EMIT_MIR ref_without_sb.main.DataflowConstProp.diff +// EMIT_MIR ref_without_sb.main.ConstProp.diff fn main() { let mut a = 0; escape(&a); diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff index a55bd029e99ab..9278b6edcf4df 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff @@ -30,9 +30,8 @@ bb1: { - _2 = _3[_4]; -- _1 = Add(move _2, const 0_u32); -+ _2 = const 42_u32; -+ _1 = const 42_u32; ++ _2 = _3[2 of 3]; + _1 = Add(move _2, const 0_u32); StorageDead(_2); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff index d49ef2e0179f8..72e5bfaa543a5 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff @@ -30,9 +30,8 @@ bb1: { - _2 = _3[_4]; -- _1 = Add(move _2, const 0_u32); -+ _2 = const 42_u32; -+ _1 = const 42_u32; ++ _2 = _3[2 of 3]; + _1 = Add(move _2, const 0_u32); StorageDead(_2); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff index a55bd029e99ab..9278b6edcf4df 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff @@ -30,9 +30,8 @@ bb1: { - _2 = _3[_4]; -- _1 = Add(move _2, const 0_u32); -+ _2 = const 42_u32; -+ _1 = const 42_u32; ++ _2 = _3[2 of 3]; + _1 = Add(move _2, const 0_u32); StorageDead(_2); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff index d49ef2e0179f8..72e5bfaa543a5 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff @@ -30,9 +30,8 @@ bb1: { - _2 = _3[_4]; -- _1 = Add(move _2, const 0_u32); -+ _2 = const 42_u32; -+ _1 = const 42_u32; ++ _2 = _3[2 of 3]; + _1 = Add(move _2, const 0_u32); StorageDead(_2); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff b/tests/mir-opt/const_prop/repr_transparent.main.ConstProp.diff similarity index 92% rename from tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff rename to tests/mir-opt/const_prop/repr_transparent.main.ConstProp.diff index 98bd40ab2c3da..afd56893ce110 100644 --- a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff +++ b/tests/mir-opt/const_prop/repr_transparent.main.ConstProp.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs b/tests/mir-opt/const_prop/repr_transparent.rs similarity index 71% rename from tests/mir-opt/dataflow-const-prop/repr_transparent.rs rename to tests/mir-opt/const_prop/repr_transparent.rs index 8cbed6fbb624d..651f81770845e 100644 --- a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs +++ b/tests/mir-opt/const_prop/repr_transparent.rs @@ -1,12 +1,12 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp // The struct has scalar ABI, but is not a scalar type. // Make sure that we handle this correctly. #[repr(transparent)] struct I32(i32); -// EMIT_MIR repr_transparent.main.DataflowConstProp.diff +// EMIT_MIR repr_transparent.main.ConstProp.diff fn main() { let x = I32(0); let y = I32(x.0 + x.0); diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff b/tests/mir-opt/const_prop/self_assign.main.ConstProp.diff similarity index 91% rename from tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff rename to tests/mir-opt/const_prop/self_assign.main.ConstProp.diff index fbdbb3fa35caf..94cac8dce3f1b 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff +++ b/tests/mir-opt/const_prop/self_assign.main.ConstProp.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.rs b/tests/mir-opt/const_prop/self_assign.rs similarity index 59% rename from tests/mir-opt/dataflow-const-prop/self_assign.rs rename to tests/mir-opt/const_prop/self_assign.rs index c5866c4a9fd98..04b38e9d2e3f9 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign.rs +++ b/tests/mir-opt/const_prop/self_assign.rs @@ -1,7 +1,7 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp -// EMIT_MIR self_assign.main.DataflowConstProp.diff +// EMIT_MIR self_assign.main.ConstProp.diff fn main() { let mut a = 0; a = a + 1; diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff b/tests/mir-opt/const_prop/self_assign_add.main.ConstProp.diff similarity index 81% rename from tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff rename to tests/mir-opt/const_prop/self_assign_add.main.ConstProp.diff index e2468a9645d61..fba2e3c239969 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff +++ b/tests/mir-opt/const_prop/self_assign_add.main.ConstProp.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/const_prop/self_assign_add.rs b/tests/mir-opt/const_prop/self_assign_add.rs new file mode 100644 index 0000000000000..d87541eeb13cc --- /dev/null +++ b/tests/mir-opt/const_prop/self_assign_add.rs @@ -0,0 +1,9 @@ +// skip-filecheck +// unit-test: ConstProp + +// EMIT_MIR self_assign_add.main.ConstProp.diff +fn main() { + let mut a = 0; + a += 1; + a += 1; +} diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/const_prop/sibling_ptr.main.ConstProp.panic-abort.diff similarity index 92% rename from tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff rename to tests/mir-opt/const_prop/sibling_ptr.main.ConstProp.panic-abort.diff index 9b0093c454e17..910cabf6b533d 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/sibling_ptr.main.ConstProp.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/sibling_ptr.main.ConstProp.panic-unwind.diff similarity index 92% rename from tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff rename to tests/mir-opt/const_prop/sibling_ptr.main.ConstProp.panic-unwind.diff index 635a214251bcc..621501125666a 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/sibling_ptr.main.ConstProp.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/const_prop/sibling_ptr.rs similarity index 79% rename from tests/mir-opt/dataflow-const-prop/sibling_ptr.rs rename to tests/mir-opt/const_prop/sibling_ptr.rs index 68aff528695d5..e5d68771dbb01 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs +++ b/tests/mir-opt/const_prop/sibling_ptr.rs @@ -3,13 +3,13 @@ // This attempts to modify `x.1` via a pointer derived from `addr_of_mut!(x.0)`. // According to Miri, that is UB. However, T-opsem has not finalized that // decision and as such we cannot rely on it in optimizations. Consequently, -// DataflowConstProp must treat the `addr_of_mut!(x.0)` as potentially being +// ConstProp must treat the `addr_of_mut!(x.0)` as potentially being // used to modify `x.1` - if it did not, then it might incorrectly assume that it // can infer the value of `x.1` at the end of this function. -// unit-test: DataflowConstProp +// unit-test: ConstProp -// EMIT_MIR sibling_ptr.main.DataflowConstProp.diff +// EMIT_MIR sibling_ptr.main.ConstProp.diff fn main() { let mut x: (u8, u8) = (0, 0); unsafe { diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff index c2e1288b41e44..4288f57be43c1 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff @@ -35,7 +35,7 @@ bb1: { - _1 = (*_2)[_6]; -+ _1 = const 2_u32; ++ _1 = (*_2)[1 of 2]; StorageDead(_6); StorageDead(_4); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff index 23646c3c9762c..d9e745345c69d 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff @@ -35,7 +35,7 @@ bb1: { - _1 = (*_2)[_6]; -+ _1 = const 2_u32; ++ _1 = (*_2)[1 of 2]; StorageDead(_6); StorageDead(_4); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff index c2e1288b41e44..4288f57be43c1 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff @@ -35,7 +35,7 @@ bb1: { - _1 = (*_2)[_6]; -+ _1 = const 2_u32; ++ _1 = (*_2)[1 of 2]; StorageDead(_6); StorageDead(_4); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff index 23646c3c9762c..d9e745345c69d 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff @@ -35,7 +35,7 @@ bb1: { - _1 = (*_2)[_6]; -+ _1 = const 2_u32; ++ _1 = (*_2)[1 of 2]; StorageDead(_6); StorageDead(_4); StorageDead(_2); diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff b/tests/mir-opt/const_prop/struct.main.ConstProp.32bit.diff similarity index 98% rename from tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff rename to tests/mir-opt/const_prop/struct.main.ConstProp.32bit.diff index 0f461f515fdd0..521a47a6409b7 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/struct.main.ConstProp.32bit.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff b/tests/mir-opt/const_prop/struct.main.ConstProp.64bit.diff similarity index 98% rename from tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff rename to tests/mir-opt/const_prop/struct.main.ConstProp.64bit.diff index 3c40ec8bfb450..4e050143f5803 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/struct.main.ConstProp.64bit.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/const_prop/struct.rs similarity index 92% rename from tests/mir-opt/dataflow-const-prop/struct.rs rename to tests/mir-opt/const_prop/struct.rs index 043981a295484..ff4d0fcc46310 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.rs +++ b/tests/mir-opt/const_prop/struct.rs @@ -1,5 +1,5 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH #[derive(Copy, Clone)] @@ -11,7 +11,7 @@ struct SmallStruct(f32, Option, &'static [f32]); #[derive(Copy, Clone)] struct BigStruct(f32, Option, &'static [f32]); -// EMIT_MIR struct.main.DataflowConstProp.diff +// EMIT_MIR struct.main.ConstProp.diff fn main() { let mut s = S(1); let a = s.0 + 2; diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/const_prop/terminator.main.ConstProp.panic-abort.diff similarity index 89% rename from tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff rename to tests/mir-opt/const_prop/terminator.main.ConstProp.panic-abort.diff index c0f378cc21f88..96b537a9bacbd 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/terminator.main.ConstProp.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/terminator.main.ConstProp.panic-unwind.diff similarity index 89% rename from tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff rename to tests/mir-opt/const_prop/terminator.main.ConstProp.panic-unwind.diff index 395620fec524a..bc98bc408b233 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/terminator.main.ConstProp.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/terminator.rs b/tests/mir-opt/const_prop/terminator.rs similarity index 67% rename from tests/mir-opt/dataflow-const-prop/terminator.rs rename to tests/mir-opt/const_prop/terminator.rs index 92a42f22c218f..1e8a4301e97b4 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.rs +++ b/tests/mir-opt/const_prop/terminator.rs @@ -1,10 +1,10 @@ // skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp +// unit-test: ConstProp fn foo(n: i32) {} -// EMIT_MIR terminator.main.DataflowConstProp.diff +// EMIT_MIR terminator.main.ConstProp.diff fn main() { let a = 1; // Checks that we propagate into terminators. diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff index 7ac7bed8a5f70..077d3adf62b5c 100644 --- a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff @@ -9,10 +9,8 @@ bb0: { StorageLive(_1); -- _1 = Less; -- _0 = move _1 as i8 (Transmute); -+ _1 = const Less; -+ _0 = const -1_i8; + _1 = Less; + _0 = move _1 as i8 (Transmute); StorageDead(_1); return; } diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff index 7ac7bed8a5f70..077d3adf62b5c 100644 --- a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff @@ -9,10 +9,8 @@ bb0: { StorageLive(_1); -- _1 = Less; -- _0 = move _1 as i8 (Transmute); -+ _1 = const Less; -+ _0 = const -1_i8; + _1 = Less; + _0 = move _1 as i8 (Transmute); StorageDead(_1); return; } diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs index 99988d0599454..d74a3e05d1bfd 100644 --- a/tests/mir-opt/const_prop/transmute.rs +++ b/tests/mir-opt/const_prop/transmute.rs @@ -8,7 +8,8 @@ use std::mem::transmute; // EMIT_MIR transmute.less_as_i8.ConstProp.diff pub fn less_as_i8() -> i8 { // CHECK-LABEL: fn less_as_i8( - // CHECK: _0 = const -1_i8; + // CHECK: [[less:_.*]] = Less; + // CHECK: _0 = move [[less]] as i8 (Transmute); unsafe { transmute(std::cmp::Ordering::Less) } } @@ -52,8 +53,8 @@ pub unsafe fn undef_union_as_integer() -> u32 { // EMIT_MIR transmute.unreachable_direct.ConstProp.diff pub unsafe fn unreachable_direct() -> ! { // CHECK-LABEL: fn unreachable_direct( - // CHECK: [[unit:_.*]] = (); - // CHECK: move [[unit]] as Never (Transmute); + // CHECK: = const (); + // CHECK: = const ZeroSized: Never; let x: Never = unsafe { transmute(()) }; match x {} } diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff index afedf2a306137..4448c3793cf01 100644 --- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff @@ -11,8 +11,10 @@ bb0: { StorageLive(_1); StorageLive(_2); - _2 = (); - _1 = Union32 { value: move _2 }; +- _2 = (); +- _1 = Union32 { value: move _2 }; ++ _2 = const (); ++ _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.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff index afedf2a306137..4448c3793cf01 100644 --- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff @@ -11,8 +11,10 @@ bb0: { StorageLive(_1); StorageLive(_2); - _2 = (); - _1 = Union32 { value: move _2 }; +- _2 = (); +- _1 = Union32 { value: move _2 }; ++ _2 = const (); ++ _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.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff index 16519749b8207..93f94d1e73a5f 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff @@ -14,9 +14,8 @@ bb0: { StorageLive(_1); - _1 = const 1_usize as std::boxed::Box (Transmute); -- _2 = (((_1.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const Never); + _1 = const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); -+ _2 = const {0x1 as *const Never}; + _2 = (((_1.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const Never); unreachable; } } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff index 16519749b8207..93f94d1e73a5f 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff @@ -14,9 +14,8 @@ bb0: { StorageLive(_1); - _1 = const 1_usize as std::boxed::Box (Transmute); -- _2 = (((_1.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const Never); + _1 = const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); -+ _2 = const {0x1 as *const Never}; + _2 = (((_1.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const Never); unreachable; } } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff index 896608e7eff5d..b8d3670fbc678 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff @@ -14,8 +14,10 @@ bb0: { StorageLive(_1); StorageLive(_2); - _2 = (); - _1 = move _2 as Never (Transmute); +- _2 = (); +- _1 = move _2 as Never (Transmute); ++ _2 = const (); ++ _1 = const ZeroSized: Never; unreachable; } } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff index 896608e7eff5d..b8d3670fbc678 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff @@ -14,8 +14,10 @@ bb0: { StorageLive(_1); StorageLive(_2); - _2 = (); - _1 = move _2 as Never (Transmute); +- _2 = (); +- _1 = move _2 as Never (Transmute); ++ _2 = const (); ++ _1 = const ZeroSized: Never; unreachable; } } diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff b/tests/mir-opt/const_prop/tuple.main.ConstProp.32bit.diff similarity index 97% rename from tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff rename to tests/mir-opt/const_prop/tuple.main.ConstProp.32bit.diff index f5723cac7d9c8..e53ce1a359821 100644 --- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/tuple.main.ConstProp.32bit.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff b/tests/mir-opt/const_prop/tuple.main.ConstProp.64bit.diff similarity index 97% rename from tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff rename to tests/mir-opt/const_prop/tuple.main.ConstProp.64bit.diff index f5723cac7d9c8..e53ce1a359821 100644 --- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/tuple.main.ConstProp.64bit.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/const_prop/tuple.main.ConstProp.diff b/tests/mir-opt/const_prop/tuple.main.ConstProp.diff new file mode 100644 index 0000000000000..e53ce1a359821 --- /dev/null +++ b/tests/mir-opt/const_prop/tuple.main.ConstProp.diff @@ -0,0 +1,112 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); + let mut _1: (i32, i32); + let mut _3: i32; + let mut _4: i32; + let mut _5: i32; + let mut _7: i32; + let mut _8: i32; + let mut _9: i32; + let mut _10: i32; + let mut _12: i32; + let mut _13: (i32, i32); + let mut _14: i32; + scope 1 { + debug a => _1; + let _2: i32; + scope 2 { + debug b => _2; + let _6: i32; + scope 3 { + debug c => _6; + let _11: (i32, (i32, i32), i32); + scope 4 { + debug d => _11; + } + } + } + } + + bb0: { + StorageLive(_1); +- _1 = (const 1_i32, const 2_i32); ++ _1 = const (1_i32, 2_i32); + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); +- _4 = (_1.0: i32); ++ _4 = const 1_i32; + StorageLive(_5); +- _5 = (_1.1: i32); +- _3 = Add(move _4, move _5); ++ _5 = const 2_i32; ++ _3 = const 3_i32; + StorageDead(_5); + StorageDead(_4); +- _2 = Add(move _3, const 3_i32); ++ _2 = const 6_i32; + StorageDead(_3); +- _1 = (const 2_i32, const 3_i32); ++ _1 = const (2_i32, 3_i32); + StorageLive(_6); + StorageLive(_7); + StorageLive(_8); +- _8 = (_1.0: i32); ++ _8 = const 2_i32; + StorageLive(_9); +- _9 = (_1.1: i32); +- _7 = Add(move _8, move _9); ++ _9 = const 3_i32; ++ _7 = const 5_i32; + StorageDead(_9); + StorageDead(_8); + StorageLive(_10); +- _10 = _2; +- _6 = Add(move _7, move _10); ++ _10 = const 6_i32; ++ _6 = const 11_i32; + StorageDead(_10); + StorageDead(_7); + StorageLive(_11); + StorageLive(_12); +- _12 = _2; ++ _12 = const 6_i32; + StorageLive(_13); +- _13 = _1; ++ _13 = const (2_i32, 3_i32); + StorageLive(_14); +- _14 = _6; +- _11 = (move _12, move _13, move _14); ++ _14 = const 11_i32; ++ _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32); + StorageDead(_14); + StorageDead(_13); + StorageDead(_12); + _0 = const (); + StorageDead(_11); + StorageDead(_6); + StorageDead(_2); + StorageDead(_1); + return; + } ++ } ++ ++ ALLOC0 (size: 8, align: 4) { ++ 02 00 00 00 03 00 00 00 │ ........ ++ } ++ ++ ALLOC1 (size: 8, align: 4) { ++ 02 00 00 00 03 00 00 00 │ ........ ++ } ++ ++ ALLOC2 (size: 8, align: 4) { ++ 02 00 00 00 03 00 00 00 │ ........ ++ } ++ ++ ALLOC3 (size: 8, align: 4) { ++ 01 00 00 00 02 00 00 00 │ ........ + } + diff --git a/tests/mir-opt/dataflow-const-prop/tuple.rs b/tests/mir-opt/const_prop/tuple.rs similarity index 70% rename from tests/mir-opt/dataflow-const-prop/tuple.rs rename to tests/mir-opt/const_prop/tuple.rs index bb706eafe8885..d06b7e7b45c15 100644 --- a/tests/mir-opt/dataflow-const-prop/tuple.rs +++ b/tests/mir-opt/const_prop/tuple.rs @@ -1,8 +1,8 @@ // skip-filecheck -// unit-test: DataflowConstProp +// unit-test: ConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH -// EMIT_MIR tuple.main.DataflowConstProp.diff +// EMIT_MIR tuple.main.ConstProp.diff fn main() { let mut a = (1, 2); let b = a.0 + a.1 + 3; diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff deleted file mode 100644 index 212ddc5b15418..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: [u32; 4]; - let _3: usize; - let mut _4: usize; - let mut _5: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; - StorageLive(_3); - _3 = const 2_usize; -- _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; -+ _4 = const 4_usize; -+ _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable]; - } - - bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; - StorageDead(_3); - StorageDead(_2); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff deleted file mode 100644 index 5c53d4f446131..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: [u32; 4]; - let _3: usize; - let mut _4: usize; - let mut _5: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; - StorageLive(_3); - _3 = const 2_usize; -- _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; -+ _4 = const 4_usize; -+ _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue]; - } - - bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; - StorageDead(_3); - StorageDead(_2); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff deleted file mode 100644 index 212ddc5b15418..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: [u32; 4]; - let _3: usize; - let mut _4: usize; - let mut _5: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; - StorageLive(_3); - _3 = const 2_usize; -- _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; -+ _4 = const 4_usize; -+ _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable]; - } - - bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; - StorageDead(_3); - StorageDead(_2); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff deleted file mode 100644 index 5c53d4f446131..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: [u32; 4]; - let _3: usize; - let mut _4: usize; - let mut _5: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; - StorageLive(_3); - _3 = const 2_usize; -- _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; -+ _4 = const 4_usize; -+ _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue]; - } - - bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; - StorageDead(_3); - StorageDead(_2); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs deleted file mode 100644 index 3d420f930076d..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/array_index.rs +++ /dev/null @@ -1,9 +0,0 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp -// EMIT_MIR_FOR_EACH_BIT_WIDTH - -// EMIT_MIR array_index.main.DataflowConstProp.diff -fn main() { - let x: u32 = [0, 1, 2, 3][2]; -} diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs deleted file mode 100644 index 2605c7019e6f4..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs +++ /dev/null @@ -1,11 +0,0 @@ -// skip-filecheck -// unit-test: DataflowConstProp - -// EMIT_MIR boolean_identities.test.DataflowConstProp.diff -pub fn test(x: bool, y: bool) -> bool { - (y | true) & (x & false) -} - -fn main() { - test(true, false); -} diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff deleted file mode 100644 index 5440c38ce4bcf..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff +++ /dev/null @@ -1,33 +0,0 @@ -- // MIR for `test` before DataflowConstProp -+ // MIR for `test` after DataflowConstProp - - fn test(_1: bool, _2: bool) -> bool { - debug x => _1; - debug y => _2; - let mut _0: bool; - let mut _3: bool; - let mut _4: bool; - let mut _5: bool; - let mut _6: bool; - - bb0: { - StorageLive(_3); - StorageLive(_4); - _4 = _2; -- _3 = BitOr(move _4, const true); -+ _3 = const true; - StorageDead(_4); - StorageLive(_5); - StorageLive(_6); - _6 = _1; -- _5 = BitAnd(move _6, const false); -+ _5 = const false; - StorageDead(_6); -- _0 = BitAnd(move _3, move _5); -+ _0 = const false; - StorageDead(_5); - StorageDead(_3); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff deleted file mode 100644 index 0ca446c89f2e0..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff +++ /dev/null @@ -1,37 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: i32; - let mut _3: u8; - let mut _4: i32; - scope 1 { - debug a => _1; - let _2: u8; - scope 2 { - debug b => _2; - } - } - - bb0: { - StorageLive(_1); - _1 = const 257_i32; - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); -- _4 = _1; -- _3 = move _4 as u8 (IntToInt); -+ _4 = const 257_i32; -+ _3 = const 1_u8; - StorageDead(_4); -- _2 = Add(move _3, const 1_u8); -+ _2 = const 2_u8; - StorageDead(_3); - _0 = const (); - StorageDead(_2); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/cast.rs b/tests/mir-opt/dataflow-const-prop/cast.rs deleted file mode 100644 index c87872609dcf7..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/cast.rs +++ /dev/null @@ -1,8 +0,0 @@ -// skip-filecheck -// unit-test: DataflowConstProp - -// EMIT_MIR cast.main.DataflowConstProp.diff -fn main() { - let a = 257; - let b = a as u8 + 1; -} diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff deleted file mode 100644 index 8363783e64e0d..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff +++ /dev/null @@ -1,119 +0,0 @@ -- // MIR for `main` before ConstProp -+ // MIR for `main` after ConstProp - - fn main() -> () { - let mut _0: (); - let _1: A; - let mut _2: std::boxed::Box<[bool]>; - scope 1 { - debug a => _1; - } - scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - debug ptr => _3; - } - scope 4 (inlined Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _7: usize; - scope 6 { - let _6: *mut [bool; 0]; - scope 7 { - debug ptr => _6; - scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: *const [bool; 0]; - scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _6; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _6; - let mut _9: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _9; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _9; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _9; - } - } - } - } - } - } - } - } - } - } - scope 8 (inlined align_of::<[bool; 0]>) { - } - scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; - scope 10 { - } - } - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); - StorageLive(_6); - StorageLive(_7); -- _7 = AlignOf([bool; 0]); -- _6 = _7 as *mut [bool; 0] (Transmute); -+ _7 = const 1_usize; -+ _6 = const {0x1 as *mut [bool; 0]}; - StorageDead(_7); - StorageLive(_8); - StorageLive(_9); -- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -- _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 = 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 = A { foo: const 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]; - } - - bb1: { - 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.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff deleted file mode 100644 index 19326b6a93355..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff +++ /dev/null @@ -1,123 +0,0 @@ -- // MIR for `main` before ConstProp -+ // MIR for `main` after ConstProp - - fn main() -> () { - let mut _0: (); - let _1: A; - let mut _2: std::boxed::Box<[bool]>; - scope 1 { - debug a => _1; - } - scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - debug ptr => _3; - } - scope 4 (inlined Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _7: usize; - scope 6 { - let _6: *mut [bool; 0]; - scope 7 { - debug ptr => _6; - scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: *const [bool; 0]; - scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _6; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _6; - let mut _9: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _9; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _9; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _9; - } - } - } - } - } - } - } - } - } - } - scope 8 (inlined align_of::<[bool; 0]>) { - } - scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; - scope 10 { - } - } - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); - StorageLive(_6); - StorageLive(_7); -- _7 = AlignOf([bool; 0]); -- _6 = _7 as *mut [bool; 0] (Transmute); -+ _7 = const 1_usize; -+ _6 = const {0x1 as *mut [bool; 0]}; - StorageDead(_7); - StorageLive(_8); - StorageLive(_9); -- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -- _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 = 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 = A { foo: const 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]; - } - - bb1: { - StorageDead(_1); - return; - } - - 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.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff deleted file mode 100644 index 0d1e2430ce34b..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff +++ /dev/null @@ -1,119 +0,0 @@ -- // MIR for `main` before ConstProp -+ // MIR for `main` after ConstProp - - fn main() -> () { - let mut _0: (); - let _1: A; - let mut _2: std::boxed::Box<[bool]>; - scope 1 { - debug a => _1; - } - scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - debug ptr => _3; - } - scope 4 (inlined Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _7: usize; - scope 6 { - let _6: *mut [bool; 0]; - scope 7 { - debug ptr => _6; - scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: *const [bool; 0]; - scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _6; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _6; - let mut _9: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _9; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _9; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _9; - } - } - } - } - } - } - } - } - } - } - scope 8 (inlined align_of::<[bool; 0]>) { - } - scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; - scope 10 { - } - } - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); - StorageLive(_6); - StorageLive(_7); -- _7 = AlignOf([bool; 0]); -- _6 = _7 as *mut [bool; 0] (Transmute); -+ _7 = const 1_usize; -+ _6 = const {0x1 as *mut [bool; 0]}; - StorageDead(_7); - StorageLive(_8); - StorageLive(_9); -- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -- _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 = 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 = A { foo: const 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]; - } - - bb1: { - 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.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff deleted file mode 100644 index 35f1e5ba796ef..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff +++ /dev/null @@ -1,123 +0,0 @@ -- // MIR for `main` before ConstProp -+ // MIR for `main` after ConstProp - - fn main() -> () { - let mut _0: (); - let _1: A; - let mut _2: std::boxed::Box<[bool]>; - scope 1 { - debug a => _1; - } - scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - debug ptr => _3; - } - scope 4 (inlined Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _7: usize; - scope 6 { - let _6: *mut [bool; 0]; - scope 7 { - debug ptr => _6; - scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { - debug ptr => _6; - let mut _8: *const [bool; 0]; - scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _6; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _6; - let mut _9: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _9; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _9; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _9; - } - } - } - } - } - } - } - } - } - } - scope 8 (inlined align_of::<[bool; 0]>) { - } - scope 9 (inlined invalid_mut::<[bool; 0]>) { - debug addr => _7; - scope 10 { - } - } - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); - StorageLive(_6); - StorageLive(_7); -- _7 = AlignOf([bool; 0]); -- _6 = _7 as *mut [bool; 0] (Transmute); -+ _7 = const 1_usize; -+ _6 = const {0x1 as *mut [bool; 0]}; - StorageDead(_7); - StorageLive(_8); - StorageLive(_9); -- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -- _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 = 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 = A { foo: const 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]; - } - - bb1: { - StorageDead(_1); - return; - } - - 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/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff deleted file mode 100644 index 09fc48043b9c8..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff +++ /dev/null @@ -1,45 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let mut _1: u8; - let mut _2: u8; - let mut _3: u8; - scope 1 { - } - scope 2 (inlined #[track_caller] ::add) { - debug self => _2; - debug other => _3; - let mut _4: (u8, bool); - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = const u8::MAX; - StorageLive(_3); - _3 = const 1_u8; - StorageLive(_4); -- _4 = CheckedAdd(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; -+ _4 = const (0_u8, true); -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable]; - } - - bb1: { -- _1 = move (_4.0: u8); -+ _1 = const 0_u8; - StorageDead(_4); - StorageDead(_3); - StorageDead(_2); - StorageDead(_1); - _0 = const (); - return; - } -+ } -+ -+ ALLOC0 (size: 2, align: 1) { -+ 00 01 │ .. - } - diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff deleted file mode 100644 index c0b26080f56fe..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff +++ /dev/null @@ -1,45 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let mut _1: u8; - let mut _2: u8; - let mut _3: u8; - scope 1 { - } - scope 2 (inlined #[track_caller] ::add) { - debug self => _2; - debug other => _3; - let mut _4: (u8, bool); - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = const u8::MAX; - StorageLive(_3); - _3 = const 1_u8; - StorageLive(_4); -- _4 = CheckedAdd(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; -+ _4 = const (0_u8, true); -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue]; - } - - bb1: { -- _1 = move (_4.0: u8); -+ _1 = const 0_u8; - StorageDead(_4); - StorageDead(_3); - StorageDead(_2); - StorageDead(_1); - _0 = const (); - return; - } -+ } -+ -+ ALLOC0 (size: 2, align: 1) { -+ 00 01 │ .. - } - diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs deleted file mode 100644 index 664cbcb2c259f..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs +++ /dev/null @@ -1,11 +0,0 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp -// compile-flags: -Zmir-enable-passes=+Inline - -// EMIT_MIR inherit_overflow.main.DataflowConstProp.diff -fn main() { - // After inlining, this will contain a `CheckedBinaryOp`. - // Propagating the overflow is ok as codegen will just skip emitting the panic. - let _ = ::add(255, 1); -} diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff deleted file mode 100644 index 6c612d4672500..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u8; - let mut _2: [u8; 5000]; - let _3: usize; - let mut _4: usize; - let mut _5: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = [const 0_u8; 5000]; - StorageLive(_3); - _3 = const 2_usize; -- _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; -+ _4 = const 5000_usize; -+ _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable]; - } - - bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; - StorageDead(_3); - StorageDead(_2); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff deleted file mode 100644 index 87024da2628bf..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u8; - let mut _2: [u8; 5000]; - let _3: usize; - let mut _4: usize; - let mut _5: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = [const 0_u8; 5000]; - StorageLive(_3); - _3 = const 2_usize; -- _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; -+ _4 = const 5000_usize; -+ _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue]; - } - - bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; - StorageDead(_3); - StorageDead(_2); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff deleted file mode 100644 index 6c612d4672500..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u8; - let mut _2: [u8; 5000]; - let _3: usize; - let mut _4: usize; - let mut _5: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = [const 0_u8; 5000]; - StorageLive(_3); - _3 = const 2_usize; -- _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; -+ _4 = const 5000_usize; -+ _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable]; - } - - bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; - StorageDead(_3); - StorageDead(_2); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff deleted file mode 100644 index 87024da2628bf..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff +++ /dev/null @@ -1,39 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u8; - let mut _2: [u8; 5000]; - let _3: usize; - let mut _4: usize; - let mut _5: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = [const 0_u8; 5000]; - StorageLive(_3); - _3 = const 2_usize; -- _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; -+ _4 = const 5000_usize; -+ _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue]; - } - - bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; - StorageDead(_3); - StorageDead(_2); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs deleted file mode 100644 index d611a54ba71a2..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.rs +++ /dev/null @@ -1,10 +0,0 @@ -// skip-filecheck -// unit-test: DataflowConstProp -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// EMIT_MIR_FOR_EACH_BIT_WIDTH - -// EMIT_MIR large_array_index.main.DataflowConstProp.diff -fn main() { - // check that we don't propagate this, because it's too large - let x: u8 = [0_u8; 5000][2]; -} diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs deleted file mode 100644 index 16a45c8e9fb59..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs +++ /dev/null @@ -1,11 +0,0 @@ -// skip-filecheck -// unit-test: DataflowConstProp - -// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff -fn test(x : i32) -> i32 { - x * 0 -} - -fn main() { - test(10); -} diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff deleted file mode 100644 index 91bc10a562f7a..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff +++ /dev/null @@ -1,18 +0,0 @@ -- // MIR for `test` before DataflowConstProp -+ // MIR for `test` after DataflowConstProp - - fn test(_1: i32) -> i32 { - debug x => _1; - let mut _0: i32; - let mut _2: i32; - - bb0: { - StorageLive(_2); - _2 = _1; -- _0 = Mul(move _2, const 0_i32); -+ _0 = const 0_i32; - StorageDead(_2); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff deleted file mode 100644 index f8f8917503370..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff +++ /dev/null @@ -1,76 +0,0 @@ -- // MIR for `concrete` before DataflowConstProp -+ // MIR for `concrete` after DataflowConstProp - - fn concrete() -> () { - let mut _0: (); - let _1: usize; - let mut _2: usize; - let mut _4: usize; - let mut _6: usize; - let mut _8: usize; - scope 1 { - debug x => _1; - let _3: usize; - scope 2 { - debug y => _3; - let _5: usize; - scope 3 { - debug z0 => _5; - let _7: usize; - scope 4 { - debug z1 => _7; - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = OffsetOf(Alpha, [(0, 0)]); -- _1 = must_use::(move _2) -> [return: bb1, unwind unreachable]; -+ _2 = const 4_usize; -+ _1 = must_use::(const 4_usize) -> [return: bb1, unwind unreachable]; - } - - bb1: { - StorageDead(_2); - StorageLive(_3); - StorageLive(_4); -- _4 = OffsetOf(Alpha, [(0, 1)]); -- _3 = must_use::(move _4) -> [return: bb2, unwind unreachable]; -+ _4 = const 0_usize; -+ _3 = must_use::(const 0_usize) -> [return: bb2, unwind unreachable]; - } - - bb2: { - StorageDead(_4); - StorageLive(_5); - StorageLive(_6); -- _6 = OffsetOf(Alpha, [(0, 2), (0, 0)]); -- _5 = must_use::(move _6) -> [return: bb3, unwind unreachable]; -+ _6 = const 2_usize; -+ _5 = must_use::(const 2_usize) -> [return: bb3, unwind unreachable]; - } - - bb3: { - StorageDead(_6); - StorageLive(_7); - StorageLive(_8); -- _8 = OffsetOf(Alpha, [(0, 2), (0, 1)]); -- _7 = must_use::(move _8) -> [return: bb4, unwind unreachable]; -+ _8 = const 3_usize; -+ _7 = must_use::(const 3_usize) -> [return: bb4, unwind unreachable]; - } - - bb4: { - StorageDead(_8); - _0 = const (); - StorageDead(_7); - StorageDead(_5); - StorageDead(_3); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff deleted file mode 100644 index d4f8cb66704ae..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff +++ /dev/null @@ -1,76 +0,0 @@ -- // MIR for `concrete` before DataflowConstProp -+ // MIR for `concrete` after DataflowConstProp - - fn concrete() -> () { - let mut _0: (); - let _1: usize; - let mut _2: usize; - let mut _4: usize; - let mut _6: usize; - let mut _8: usize; - scope 1 { - debug x => _1; - let _3: usize; - scope 2 { - debug y => _3; - let _5: usize; - scope 3 { - debug z0 => _5; - let _7: usize; - scope 4 { - debug z1 => _7; - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = OffsetOf(Alpha, [(0, 0)]); -- _1 = must_use::(move _2) -> [return: bb1, unwind continue]; -+ _2 = const 4_usize; -+ _1 = must_use::(const 4_usize) -> [return: bb1, unwind continue]; - } - - bb1: { - StorageDead(_2); - StorageLive(_3); - StorageLive(_4); -- _4 = OffsetOf(Alpha, [(0, 1)]); -- _3 = must_use::(move _4) -> [return: bb2, unwind continue]; -+ _4 = const 0_usize; -+ _3 = must_use::(const 0_usize) -> [return: bb2, unwind continue]; - } - - bb2: { - StorageDead(_4); - StorageLive(_5); - StorageLive(_6); -- _6 = OffsetOf(Alpha, [(0, 2), (0, 0)]); -- _5 = must_use::(move _6) -> [return: bb3, unwind continue]; -+ _6 = const 2_usize; -+ _5 = must_use::(const 2_usize) -> [return: bb3, unwind continue]; - } - - bb3: { - StorageDead(_6); - StorageLive(_7); - StorageLive(_8); -- _8 = OffsetOf(Alpha, [(0, 2), (0, 1)]); -- _7 = must_use::(move _8) -> [return: bb4, unwind continue]; -+ _8 = const 3_usize; -+ _7 = must_use::(const 3_usize) -> [return: bb4, unwind continue]; - } - - bb4: { - StorageDead(_8); - _0 = const (); - StorageDead(_7); - StorageDead(_5); - StorageDead(_3); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff deleted file mode 100644 index 7f166e4fa356a..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff +++ /dev/null @@ -1,72 +0,0 @@ -- // MIR for `generic` before DataflowConstProp -+ // MIR for `generic` after DataflowConstProp - - fn generic() -> () { - let mut _0: (); - let _1: usize; - let mut _2: usize; - let mut _4: usize; - let mut _6: usize; - let mut _8: usize; - scope 1 { - debug gx => _1; - let _3: usize; - scope 2 { - debug gy => _3; - let _5: usize; - scope 3 { - debug dx => _5; - let _7: usize; - scope 4 { - debug dy => _7; - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = OffsetOf(Gamma, [(0, 0)]); - _1 = must_use::(move _2) -> [return: bb1, unwind unreachable]; - } - - bb1: { - StorageDead(_2); - StorageLive(_3); - StorageLive(_4); - _4 = OffsetOf(Gamma, [(0, 1)]); - _3 = must_use::(move _4) -> [return: bb2, unwind unreachable]; - } - - bb2: { - StorageDead(_4); - StorageLive(_5); - StorageLive(_6); -- _6 = OffsetOf(Delta, [(0, 1)]); -- _5 = must_use::(move _6) -> [return: bb3, unwind unreachable]; -+ _6 = const 0_usize; -+ _5 = must_use::(const 0_usize) -> [return: bb3, unwind unreachable]; - } - - bb3: { - StorageDead(_6); - StorageLive(_7); - StorageLive(_8); -- _8 = OffsetOf(Delta, [(0, 2)]); -- _7 = must_use::(move _8) -> [return: bb4, unwind unreachable]; -+ _8 = const 2_usize; -+ _7 = must_use::(const 2_usize) -> [return: bb4, unwind unreachable]; - } - - bb4: { - StorageDead(_8); - _0 = const (); - StorageDead(_7); - StorageDead(_5); - StorageDead(_3); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff deleted file mode 100644 index 38ad6f7980160..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff +++ /dev/null @@ -1,72 +0,0 @@ -- // MIR for `generic` before DataflowConstProp -+ // MIR for `generic` after DataflowConstProp - - fn generic() -> () { - let mut _0: (); - let _1: usize; - let mut _2: usize; - let mut _4: usize; - let mut _6: usize; - let mut _8: usize; - scope 1 { - debug gx => _1; - let _3: usize; - scope 2 { - debug gy => _3; - let _5: usize; - scope 3 { - debug dx => _5; - let _7: usize; - scope 4 { - debug dy => _7; - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = OffsetOf(Gamma, [(0, 0)]); - _1 = must_use::(move _2) -> [return: bb1, unwind continue]; - } - - bb1: { - StorageDead(_2); - StorageLive(_3); - StorageLive(_4); - _4 = OffsetOf(Gamma, [(0, 1)]); - _3 = must_use::(move _4) -> [return: bb2, unwind continue]; - } - - bb2: { - StorageDead(_4); - StorageLive(_5); - StorageLive(_6); -- _6 = OffsetOf(Delta, [(0, 1)]); -- _5 = must_use::(move _6) -> [return: bb3, unwind continue]; -+ _6 = const 0_usize; -+ _5 = must_use::(const 0_usize) -> [return: bb3, unwind continue]; - } - - bb3: { - StorageDead(_6); - StorageLive(_7); - StorageLive(_8); -- _8 = OffsetOf(Delta, [(0, 2)]); -- _7 = must_use::(move _8) -> [return: bb4, unwind continue]; -+ _8 = const 2_usize; -+ _7 = must_use::(const 2_usize) -> [return: bb4, unwind continue]; - } - - bb4: { - StorageDead(_8); - _0 = const (); - StorageDead(_7); - StorageDead(_5); - StorageDead(_3); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.rs b/tests/mir-opt/dataflow-const-prop/offset_of.rs deleted file mode 100644 index e71b3f59ecab3..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/offset_of.rs +++ /dev/null @@ -1,50 +0,0 @@ -// skip-filecheck -// unit-test: DataflowConstProp -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY - -#![feature(offset_of)] - -use std::marker::PhantomData; -use std::mem::offset_of; - -struct Alpha { - x: u8, - y: u16, - z: Beta, -} - -struct Beta(u8, u8); - -struct Gamma { - x: u8, - y: u16, - _t: T, -} - -#[repr(C)] -struct Delta { - _phantom: PhantomData, - x: u8, - y: u16, -} - -// EMIT_MIR offset_of.concrete.DataflowConstProp.diff -fn concrete() { - let x = offset_of!(Alpha, x); - let y = offset_of!(Alpha, y); - let z0 = offset_of!(Alpha, z.0); - let z1 = offset_of!(Alpha, z.1); -} - -// EMIT_MIR offset_of.generic.DataflowConstProp.diff -fn generic() { - let gx = offset_of!(Gamma, x); - let gy = offset_of!(Gamma, y); - let dx = offset_of!(Delta, x); - let dy = offset_of!(Delta, y); -} - -fn main() { - concrete(); - generic::<()>(); -} diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff deleted file mode 100644 index a18ef6c9db763..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff +++ /dev/null @@ -1,43 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: u32; - let mut _3: [u32; 8]; - let _4: usize; - let mut _5: usize; - let mut _6: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - _3 = [const 42_u32; 8]; - StorageLive(_4); - _4 = const 2_usize; -- _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; -+ _5 = const 8_usize; -+ _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable]; - } - - bb1: { -- _2 = _3[_4]; -+ _2 = _3[2 of 3]; - _1 = Add(move _2, const 0_u32); - StorageDead(_2); - StorageDead(_4); - StorageDead(_3); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff deleted file mode 100644 index 3356ef98b14a8..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff +++ /dev/null @@ -1,43 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: u32; - let mut _3: [u32; 8]; - let _4: usize; - let mut _5: usize; - let mut _6: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - _3 = [const 42_u32; 8]; - StorageLive(_4); - _4 = const 2_usize; -- _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; -+ _5 = const 8_usize; -+ _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue]; - } - - bb1: { -- _2 = _3[_4]; -+ _2 = _3[2 of 3]; - _1 = Add(move _2, const 0_u32); - StorageDead(_2); - StorageDead(_4); - StorageDead(_3); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff deleted file mode 100644 index a18ef6c9db763..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff +++ /dev/null @@ -1,43 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: u32; - let mut _3: [u32; 8]; - let _4: usize; - let mut _5: usize; - let mut _6: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - _3 = [const 42_u32; 8]; - StorageLive(_4); - _4 = const 2_usize; -- _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; -+ _5 = const 8_usize; -+ _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable]; - } - - bb1: { -- _2 = _3[_4]; -+ _2 = _3[2 of 3]; - _1 = Add(move _2, const 0_u32); - StorageDead(_2); - StorageDead(_4); - StorageDead(_3); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff deleted file mode 100644 index 3356ef98b14a8..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff +++ /dev/null @@ -1,43 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: u32; - let mut _3: [u32; 8]; - let _4: usize; - let mut _5: usize; - let mut _6: bool; - scope 1 { - debug x => _1; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - _3 = [const 42_u32; 8]; - StorageLive(_4); - _4 = const 2_usize; -- _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; -+ _5 = const 8_usize; -+ _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue]; - } - - bb1: { -- _2 = _3[_4]; -+ _2 = _3[2 of 3]; - _1 = Add(move _2, const 0_u32); - StorageDead(_2); - StorageDead(_4); - StorageDead(_3); - _0 = const (); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs deleted file mode 100644 index b824481948116..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/repeat.rs +++ /dev/null @@ -1,9 +0,0 @@ -// skip-filecheck -// unit-test: DataflowConstProp -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// EMIT_MIR_FOR_EACH_BIT_WIDTH - -// EMIT_MIR repeat.main.DataflowConstProp.diff -fn main() { - let x: u32 = [42; 8][2] + 0; -} diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs deleted file mode 100644 index cfe1458e44be7..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs +++ /dev/null @@ -1,9 +0,0 @@ -// skip-filecheck -// unit-test: DataflowConstProp - -// EMIT_MIR self_assign_add.main.DataflowConstProp.diff -fn main() { - let mut a = 0; - a += 1; - a += 1; -} diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff deleted file mode 100644 index e99b413f708c4..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff +++ /dev/null @@ -1,77 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: &[u32]; - let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _10: &[u32]; - let _11: usize; - let mut _12: usize; - let mut _13: bool; - let mut _14: &[u32; 3]; - scope 1 { - debug local => _1; - let _9: u32; - scope 2 { - debug constant => _9; - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - _14 = const _; - _4 = _14; - _3 = _4; - _2 = move _3 as &[u32] (PointerCoercion(Unsize)); - StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _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]; -+ _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]; - StorageDead(_6); - StorageDead(_4); - StorageDead(_2); - StorageLive(_9); - StorageLive(_10); - _10 = const _; - StorageLive(_11); - _11 = const 1_usize; -- _12 = Len((*_10)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind unreachable]; -+ _12 = const 3_usize; -+ _13 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable]; - } - - bb2: { -- _9 = (*_10)[_11]; -+ _9 = (*_10)[1 of 2]; - StorageDead(_11); - StorageDead(_10); - _0 = const (); - StorageDead(_9); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff deleted file mode 100644 index 759a793fbf328..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff +++ /dev/null @@ -1,77 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: &[u32]; - let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _10: &[u32]; - let _11: usize; - let mut _12: usize; - let mut _13: bool; - let mut _14: &[u32; 3]; - scope 1 { - debug local => _1; - let _9: u32; - scope 2 { - debug constant => _9; - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - _14 = const _; - _4 = _14; - _3 = _4; - _2 = move _3 as &[u32] (PointerCoercion(Unsize)); - StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _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]; -+ _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]; - StorageDead(_6); - StorageDead(_4); - StorageDead(_2); - StorageLive(_9); - StorageLive(_10); - _10 = const _; - StorageLive(_11); - _11 = const 1_usize; -- _12 = Len((*_10)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind continue]; -+ _12 = const 3_usize; -+ _13 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue]; - } - - bb2: { -- _9 = (*_10)[_11]; -+ _9 = (*_10)[1 of 2]; - StorageDead(_11); - StorageDead(_10); - _0 = const (); - StorageDead(_9); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff deleted file mode 100644 index e99b413f708c4..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff +++ /dev/null @@ -1,77 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: &[u32]; - let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _10: &[u32]; - let _11: usize; - let mut _12: usize; - let mut _13: bool; - let mut _14: &[u32; 3]; - scope 1 { - debug local => _1; - let _9: u32; - scope 2 { - debug constant => _9; - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - _14 = const _; - _4 = _14; - _3 = _4; - _2 = move _3 as &[u32] (PointerCoercion(Unsize)); - StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _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]; -+ _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]; - StorageDead(_6); - StorageDead(_4); - StorageDead(_2); - StorageLive(_9); - StorageLive(_10); - _10 = const _; - StorageLive(_11); - _11 = const 1_usize; -- _12 = Len((*_10)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind unreachable]; -+ _12 = const 3_usize; -+ _13 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable]; - } - - bb2: { -- _9 = (*_10)[_11]; -+ _9 = (*_10)[1 of 2]; - StorageDead(_11); - StorageDead(_10); - _0 = const (); - StorageDead(_9); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff deleted file mode 100644 index 759a793fbf328..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff +++ /dev/null @@ -1,77 +0,0 @@ -- // MIR for `main` before DataflowConstProp -+ // MIR for `main` after DataflowConstProp - - fn main() -> () { - let mut _0: (); - let _1: u32; - let mut _2: &[u32]; - let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _10: &[u32]; - let _11: usize; - let mut _12: usize; - let mut _13: bool; - let mut _14: &[u32; 3]; - scope 1 { - debug local => _1; - let _9: u32; - scope 2 { - debug constant => _9; - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - _14 = const _; - _4 = _14; - _3 = _4; - _2 = move _3 as &[u32] (PointerCoercion(Unsize)); - StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _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]; -+ _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]; - StorageDead(_6); - StorageDead(_4); - StorageDead(_2); - StorageLive(_9); - StorageLive(_10); - _10 = const _; - StorageLive(_11); - _11 = const 1_usize; -- _12 = Len((*_10)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind continue]; -+ _12 = const 3_usize; -+ _13 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue]; - } - - bb2: { -- _9 = (*_10)[_11]; -+ _9 = (*_10)[1 of 2]; - StorageDead(_11); - StorageDead(_10); - _0 = const (); - StorageDead(_9); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs deleted file mode 100644 index 86266ef5d4e60..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/slice_len.rs +++ /dev/null @@ -1,13 +0,0 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// unit-test: DataflowConstProp -// compile-flags: -Zmir-enable-passes=+InstSimplify -// EMIT_MIR_FOR_EACH_BIT_WIDTH - -// EMIT_MIR slice_len.main.DataflowConstProp.diff -fn main() { - let local = (&[1u32, 2, 3] as &[u32])[1]; - - const SLICE: &[u32] = &[1, 2, 3]; - let constant = SLICE[1]; -} diff --git a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff deleted file mode 100644 index 52f096ac0e4ea..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `from_char` before DataflowConstProp -+ // MIR for `from_char` after DataflowConstProp - - fn from_char() -> i32 { - let mut _0: i32; - scope 1 { - } - - bb0: { -- _0 = const 'R' as i32 (Transmute); -+ _0 = const 82_i32; - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff deleted file mode 100644 index 52f096ac0e4ea..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `from_char` before DataflowConstProp -+ // MIR for `from_char` after DataflowConstProp - - fn from_char() -> i32 { - let mut _0: i32; - scope 1 { - } - - bb0: { -- _0 = const 'R' as i32 (Transmute); -+ _0 = const 82_i32; - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff deleted file mode 100644 index 3972eb209a169..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `invalid_bool` before DataflowConstProp -+ // MIR for `invalid_bool` after DataflowConstProp - - fn invalid_bool() -> bool { - let mut _0: bool; - scope 1 { - } - - bb0: { -- _0 = const -1_i8 as bool (Transmute); -+ _0 = const {transmute(0xff): bool}; - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff deleted file mode 100644 index 3972eb209a169..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `invalid_bool` before DataflowConstProp -+ // MIR for `invalid_bool` after DataflowConstProp - - fn invalid_bool() -> bool { - let mut _0: bool; - scope 1 { - } - - bb0: { -- _0 = const -1_i8 as bool (Transmute); -+ _0 = const {transmute(0xff): bool}; - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff deleted file mode 100644 index 837dabde42a58..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `invalid_char` before DataflowConstProp -+ // MIR for `invalid_char` after DataflowConstProp - - fn invalid_char() -> char { - let mut _0: char; - scope 1 { - } - - bb0: { -- _0 = const _ as char (Transmute); -+ _0 = const {transmute(0x7fffffff): char}; - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff deleted file mode 100644 index 837dabde42a58..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `invalid_char` before DataflowConstProp -+ // MIR for `invalid_char` after DataflowConstProp - - fn invalid_char() -> char { - let mut _0: char; - scope 1 { - } - - bb0: { -- _0 = const _ as char (Transmute); -+ _0 = const {transmute(0x7fffffff): char}; - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff deleted file mode 100644 index 6091e169e8eb3..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,18 +0,0 @@ -- // MIR for `less_as_i8` before DataflowConstProp -+ // MIR for `less_as_i8` after DataflowConstProp - - fn less_as_i8() -> i8 { - let mut _0: i8; - let mut _1: std::cmp::Ordering; - scope 1 { - } - - bb0: { - StorageLive(_1); - _1 = Less; - _0 = move _1 as i8 (Transmute); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff deleted file mode 100644 index 6091e169e8eb3..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,18 +0,0 @@ -- // MIR for `less_as_i8` before DataflowConstProp -+ // MIR for `less_as_i8` after DataflowConstProp - - fn less_as_i8() -> i8 { - let mut _0: i8; - let mut _1: std::cmp::Ordering; - scope 1 { - } - - bb0: { - StorageLive(_1); - _1 = Less; - _0 = move _1 as i8 (Transmute); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.rs b/tests/mir-opt/dataflow-const-prop/transmute.rs deleted file mode 100644 index bb85e4586787e..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.rs +++ /dev/null @@ -1,85 +0,0 @@ -// unit-test: DataflowConstProp -// compile-flags: -O --crate-type=lib -// ignore-endian-big -// EMIT_MIR_FOR_EACH_BIT_WIDTH - -use std::mem::transmute; - -// EMIT_MIR transmute.less_as_i8.DataflowConstProp.diff -pub fn less_as_i8() -> i8 { - // CHECK-LABEL: fn less_as_i8( - // FIXME-CHECK: _0 = const -1_i8; - unsafe { transmute(std::cmp::Ordering::Less) } -} - -// EMIT_MIR transmute.from_char.DataflowConstProp.diff -pub fn from_char() -> i32 { - // CHECK-LABEL: fn from_char( - // CHECK: _0 = const 82_i32; - unsafe { transmute('R') } -} - -// EMIT_MIR transmute.valid_char.DataflowConstProp.diff -pub fn valid_char() -> char { - // CHECK-LABEL: fn valid_char( - // CHECK: _0 = const 'R'; - unsafe { transmute(0x52_u32) } -} - -// EMIT_MIR transmute.invalid_char.DataflowConstProp.diff -pub unsafe fn invalid_char() -> char { - // CHECK-LABEL: fn invalid_char( - // CHECK: _0 = const {transmute(0x7fffffff): char}; - unsafe { transmute(i32::MAX) } -} - -// EMIT_MIR transmute.invalid_bool.DataflowConstProp.diff -pub unsafe fn invalid_bool() -> bool { - // CHECK-LABEL: fn invalid_bool( - // CHECK: _0 = const {transmute(0xff): bool}; - unsafe { transmute(-1_i8) } -} - -// EMIT_MIR transmute.undef_union_as_integer.DataflowConstProp.diff -pub unsafe fn undef_union_as_integer() -> u32 { - // CHECK-LABEL: fn undef_union_as_integer( - // CHECK: _1 = Union32 { - // CHECK: _0 = move _1 as u32 (Transmute); - union Union32 { value: u32, unit: () } - unsafe { transmute(Union32 { unit: () }) } -} - -// EMIT_MIR transmute.unreachable_direct.DataflowConstProp.diff -pub unsafe fn unreachable_direct() -> ! { - // CHECK-LABEL: fn unreachable_direct( - // CHECK: = const (); - // CHECK: = const ZeroSized: Never; - let x: Never = unsafe { transmute(()) }; - match x {} -} - -// EMIT_MIR transmute.unreachable_ref.DataflowConstProp.diff -pub unsafe fn unreachable_ref() -> ! { - // CHECK-LABEL: fn unreachable_ref( - // CHECK: = const {0x1 as &Never}; - let x: &Never = unsafe { transmute(1_usize) }; - match *x {} -} - -// EMIT_MIR transmute.unreachable_mut.DataflowConstProp.diff -pub unsafe fn unreachable_mut() -> ! { - // CHECK-LABEL: fn unreachable_mut( - // CHECK: = const {0x1 as &mut Never}; - let x: &mut Never = unsafe { transmute(1_usize) }; - match *x {} -} - -// EMIT_MIR transmute.unreachable_box.DataflowConstProp.diff -pub unsafe fn unreachable_box() -> ! { - // CHECK-LABEL: fn unreachable_box( - // CHECK: = const Box::( - let x: Box = unsafe { transmute(1_usize) }; - match *x {} -} - -enum Never {} diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff deleted file mode 100644 index fb28aa8f6d9cf..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,24 +0,0 @@ -- // MIR for `undef_union_as_integer` before DataflowConstProp -+ // MIR for `undef_union_as_integer` after DataflowConstProp - - fn undef_union_as_integer() -> u32 { - let mut _0: u32; - let mut _1: undef_union_as_integer::Union32; - let mut _2: (); - scope 1 { - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = (); -- _1 = Union32 { value: move _2 }; -+ _2 = const (); -+ _1 = Union32 { value: const () }; - StorageDead(_2); - _0 = move _1 as u32 (Transmute); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff deleted file mode 100644 index fb28aa8f6d9cf..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,24 +0,0 @@ -- // MIR for `undef_union_as_integer` before DataflowConstProp -+ // MIR for `undef_union_as_integer` after DataflowConstProp - - fn undef_union_as_integer() -> u32 { - let mut _0: u32; - let mut _1: undef_union_as_integer::Union32; - let mut _2: (); - scope 1 { - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = (); -- _1 = Union32 { value: move _2 }; -+ _2 = const (); -+ _1 = Union32 { value: const () }; - StorageDead(_2); - _0 = move _1 as u32 (Transmute); - StorageDead(_1); - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff deleted file mode 100644 index 5d17c47ae6664..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,22 +0,0 @@ -- // MIR for `unreachable_box` before DataflowConstProp -+ // MIR for `unreachable_box` after DataflowConstProp - - fn unreachable_box() -> ! { - let mut _0: !; - let _1: std::boxed::Box; - let mut _2: *const Never; - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); -- _1 = const 1_usize as std::boxed::Box (Transmute); -+ _1 = const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); - _2 = (((_1.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const Never); - unreachable; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff deleted file mode 100644 index 5d17c47ae6664..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,22 +0,0 @@ -- // MIR for `unreachable_box` before DataflowConstProp -+ // MIR for `unreachable_box` after DataflowConstProp - - fn unreachable_box() -> ! { - let mut _0: !; - let _1: std::boxed::Box; - let mut _2: *const Never; - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); -- _1 = const 1_usize as std::boxed::Box (Transmute); -+ _1 = const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); - _2 = (((_1.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const Never); - unreachable; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff deleted file mode 100644 index c8d4d6edba1e8..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,24 +0,0 @@ -- // MIR for `unreachable_direct` before DataflowConstProp -+ // MIR for `unreachable_direct` after DataflowConstProp - - fn unreachable_direct() -> ! { - let mut _0: !; - let _1: Never; - let mut _2: (); - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = (); -- _1 = move _2 as Never (Transmute); -+ _2 = const (); -+ _1 = const ZeroSized: Never; - unreachable; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff deleted file mode 100644 index c8d4d6edba1e8..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,24 +0,0 @@ -- // MIR for `unreachable_direct` before DataflowConstProp -+ // MIR for `unreachable_direct` after DataflowConstProp - - fn unreachable_direct() -> ! { - let mut _0: !; - let _1: Never; - let mut _2: (); - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = (); -- _1 = move _2 as Never (Transmute); -+ _2 = const (); -+ _1 = const ZeroSized: Never; - unreachable; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff deleted file mode 100644 index 2ffaeea72db27..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,24 +0,0 @@ -- // MIR for `unreachable_mut` before DataflowConstProp -+ // MIR for `unreachable_mut` after DataflowConstProp - - fn unreachable_mut() -> ! { - let mut _0: !; - let _1: &mut Never; - let mut _2: &mut Never; - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = const 1_usize as &mut Never (Transmute); -+ _2 = const {0x1 as &mut Never}; - _1 = &mut (*_2); - StorageDead(_2); - unreachable; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff deleted file mode 100644 index 2ffaeea72db27..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,24 +0,0 @@ -- // MIR for `unreachable_mut` before DataflowConstProp -+ // MIR for `unreachable_mut` after DataflowConstProp - - fn unreachable_mut() -> ! { - let mut _0: !; - let _1: &mut Never; - let mut _2: &mut Never; - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = const 1_usize as &mut Never (Transmute); -+ _2 = const {0x1 as &mut Never}; - _1 = &mut (*_2); - StorageDead(_2); - unreachable; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff deleted file mode 100644 index 31fcaafc5bca3..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,20 +0,0 @@ -- // MIR for `unreachable_ref` before DataflowConstProp -+ // MIR for `unreachable_ref` after DataflowConstProp - - fn unreachable_ref() -> ! { - let mut _0: !; - let _1: &Never; - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); -- _1 = const 1_usize as &Never (Transmute); -+ _1 = const {0x1 as &Never}; - unreachable; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff deleted file mode 100644 index 31fcaafc5bca3..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,20 +0,0 @@ -- // MIR for `unreachable_ref` before DataflowConstProp -+ // MIR for `unreachable_ref` after DataflowConstProp - - fn unreachable_ref() -> ! { - let mut _0: !; - let _1: &Never; - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); -- _1 = const 1_usize as &Never (Transmute); -+ _1 = const {0x1 as &Never}; - unreachable; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff deleted file mode 100644 index 402ef754a6484..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `valid_char` before DataflowConstProp -+ // MIR for `valid_char` after DataflowConstProp - - fn valid_char() -> char { - let mut _0: char; - scope 1 { - } - - bb0: { -- _0 = const 82_u32 as char (Transmute); -+ _0 = const 'R'; - return; - } - } - diff --git a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff deleted file mode 100644 index 402ef754a6484..0000000000000 --- a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `valid_char` before DataflowConstProp -+ // MIR for `valid_char` after DataflowConstProp - - fn valid_char() -> char { - let mut _0: char; - scope 1 { - } - - bb0: { -- _0 = const 82_u32 as char (Transmute); -+ _0 = const 'R'; - return; - } - } - diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff index 8f799b33f45d9..cfa0e7bdcc973 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff @@ -5,16 +5,21 @@ debug x => _1; let mut _0: (); let _2: (); -- let mut _3: i32; -- let mut _4: i32; + let mut _3: i32; + let mut _4: i32; bb0: { StorageLive(_2); -- _2 = use_both(_1, _1) -> [return: bb1, unwind unreachable]; -+ _2 = use_both(_1, move _1) -> [return: bb1, unwind unreachable]; + StorageLive(_3); + _3 = _1; + StorageLive(_4); + _4 = _1; + _2 = use_both(move _3, move _4) -> [return: bb1, unwind unreachable]; } bb1: { + StorageDead(_4); + StorageDead(_3); StorageDead(_2); _0 = const (); return; diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff index 0551d663b50f2..4921e15a5903f 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff @@ -5,16 +5,21 @@ debug x => _1; let mut _0: (); let _2: (); -- let mut _3: i32; -- let mut _4: i32; + let mut _3: i32; + let mut _4: i32; bb0: { StorageLive(_2); -- _2 = use_both(_1, _1) -> [return: bb1, unwind continue]; -+ _2 = use_both(_1, move _1) -> [return: bb1, unwind continue]; + StorageLive(_3); + _3 = _1; + StorageLive(_4); + _4 = _1; + _2 = use_both(move _3, move _4) -> [return: bb1, unwind continue]; } bb1: { + StorageDead(_4); + StorageDead(_3); StorageDead(_2); _0 = const (); return; 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 142e08f4d6c3f..993e0f1d1a67d 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,12 +4,13 @@ fn main() -> () { let mut _0: (); let _1: main::Un; + let mut _2: u32; scope 1 { debug un => _1; scope 2 { } scope 4 (inlined std::mem::drop::) { - debug _x => const 1_u32; + debug _x => _2; } } scope 3 (inlined val) { @@ -18,6 +19,9 @@ bb0: { StorageLive(_1); _1 = Un { us: const 1_u32 }; + StorageLive(_2); + _2 = (_1.0: u32); + StorageDead(_2); 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 142e08f4d6c3f..993e0f1d1a67d 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,12 +4,13 @@ fn main() -> () { let mut _0: (); let _1: main::Un; + let mut _2: u32; scope 1 { debug un => _1; scope 2 { } scope 4 (inlined std::mem::drop::) { - debug _x => const 1_u32; + debug _x => _2; } } scope 3 (inlined val) { @@ -18,6 +19,9 @@ bb0: { StorageLive(_1); _1 = Un { us: const 1_u32 }; + StorageLive(_2); + _2 = (_1.0: u32); + StorageDead(_2); StorageDead(_1); return; } diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff index 298a608489937..9d4bfcffcf05e 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff @@ -9,17 +9,10 @@ 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 _9: core::num::flt2dec::Sign; + let mut _10: u32; + let mut _11: u32; + let mut _12: core::num::flt2dec::Sign; scope 1 { debug force_sign => _4; let _5: core::num::flt2dec::Sign; @@ -36,32 +29,30 @@ } scope 4 (inlined Formatter::<'_>::sign_plus) { debug self => _1; - let mut _20: u32; - let mut _21: u32; + let mut _13: u32; + let mut _14: 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(_13); + StorageLive(_14); + _14 = ((*_1).0: u32); + _13 = BitAnd(move _14, const 1_u32); + StorageDead(_14); + _4 = Ne(move _13, const 0_u32); + StorageDead(_13); StorageLive(_5); switchInt(_4) -> [0: bb2, otherwise: bb1]; } bb1: { -- _5 = MinusPlus; -+ _5 = const MinusPlus; + _5 = const MinusPlus; goto -> bb3; } bb2: { -- _5 = Minus; -+ _5 = const Minus; + _5 = const Minus; goto -> bb3; } @@ -74,30 +65,30 @@ bb4: { _8 = ((_6 as Some).0: usize); + StorageLive(_9); + _9 = _5; + StorageLive(_10); StorageLive(_11); - _11 = _5; - StorageLive(_12); - StorageLive(_13); - _13 = _8 as u32 (IntToInt); - _12 = Add(move _13, const 1_u32); - StorageDead(_13); - _0 = float_to_exponential_common_exact::(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind unreachable]; + _11 = _8 as u32 (IntToInt); + _10 = Add(move _11, const 1_u32); + StorageDead(_11); + _0 = float_to_exponential_common_exact::(_1, _2, move _9, move _10, _3) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_12); - StorageDead(_11); + StorageDead(_10); + StorageDead(_9); goto -> bb8; } bb6: { - StorageLive(_18); - _18 = _5; - _0 = float_to_exponential_common_shortest::(_1, _2, move _18, _3) -> [return: bb7, unwind unreachable]; + StorageLive(_12); + _12 = _5; + _0 = float_to_exponential_common_shortest::(_1, _2, move _12, _3) -> [return: bb7, unwind unreachable]; } bb7: { - StorageDead(_18); + StorageDead(_12); goto -> bb8; } diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff index 037f4f7cfac25..594609fade9d5 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff @@ -9,17 +9,10 @@ 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 _9: core::num::flt2dec::Sign; + let mut _10: u32; + let mut _11: u32; + let mut _12: core::num::flt2dec::Sign; scope 1 { debug force_sign => _4; let _5: core::num::flt2dec::Sign; @@ -36,32 +29,30 @@ } scope 4 (inlined Formatter::<'_>::sign_plus) { debug self => _1; - let mut _20: u32; - let mut _21: u32; + let mut _13: u32; + let mut _14: 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(_13); + StorageLive(_14); + _14 = ((*_1).0: u32); + _13 = BitAnd(move _14, const 1_u32); + StorageDead(_14); + _4 = Ne(move _13, const 0_u32); + StorageDead(_13); StorageLive(_5); switchInt(_4) -> [0: bb2, otherwise: bb1]; } bb1: { -- _5 = MinusPlus; -+ _5 = const MinusPlus; + _5 = const MinusPlus; goto -> bb3; } bb2: { -- _5 = Minus; -+ _5 = const Minus; + _5 = const Minus; goto -> bb3; } @@ -74,30 +65,30 @@ bb4: { _8 = ((_6 as Some).0: usize); + StorageLive(_9); + _9 = _5; + StorageLive(_10); StorageLive(_11); - _11 = _5; - StorageLive(_12); - StorageLive(_13); - _13 = _8 as u32 (IntToInt); - _12 = Add(move _13, const 1_u32); - StorageDead(_13); - _0 = float_to_exponential_common_exact::(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind continue]; + _11 = _8 as u32 (IntToInt); + _10 = Add(move _11, const 1_u32); + StorageDead(_11); + _0 = float_to_exponential_common_exact::(_1, _2, move _9, move _10, _3) -> [return: bb5, unwind continue]; } bb5: { - StorageDead(_12); - StorageDead(_11); + StorageDead(_10); + StorageDead(_9); goto -> bb8; } bb6: { - StorageLive(_18); - _18 = _5; - _0 = float_to_exponential_common_shortest::(_1, _2, move _18, _3) -> [return: bb7, unwind continue]; + StorageLive(_12); + _12 = _5; + _0 = float_to_exponential_common_shortest::(_1, _2, move _12, _3) -> [return: bb7, unwind continue]; } bb7: { - StorageDead(_18); + StorageDead(_12); goto -> bb8; } diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff index 42dd7ba55cf45..f85e370f98879 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff @@ -7,7 +7,7 @@ let mut _2: std::pin::Pin<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>; let mut _3: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; let mut _4: {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; -+ let mut _5: bool; ++ let mut _6: bool; scope 1 { debug _r => _1; } @@ -15,6 +15,7 @@ + } + scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new) { + debug pointer => _3; ++ let mut _5: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; + scope 4 { + scope 5 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) { + debug pointer => _3; @@ -22,10 +23,10 @@ + } + } + scope 6 (inlined g::{closure#0}) { -+ debug a => _5; -+ let mut _6: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; -+ let mut _7: u32; -+ let mut _8: i32; ++ debug a => _6; ++ let mut _7: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; ++ let mut _8: u32; ++ let mut _9: i32; + } bb0: { @@ -36,15 +37,17 @@ - _4 = g() -> [return: bb1, unwind unreachable]; + _4 = {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8 (#0)}; + _3 = &mut _4; ++ StorageLive(_5); + _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}> { pointer: move _3 }; ++ StorageDead(_5); + StorageDead(_3); -+ StorageLive(_5); -+ _5 = const false; + StorageLive(_6); ++ _6 = const false; + StorageLive(_7); -+ _6 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}); -+ _7 = discriminant((*_6)); -+ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9]; ++ StorageLive(_8); ++ _7 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}); ++ _8 = discriminant((*_7)); ++ switchInt(move _8) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9]; } bb1: { @@ -59,9 +62,9 @@ bb2: { - StorageDead(_3); - _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine>::resume(move _2, const false) -> [return: bb3, unwind unreachable]; ++ StorageDead(_8); + StorageDead(_7); + StorageDead(_6); -+ StorageDead(_5); + StorageDead(_2); + drop(_4) -> [return: bb1, unwind unreachable]; } @@ -69,8 +72,8 @@ bb3: { - StorageDead(_2); - drop(_4) -> [return: bb4, unwind unreachable]; -+ StorageLive(_8); -+ switchInt(_5) -> [0: bb4, otherwise: bb5]; ++ StorageLive(_9); ++ switchInt(_6) -> [0: bb4, otherwise: bb5]; } bb4: { @@ -78,18 +81,18 @@ - _0 = const (); - StorageDead(_1); - return; -+ _8 = const 13_i32; ++ _9 = const 13_i32; + goto -> bb6; + } + + bb5: { -+ _8 = const 7_i32; ++ _9 = const 7_i32; + goto -> bb6; + } + + bb6: { -+ _1 = CoroutineState::::Yielded(move _8); -+ discriminant((*_6)) = 3; ++ _1 = CoroutineState::::Yielded(move _9); ++ discriminant((*_7)) = 3; + goto -> bb2; + } + @@ -98,10 +101,10 @@ + } + + bb8: { -+ StorageLive(_8); -+ StorageDead(_8); -+ _1 = CoroutineState::::Complete(_5); -+ discriminant((*_6)) = 1; ++ StorageLive(_9); ++ StorageDead(_9); ++ _1 = CoroutineState::::Complete(_6); ++ discriminant((*_7)) = 1; + goto -> bb2; + } + diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff index 7b8958c13fc5d..5a30e4be0bc09 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff @@ -7,7 +7,7 @@ let mut _2: std::pin::Pin<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>; let mut _3: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; let mut _4: {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; -+ let mut _5: bool; ++ let mut _6: bool; scope 1 { debug _r => _1; } @@ -15,6 +15,7 @@ + } + scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new) { + debug pointer => _3; ++ let mut _5: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; + scope 4 { + scope 5 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) { + debug pointer => _3; @@ -22,10 +23,10 @@ + } + } + scope 6 (inlined g::{closure#0}) { -+ debug a => _5; -+ let mut _6: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; -+ let mut _7: u32; -+ let mut _8: i32; ++ debug a => _6; ++ let mut _7: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}; ++ let mut _8: u32; ++ let mut _9: i32; + } bb0: { @@ -36,15 +37,17 @@ - _4 = g() -> [return: bb1, unwind continue]; + _4 = {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8 (#0)}; + _3 = &mut _4; ++ StorageLive(_5); + _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}> { pointer: move _3 }; ++ StorageDead(_5); + StorageDead(_3); -+ StorageLive(_5); -+ _5 = const false; + StorageLive(_6); ++ _6 = const false; + StorageLive(_7); -+ _6 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}); -+ _7 = discriminant((*_6)); -+ switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11]; ++ StorageLive(_8); ++ _7 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}); ++ _8 = discriminant((*_7)); ++ switchInt(move _8) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11]; } bb1: { @@ -75,9 +78,9 @@ - _0 = const (); - StorageDead(_1); - return; ++ StorageDead(_8); + StorageDead(_7); + StorageDead(_6); -+ StorageDead(_5); + StorageDead(_2); + drop(_4) -> [return: bb1, unwind: bb3]; } @@ -85,25 +88,25 @@ - bb5 (cleanup): { - drop(_4) -> [return: bb6, unwind terminate(cleanup)]; + bb5: { -+ StorageLive(_8); -+ switchInt(_5) -> [0: bb6, otherwise: bb7]; ++ StorageLive(_9); ++ switchInt(_6) -> [0: bb6, otherwise: bb7]; } - bb6 (cleanup): { - resume; + bb6: { -+ _8 = const 13_i32; ++ _9 = const 13_i32; + goto -> bb8; + } + + bb7: { -+ _8 = const 7_i32; ++ _9 = const 7_i32; + goto -> bb8; + } + + bb8: { -+ _1 = CoroutineState::::Yielded(move _8); -+ discriminant((*_6)) = 3; ++ _1 = CoroutineState::::Yielded(move _9); ++ discriminant((*_7)) = 3; + goto -> bb4; + } + @@ -112,10 +115,10 @@ + } + + bb10: { -+ StorageLive(_8); -+ StorageDead(_8); -+ _1 = CoroutineState::::Complete(_5); -+ discriminant((*_6)) = 1; ++ StorageLive(_9); ++ StorageDead(_9); ++ _1 = CoroutineState::::Complete(_6); ++ discriminant((*_7)) = 1; + goto -> bb4; + } + diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff index da45ebcb4d85c..2bbb830fc7790 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff @@ -40,7 +40,7 @@ + + bb2: { + StorageDead(_5); -+ _1 = (move _4, move _6); ++ _1 = (_4, _6); + drop(_2) -> [return: bb3, unwind unreachable]; + } + diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff index d65c65e5fd032..bc4f2d24df0b5 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff @@ -43,7 +43,7 @@ + StorageDead(_5); + StorageLive(_7); + _7 = move _4; -+ _1 = (move _7, move _6); ++ _1 = (move _7, _6); + StorageDead(_7); + StorageDead(_4); + drop(_2) -> [return: bb3, unwind continue]; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff index 1ab1d01e5faca..9b71d0a79414d 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff @@ -11,6 +11,8 @@ + debug self => _3; + debug rhs => _4; + let mut _5: u64; ++ let mut _6: u64; ++ let mut _7: u32; + scope 2 { + } + } @@ -25,8 +27,12 @@ - - bb1: { + StorageLive(_5); -+ _5 = _4 as u64 (IntToInt); -+ _0 = ShlUnchecked(_3, move _5); ++ StorageLive(_7); ++ StorageLive(_6); ++ _6 = _4 as u64 (IntToInt); ++ _0 = ShlUnchecked(_3, move _6); ++ StorageDead(_6); ++ StorageDead(_7); + StorageDead(_5); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff index d71b5c4a626ef..f567087a8ab1c 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff @@ -11,6 +11,8 @@ + debug self => _3; + debug rhs => _4; + let mut _5: u64; ++ let mut _6: u64; ++ let mut _7: u32; + scope 2 { + } + } @@ -25,8 +27,12 @@ - - bb1: { + StorageLive(_5); -+ _5 = _4 as u64 (IntToInt); -+ _0 = ShlUnchecked(_3, move _5); ++ StorageLive(_7); ++ StorageLive(_6); ++ _6 = _4 as u64 (IntToInt); ++ _0 = ShlUnchecked(_3, move _6); ++ StorageDead(_6); ++ StorageDead(_7); + StorageDead(_5); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir index 65b832497f9d5..43bade9965e5d 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir @@ -4,6 +4,8 @@ fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { debug a => _1; debug b => _2; let mut _0: u64; + let mut _4: u64; + let mut _5: u32; scope 1 (inlined core::num::::unchecked_shl) { debug self => _1; debug rhs => _2; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir index 65b832497f9d5..43bade9965e5d 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir @@ -4,6 +4,8 @@ fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { debug a => _1; debug b => _2; let mut _0: u64; + let mut _4: u64; + let mut _5: u32; scope 1 (inlined core::num::::unchecked_shl) { debug self => _1; debug rhs => _2; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff index d052219661b38..0ab190d4df951 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff @@ -11,7 +11,10 @@ + debug self => _3; + debug rhs => _4; + let mut _5: u16; -+ let mut _6: bool; ++ let mut _6: u16; ++ let mut _7: bool; ++ let mut _8: u32; ++ let mut _9: u32; + scope 2 { + } + } @@ -26,12 +29,18 @@ - - bb1: { + StorageLive(_5); ++ StorageLive(_8); ++ StorageLive(_9); + StorageLive(_6); -+ _6 = Le(_4, const 65535_u32); -+ assume(move _6); ++ StorageLive(_7); ++ _7 = Le(_4, const 65535_u32); ++ assume(move _7); ++ StorageDead(_7); ++ _6 = _4 as u16 (IntToInt); ++ _0 = ShlUnchecked(_3, move _6); + StorageDead(_6); -+ _5 = _4 as u16 (IntToInt); -+ _0 = ShlUnchecked(_3, move _5); ++ StorageDead(_9); ++ StorageDead(_8); + StorageDead(_5); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff index 67a5ac2483b64..4b48591944393 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff @@ -11,7 +11,10 @@ + debug self => _3; + debug rhs => _4; + let mut _5: u16; -+ let mut _6: bool; ++ let mut _6: u16; ++ let mut _7: bool; ++ let mut _8: u32; ++ let mut _9: u32; + scope 2 { + } + } @@ -26,12 +29,18 @@ - - bb1: { + StorageLive(_5); ++ StorageLive(_8); ++ StorageLive(_9); + StorageLive(_6); -+ _6 = Le(_4, const 65535_u32); -+ assume(move _6); ++ StorageLive(_7); ++ _7 = Le(_4, const 65535_u32); ++ assume(move _7); ++ StorageDead(_7); ++ _6 = _4 as u16 (IntToInt); ++ _0 = ShlUnchecked(_3, move _6); + StorageDead(_6); -+ _5 = _4 as u16 (IntToInt); -+ _0 = ShlUnchecked(_3, move _5); ++ StorageDead(_9); ++ StorageDead(_8); + StorageDead(_5); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir index f9dff62e0c8a8..38bfe3439605a 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir @@ -4,6 +4,8 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { debug a => _1; debug b => _2; let mut _0: u16; + let mut _5: u16; + let mut _6: u32; scope 1 (inlined core::num::::unchecked_shl) { debug self => _1; debug rhs => _2; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir index f9dff62e0c8a8..38bfe3439605a 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir @@ -4,6 +4,8 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { debug a => _1; debug b => _2; let mut _0: u16; + let mut _5: u16; + let mut _6: u32; scope 1 (inlined core::num::::unchecked_shl) { debug self => _1; debug rhs => _2; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff index 1e83fec4f3d00..40b218176a0f8 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff @@ -11,6 +11,8 @@ + debug self => _3; + debug rhs => _4; + let mut _5: i64; ++ let mut _6: i64; ++ let mut _7: u32; + scope 2 { + } + } @@ -25,8 +27,12 @@ - - bb1: { + StorageLive(_5); -+ _5 = _4 as i64 (IntToInt); -+ _0 = ShrUnchecked(_3, move _5); ++ StorageLive(_7); ++ StorageLive(_6); ++ _6 = _4 as i64 (IntToInt); ++ _0 = ShrUnchecked(_3, move _6); ++ StorageDead(_6); ++ StorageDead(_7); + StorageDead(_5); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff index 6aafb61dc557d..6c1f4ad72e74d 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff @@ -11,6 +11,8 @@ + debug self => _3; + debug rhs => _4; + let mut _5: i64; ++ let mut _6: i64; ++ let mut _7: u32; + scope 2 { + } + } @@ -25,8 +27,12 @@ - - bb1: { + StorageLive(_5); -+ _5 = _4 as i64 (IntToInt); -+ _0 = ShrUnchecked(_3, move _5); ++ StorageLive(_7); ++ StorageLive(_6); ++ _6 = _4 as i64 (IntToInt); ++ _0 = ShrUnchecked(_3, move _6); ++ StorageDead(_6); ++ StorageDead(_7); + StorageDead(_5); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir index 7524ec4970e4b..ef86b4daa7aaa 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir @@ -4,6 +4,8 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { debug a => _1; debug b => _2; let mut _0: i64; + let mut _4: i64; + let mut _5: u32; scope 1 (inlined core::num::::unchecked_shr) { debug self => _1; debug rhs => _2; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir index 7524ec4970e4b..ef86b4daa7aaa 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir @@ -4,6 +4,8 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { debug a => _1; debug b => _2; let mut _0: i64; + let mut _4: i64; + let mut _5: u32; scope 1 (inlined core::num::::unchecked_shr) { debug self => _1; debug rhs => _2; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff index 15b36b284de52..c5d0b5f5712a5 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff @@ -11,7 +11,10 @@ + debug self => _3; + debug rhs => _4; + let mut _5: i16; -+ let mut _6: bool; ++ let mut _6: i16; ++ let mut _7: bool; ++ let mut _8: u32; ++ let mut _9: u32; + scope 2 { + } + } @@ -26,12 +29,18 @@ - - bb1: { + StorageLive(_5); ++ StorageLive(_8); ++ StorageLive(_9); + StorageLive(_6); -+ _6 = Le(_4, const 32767_u32); -+ assume(move _6); ++ StorageLive(_7); ++ _7 = Le(_4, const 32767_u32); ++ assume(move _7); ++ StorageDead(_7); ++ _6 = _4 as i16 (IntToInt); ++ _0 = ShrUnchecked(_3, move _6); + StorageDead(_6); -+ _5 = _4 as i16 (IntToInt); -+ _0 = ShrUnchecked(_3, move _5); ++ StorageDead(_9); ++ StorageDead(_8); + StorageDead(_5); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff index 8629f92dbad4a..1f91bbcd8af2f 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff @@ -11,7 +11,10 @@ + debug self => _3; + debug rhs => _4; + let mut _5: i16; -+ let mut _6: bool; ++ let mut _6: i16; ++ let mut _7: bool; ++ let mut _8: u32; ++ let mut _9: u32; + scope 2 { + } + } @@ -26,12 +29,18 @@ - - bb1: { + StorageLive(_5); ++ StorageLive(_8); ++ StorageLive(_9); + StorageLive(_6); -+ _6 = Le(_4, const 32767_u32); -+ assume(move _6); ++ StorageLive(_7); ++ _7 = Le(_4, const 32767_u32); ++ assume(move _7); ++ StorageDead(_7); ++ _6 = _4 as i16 (IntToInt); ++ _0 = ShrUnchecked(_3, move _6); + StorageDead(_6); -+ _5 = _4 as i16 (IntToInt); -+ _0 = ShrUnchecked(_3, move _5); ++ StorageDead(_9); ++ StorageDead(_8); + StorageDead(_5); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir index 65fa0d956c063..39150da0f1de8 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir @@ -4,6 +4,8 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { debug a => _1; debug b => _2; let mut _0: i16; + let mut _5: i16; + let mut _6: u32; scope 1 (inlined core::num::::unchecked_shr) { debug self => _1; debug rhs => _2; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir index 65fa0d956c063..39150da0f1de8 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir @@ -4,6 +4,8 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { debug a => _1; debug b => _2; let mut _0: i16; + let mut _5: i16; + let mut _6: u32; scope 1 (inlined core::num::::unchecked_shr) { debug self => _1; debug rhs => _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..1047024846dfb 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 @@ -9,14 +9,16 @@ + debug self => _2; + let mut _3: &std::option::Option; + let mut _4: isize; -+ let mut _5: bool; ++ let _5: T; + scope 2 { + debug val => _0; + } + scope 3 { + scope 5 (inlined unreachable_unchecked) { ++ let mut _7: bool; + scope 6 { + scope 7 (inlined unreachable_unchecked::runtime) { ++ let _6: !; + } + } + } @@ -30,16 +32,28 @@ StorageLive(_2); _2 = move _1; - _0 = Option::::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable]; -- } -- -- bb1: { + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); ++ StorageLive(_6); + _4 = discriminant(_2); -+ _5 = Eq(_4, const 1_isize); -+ assume(move _5); ++ switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; + } + + bb1: { ++ StorageLive(_7); ++ _7 = const false; ++ assume(move _7); ++ _6 = core::panicking::panic_nounwind(const "unsafe precondition(s) violated: hint::unreachable_unchecked must never be reached") -> unwind unreachable; ++ } ++ ++ bb2: { ++ unreachable; ++ } ++ ++ bb3: { + _0 = move ((_2 as Some).0: T); ++ StorageDead(_6); + StorageDead(_5); + StorageDead(_4); + StorageDead(_3); 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..019b1842630ea 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 @@ -9,14 +9,16 @@ + debug self => _2; + let mut _3: &std::option::Option; + let mut _4: isize; -+ let mut _5: bool; ++ let _5: T; + scope 2 { + debug val => _0; + } + scope 3 { + scope 5 (inlined unreachable_unchecked) { ++ let mut _7: bool; + scope 6 { + scope 7 (inlined unreachable_unchecked::runtime) { ++ let _6: !; + } + } + } @@ -30,25 +32,37 @@ StorageLive(_2); _2 = move _1; - _0 = Option::::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2]; -- } -- -- bb1: { + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); ++ StorageLive(_6); + _4 = discriminant(_2); -+ _5 = Eq(_4, const 1_isize); -+ assume(move _5); ++ switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; + } + + bb1: { +- StorageDead(_2); +- return; ++ StorageLive(_7); ++ _7 = const false; ++ assume(move _7); ++ _6 = core::panicking::panic_nounwind(const "unsafe precondition(s) violated: hint::unreachable_unchecked must never be reached") -> unwind unreachable; + } + +- bb2 (cleanup): { +- resume; ++ bb2: { ++ unreachable; ++ } ++ ++ bb3: { + _0 = move ((_2 as Some).0: T); ++ StorageDead(_6); + StorageDead(_5); + StorageDead(_4); + StorageDead(_3); - StorageDead(_2); - return; -- } -- -- bb2 (cleanup): { -- resume; ++ StorageDead(_2); ++ return; } } 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 aeb93bd334fe6..34b035a5c74dc 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 @@ -3,38 +3,51 @@ fn unwrap_unchecked(_1: Option) -> T { debug slf => _1; let mut _0: T; + let mut _5: std::option::Option; scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { debug self => _1; let mut _2: isize; - let mut _3: bool; - let mut _4: &std::option::Option; + let mut _6: &std::option::Option; scope 2 { debug val => _0; } scope 3 { scope 5 (inlined unreachable_unchecked) { + let mut _3: bool; scope 6 { scope 7 (inlined unreachable_unchecked::runtime) { + let _4: !; } } } } scope 4 (inlined Option::::is_some) { - debug self => _4; + debug self => _6; } } bb0: { - StorageLive(_4); + StorageLive(_6); StorageLive(_2); - StorageLive(_3); _2 = discriminant(_1); - _3 = Eq(_2, const 1_isize); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb3]; + } + + bb1: { + StorageLive(_3); + _3 = const false; assume(move _3); + _4 = core::panicking::panic_nounwind(const "unsafe precondition(s) violated: hint::unreachable_unchecked must never be reached") -> unwind unreachable; + } + + bb2: { _0 = move ((_1 as Some).0: T); - StorageDead(_3); StorageDead(_2); - StorageDead(_4); + StorageDead(_6); return; } + + bb3: { + unreachable; + } } 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 aeb93bd334fe6..34b035a5c74dc 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 @@ -3,38 +3,51 @@ fn unwrap_unchecked(_1: Option) -> T { debug slf => _1; let mut _0: T; + let mut _5: std::option::Option; scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { debug self => _1; let mut _2: isize; - let mut _3: bool; - let mut _4: &std::option::Option; + let mut _6: &std::option::Option; scope 2 { debug val => _0; } scope 3 { scope 5 (inlined unreachable_unchecked) { + let mut _3: bool; scope 6 { scope 7 (inlined unreachable_unchecked::runtime) { + let _4: !; } } } } scope 4 (inlined Option::::is_some) { - debug self => _4; + debug self => _6; } } bb0: { - StorageLive(_4); + StorageLive(_6); StorageLive(_2); - StorageLive(_3); _2 = discriminant(_1); - _3 = Eq(_2, const 1_isize); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb3]; + } + + bb1: { + StorageLive(_3); + _3 = const false; assume(move _3); + _4 = core::panicking::panic_nounwind(const "unsafe precondition(s) violated: hint::unreachable_unchecked must never be reached") -> unwind unreachable; + } + + bb2: { _0 = move ((_1 as Some).0: T); - StorageDead(_3); StorageDead(_2); - StorageDead(_4); + StorageDead(_6); return; } + + bb3: { + unreachable; + } } diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff index 3748d14838032..25c8da185aaa1 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff @@ -17,43 +17,46 @@ let mut _12: u32; let mut _13: bool; scope 1 (inlined imm8) { - debug x => _1; + debug x => _5; let mut _14: u32; let mut _15: u32; + let mut _16: u32; + let mut _17: u32; + let mut _18: u32; + let mut _19: bool; scope 2 { - debug out => _4; + debug out => _14; } } scope 3 (inlined core::num::::rotate_right) { debug self => _4; debug n => _6; + let mut _20: u32; + let mut _21: u32; } bb0: { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = const 0_u32; - StorageLive(_15); + StorageLive(_5); + _5 = _1; + StorageLive(_18); + StorageLive(_19); StorageLive(_14); - _14 = Shr(_1, const 0_i32); - _15 = BitAnd(move _14, const 255_u32); - StorageDead(_14); - _4 = BitOr(const 0_u32, move _15); - StorageDead(_15); - StorageLive(_6); - StorageLive(_7); - StorageLive(_8); -- _10 = const 8_i32 as u32 (IntToInt); -- _11 = Lt(move _10, const 32_u32); -- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; -+ _10 = const 8_u32; -+ _11 = const true; -+ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; + _14 = const 0_u32; + StorageLive(_15); + StorageLive(_16); + StorageLive(_17); + _17 = _5; + _18 = const 0_u32; + _19 = const true; + assert(const true, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb3, unwind unreachable]; } bb1: { - _8 = Shr(_1, const 8_i32); + _8 = Shr(move _9, const 8_i32); + StorageDead(_9); _7 = BitAnd(move _8, const 15_u32); StorageDead(_8); - _12 = const 1_i32 as u32 (IntToInt); @@ -67,10 +70,39 @@ bb2: { _6 = Shl(move _7, const 1_i32); StorageDead(_7); - _3 = rotate_right::(move _4, move _6) -> [return: bb3, unwind unreachable]; + StorageLive(_20); + StorageLive(_21); + _3 = rotate_right::(_4, _6) -> [return: bb4, unwind unreachable]; } bb3: { + _16 = Shr(move _17, const 0_i32); + StorageDead(_17); + _15 = BitAnd(move _16, const 255_u32); + StorageDead(_16); + _14 = BitOr(const 0_u32, move _15); + StorageDead(_15); + _4 = _14; + StorageDead(_14); + StorageDead(_19); + StorageDead(_18); + StorageDead(_5); + StorageLive(_6); + StorageLive(_7); + StorageLive(_8); + StorageLive(_9); + _9 = _1; +- _10 = const 8_i32 as u32 (IntToInt); +- _11 = Lt(move _10, const 32_u32); +- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; ++ _10 = const 8_u32; ++ _11 = const true; ++ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; + } + + bb4: { + StorageDead(_21); + StorageDead(_20); StorageDead(_6); StorageDead(_4); _2 = move _3 as i32 (IntToInt); diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff index 9dab4233c5681..8519e39eab833 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff @@ -17,43 +17,46 @@ let mut _12: u32; let mut _13: bool; scope 1 (inlined imm8) { - debug x => _1; + debug x => _5; let mut _14: u32; let mut _15: u32; + let mut _16: u32; + let mut _17: u32; + let mut _18: u32; + let mut _19: bool; scope 2 { - debug out => _4; + debug out => _14; } } scope 3 (inlined core::num::::rotate_right) { debug self => _4; debug n => _6; + let mut _20: u32; + let mut _21: u32; } bb0: { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = const 0_u32; - StorageLive(_15); + StorageLive(_5); + _5 = _1; + StorageLive(_18); + StorageLive(_19); StorageLive(_14); - _14 = Shr(_1, const 0_i32); - _15 = BitAnd(move _14, const 255_u32); - StorageDead(_14); - _4 = BitOr(const 0_u32, move _15); - StorageDead(_15); - StorageLive(_6); - StorageLive(_7); - StorageLive(_8); -- _10 = const 8_i32 as u32 (IntToInt); -- _11 = Lt(move _10, const 32_u32); -- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; -+ _10 = const 8_u32; -+ _11 = const true; -+ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; + _14 = const 0_u32; + StorageLive(_15); + StorageLive(_16); + StorageLive(_17); + _17 = _5; + _18 = const 0_u32; + _19 = const true; + assert(const true, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb3, unwind continue]; } bb1: { - _8 = Shr(_1, const 8_i32); + _8 = Shr(move _9, const 8_i32); + StorageDead(_9); _7 = BitAnd(move _8, const 15_u32); StorageDead(_8); - _12 = const 1_i32 as u32 (IntToInt); @@ -67,10 +70,39 @@ bb2: { _6 = Shl(move _7, const 1_i32); StorageDead(_7); - _3 = rotate_right::(move _4, move _6) -> [return: bb3, unwind unreachable]; + StorageLive(_20); + StorageLive(_21); + _3 = rotate_right::(_4, _6) -> [return: bb4, unwind unreachable]; } bb3: { + _16 = Shr(move _17, const 0_i32); + StorageDead(_17); + _15 = BitAnd(move _16, const 255_u32); + StorageDead(_16); + _14 = BitOr(const 0_u32, move _15); + StorageDead(_15); + _4 = _14; + StorageDead(_14); + StorageDead(_19); + StorageDead(_18); + StorageDead(_5); + StorageLive(_6); + StorageLive(_7); + StorageLive(_8); + StorageLive(_9); + _9 = _1; +- _10 = const 8_i32 as u32 (IntToInt); +- _11 = Lt(move _10, const 32_u32); +- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; ++ _10 = const 8_u32; ++ _11 = const true; ++ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; + } + + bb4: { + StorageDead(_21); + StorageDead(_20); StorageDead(_6); StorageDead(_4); _2 = move _3 as i32 (IntToInt); diff --git a/tests/mir-opt/issue_101973.rs b/tests/mir-opt/issue_101973.rs index 3de325bc170b5..c30373541ed8a 100644 --- a/tests/mir-opt/issue_101973.rs +++ b/tests/mir-opt/issue_101973.rs @@ -1,7 +1,7 @@ // skip-filecheck +// unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// compile-flags: -O -C debug-assertions=on -// This needs inlining followed by ConstProp to reproduce, so we cannot use "unit-test". +// compile-flags: -O -C debug-assertions=on -Zmir-enable-passes=+Inline #[inline] pub fn imm8(x: u32) -> u32 { 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 5d25c6557002c..d7c6366647954 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 @@ -4,6 +4,7 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; let mut _0: u32; let mut _5: std::option::Option; + let mut _8: char; scope 1 (inlined char::methods::::is_digit) { debug self => _1; debug radix => const 8_u32; @@ -41,7 +42,7 @@ fn num_to_digit(_1: char) -> u32 { bb2: { StorageDead(_4); StorageLive(_5); - _5 = char::methods::::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable]; + _5 = char::methods::::to_digit(_1, const 8_u32) -> [return: bb3, unwind unreachable]; } bb3: { 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 4677c0108e3bb..71c61fd0bfb5c 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 @@ -4,6 +4,7 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; let mut _0: u32; let mut _5: std::option::Option; + let mut _8: char; scope 1 (inlined char::methods::::is_digit) { debug self => _1; debug radix => const 8_u32; @@ -41,7 +42,7 @@ fn num_to_digit(_1: char) -> u32 { bb2: { StorageDead(_4); StorageLive(_5); - _5 = char::methods::::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue]; + _5 = char::methods::::to_digit(_1, const 8_u32) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff index f50603a66a56f..17de94e9e6722 100644 --- a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff @@ -17,12 +17,13 @@ scope 2 { scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { debug residual => _8; - let _14: i32; - let mut _15: i32; + let _16: i32; + let mut _17: i32; + let mut _18: i32; scope 9 { - debug e => _14; + debug e => _16; scope 10 (inlined >::from) { - debug t => _14; + debug t => _16; } } } @@ -37,13 +38,15 @@ debug self => _4; let mut _10: isize; let _11: i32; - let _12: i32; - let mut _13: std::result::Result; + let mut _12: i32; + let _13: i32; + let mut _14: std::result::Result; + let mut _15: i32; scope 6 { debug v => _11; } scope 7 { - debug e => _12; + debug e => _13; } } @@ -55,6 +58,8 @@ StorageLive(_10); StorageLive(_11); StorageLive(_12); + StorageLive(_13); + StorageLive(_15); _10 = discriminant(_4); switchInt(move _10) -> [0: bb8, 1: bb6, otherwise: bb7]; } @@ -79,13 +84,15 @@ _6 = ((_3 as Break).0: std::result::Result); StorageLive(_8); _8 = _6; - StorageLive(_14); - _14 = move ((_8 as Err).0: i32); - StorageLive(_15); - _15 = move _14; - _0 = Result::::Err(move _15); - StorageDead(_15); - StorageDead(_14); + StorageLive(_16); + StorageLive(_18); + _16 = move ((_8 as Err).0: i32); + StorageLive(_17); + _17 = move _16; + _0 = Result::::Err(move _17); + StorageDead(_17); + StorageDead(_18); + StorageDead(_16); StorageDead(_8); StorageDead(_6); StorageDead(_2); @@ -98,6 +105,8 @@ } bb5: { + StorageDead(_15); + StorageDead(_13); StorageDead(_12); StorageDead(_11); StorageDead(_10); @@ -108,11 +117,11 @@ } bb6: { - _12 = move ((_4 as Err).0: i32); - StorageLive(_13); - _13 = Result::::Err(move _12); - _3 = ControlFlow::, i32>::Break(move _13); - StorageDead(_13); + _13 = move ((_4 as Err).0: i32); + StorageLive(_14); + _14 = Result::::Err(move _13); + _3 = ControlFlow::, i32>::Break(move _14); + StorageDead(_14); - goto -> bb5; + goto -> bb9; } @@ -128,6 +137,8 @@ + } + + bb9: { ++ StorageDead(_15); ++ StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + StorageDead(_10); diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff index f50603a66a56f..17de94e9e6722 100644 --- a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff @@ -17,12 +17,13 @@ scope 2 { scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { debug residual => _8; - let _14: i32; - let mut _15: i32; + let _16: i32; + let mut _17: i32; + let mut _18: i32; scope 9 { - debug e => _14; + debug e => _16; scope 10 (inlined >::from) { - debug t => _14; + debug t => _16; } } } @@ -37,13 +38,15 @@ debug self => _4; let mut _10: isize; let _11: i32; - let _12: i32; - let mut _13: std::result::Result; + let mut _12: i32; + let _13: i32; + let mut _14: std::result::Result; + let mut _15: i32; scope 6 { debug v => _11; } scope 7 { - debug e => _12; + debug e => _13; } } @@ -55,6 +58,8 @@ StorageLive(_10); StorageLive(_11); StorageLive(_12); + StorageLive(_13); + StorageLive(_15); _10 = discriminant(_4); switchInt(move _10) -> [0: bb8, 1: bb6, otherwise: bb7]; } @@ -79,13 +84,15 @@ _6 = ((_3 as Break).0: std::result::Result); StorageLive(_8); _8 = _6; - StorageLive(_14); - _14 = move ((_8 as Err).0: i32); - StorageLive(_15); - _15 = move _14; - _0 = Result::::Err(move _15); - StorageDead(_15); - StorageDead(_14); + StorageLive(_16); + StorageLive(_18); + _16 = move ((_8 as Err).0: i32); + StorageLive(_17); + _17 = move _16; + _0 = Result::::Err(move _17); + StorageDead(_17); + StorageDead(_18); + StorageDead(_16); StorageDead(_8); StorageDead(_6); StorageDead(_2); @@ -98,6 +105,8 @@ } bb5: { + StorageDead(_15); + StorageDead(_13); StorageDead(_12); StorageDead(_11); StorageDead(_10); @@ -108,11 +117,11 @@ } bb6: { - _12 = move ((_4 as Err).0: i32); - StorageLive(_13); - _13 = Result::::Err(move _12); - _3 = ControlFlow::, i32>::Break(move _13); - StorageDead(_13); + _13 = move ((_4 as Err).0: i32); + StorageLive(_14); + _14 = Result::::Err(move _13); + _3 = ControlFlow::, i32>::Break(move _14); + StorageDead(_14); - goto -> bb5; + goto -> bb9; } @@ -128,6 +137,8 @@ + } + + bb9: { ++ StorageDead(_15); ++ StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + StorageDead(_10); diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir index 8304cb45b3544..48d5feadc4a7f 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -4,6 +4,8 @@ fn checked_shl(_1: u32, _2: u32) -> Option { debug x => _1; debug rhs => _2; let mut _0: std::option::Option; + let mut _7: u32; + let mut _8: u32; scope 1 (inlined core::num::::checked_shl) { debug self => _1; debug rhs => _2; 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..5f3ed4bfd8327 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 @@ -4,6 +4,8 @@ fn step_forward(_1: u32, _2: usize) -> u32 { debug x => _1; debug n => _2; let mut _0: u32; + let mut _9: u32; + let mut _10: usize; scope 1 (inlined ::forward) { debug start => _1; debug n => _2; diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir index 0114309dbb58e..a8a7c6a8bc3d1 100644 --- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir @@ -4,19 +4,33 @@ fn ub_if_b(_1: Thing) -> Thing { debug t => _1; let mut _0: Thing; let mut _2: isize; - let mut _3: bool; scope 1 (inlined unreachable_unchecked) { + let mut _3: bool; scope 2 { scope 3 (inlined unreachable_unchecked::runtime) { + let _4: !; } } } bb0: { _2 = discriminant(_1); - _3 = Eq(_2, const 0_isize); - assume(move _3); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb3]; + } + + bb1: { _0 = move _1; return; } + + bb2: { + StorageLive(_3); + _3 = const false; + assume(move _3); + _4 = core::panicking::panic_nounwind(const "unsafe precondition(s) violated: hint::unreachable_unchecked must never be reached") -> unwind unreachable; + } + + bb3: { + unreachable; + } } 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 d5628dc7a6eae..7929a5c0218e2 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 @@ -19,7 +19,7 @@ } scope 5 (inlined ::allocate) { debug self => _9; - debug layout => _1; + debug layout => _8; } scope 6 (inlined #[track_caller] Result::, std::alloc::AllocError>::unwrap) { debug self => _6; @@ -51,12 +51,16 @@ } bb0: { +- StorageLive(_1); ++ nop; StorageLive(_2); - _2 = Option::::None; + _2 = const Option::::None; StorageLive(_10); - _10 = const 0_isize; - switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; +- _10 = discriminant(_2); +- switchInt(move _10) -> [0: bb1, 1: bb3, otherwise: bb2]; ++ _10 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; } bb1: { @@ -76,12 +80,20 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); + StorageLive(_7); _9 = const _; -- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable]; +- _7 = _9; ++ _7 = const {ALLOC1: &std::alloc::Global}; + StorageLive(_8); +- _8 = _1; +- _6 = std::alloc::Global::alloc_impl(_7, _8, const false) -> [return: bb4, 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: bb4, unwind unreachable]; } bb4: { + StorageDead(_8); + StorageDead(_7); StorageLive(_12); StorageLive(_15); _12 = discriminant(_6); @@ -95,7 +107,7 @@ _17 = &_13; _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); StorageDead(_17); - _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable; + _14 = result::unwrap_failed(_15, move _16) -> unwind unreachable; } bb6: { @@ -111,6 +123,8 @@ _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 d28059458ae9b..dd9cdf0f63f84 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 @@ -19,7 +19,7 @@ } scope 5 (inlined ::allocate) { debug self => _9; - debug layout => _1; + debug layout => _8; } scope 6 (inlined NonNull::<[u8]>::as_ptr) { debug self => _5; @@ -36,12 +36,16 @@ } bb0: { +- StorageLive(_1); ++ nop; StorageLive(_2); - _2 = Option::::None; + _2 = const Option::::None; StorageLive(_10); - _10 = const 0_isize; - switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3]; +- _10 = discriminant(_2); +- switchInt(move _10) -> [0: bb2, 1: bb4, otherwise: bb3]; ++ _10 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3]; } bb1: { @@ -54,6 +58,8 @@ _3 = move _4 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); +- StorageDead(_1); ++ nop; return; } @@ -74,12 +80,20 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); + StorageLive(_7); _9 = const _; -- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb5, unwind continue]; +- _7 = _9; ++ _7 = const {ALLOC1: &std::alloc::Global}; + StorageLive(_8); +- _8 = _1; +- _6 = std::alloc::Global::alloc_impl(_7, _8, const false) -> [return: bb5, 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: bb5, unwind continue]; } bb5: { + StorageDead(_8); + StorageDead(_7); _5 = Result::, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue]; } } 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 d139fc73e210a..aea7ce16d5e7e 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 @@ -19,7 +19,7 @@ } scope 5 (inlined ::allocate) { debug self => _9; - debug layout => _1; + debug layout => _8; } scope 6 (inlined #[track_caller] Result::, std::alloc::AllocError>::unwrap) { debug self => _6; @@ -51,12 +51,16 @@ } bb0: { +- StorageLive(_1); ++ nop; StorageLive(_2); - _2 = Option::::None; + _2 = const Option::::None; StorageLive(_10); - _10 = const 0_isize; - switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; +- _10 = discriminant(_2); +- switchInt(move _10) -> [0: bb1, 1: bb3, otherwise: bb2]; ++ _10 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; } bb1: { @@ -76,12 +80,20 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); + StorageLive(_7); _9 = const _; -- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable]; +- _7 = _9; ++ _7 = const {ALLOC1: &std::alloc::Global}; + StorageLive(_8); +- _8 = _1; +- _6 = std::alloc::Global::alloc_impl(_7, _8, const false) -> [return: bb4, 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: bb4, unwind unreachable]; } bb4: { + StorageDead(_8); + StorageDead(_7); StorageLive(_12); StorageLive(_15); _12 = discriminant(_6); @@ -95,7 +107,7 @@ _17 = &_13; _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); StorageDead(_17); - _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable; + _14 = result::unwrap_failed(_15, move _16) -> unwind unreachable; } bb6: { @@ -111,6 +123,8 @@ _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 63db9553b3766..e9523bc0d49e9 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 @@ -19,7 +19,7 @@ } scope 5 (inlined ::allocate) { debug self => _9; - debug layout => _1; + debug layout => _8; } scope 6 (inlined NonNull::<[u8]>::as_ptr) { debug self => _5; @@ -36,12 +36,16 @@ } bb0: { +- StorageLive(_1); ++ nop; StorageLive(_2); - _2 = Option::::None; + _2 = const Option::::None; StorageLive(_10); - _10 = const 0_isize; - switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3]; +- _10 = discriminant(_2); +- switchInt(move _10) -> [0: bb2, 1: bb4, otherwise: bb3]; ++ _10 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3]; } bb1: { @@ -54,6 +58,8 @@ _3 = move _4 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); +- StorageDead(_1); ++ nop; return; } @@ -74,12 +80,20 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); + StorageLive(_7); _9 = const _; -- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb5, unwind continue]; +- _7 = _9; ++ _7 = const {ALLOC1: &std::alloc::Global}; + StorageLive(_8); +- _8 = _1; +- _6 = std::alloc::Global::alloc_impl(_7, _8, const false) -> [return: bb5, 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: bb5, unwind continue]; } bb5: { + StorageDead(_8); + StorageDead(_7); _5 = Result::, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue]; } } 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 8dbb688999a02..5cfcf62d2fd87 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 @@ -10,6 +10,10 @@ fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () let mut _8: std::option::Option; let mut _9: isize; let _11: (); + let mut _12: std::iter::FilterMap, impl Fn(T) -> Option>; + let mut _13: impl Iterator; + let mut _14: impl Fn(T) -> Option; + let mut _15: U; scope 1 { debug iter => _4; let _10: U; 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 73a3be7f30176..2d691449ffb8b 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 @@ -10,6 +10,10 @@ fn int_range(_1: usize, _2: usize) -> () { let mut _11: std::option::Option; let mut _14: isize; let _16: (); + let mut _17: std::ops::Range; + let mut _18: usize; + let mut _19: usize; + let mut _20: usize; scope 1 { debug iter => _4; let _15: usize; @@ -106,7 +110,7 @@ fn int_range(_1: usize, _2: usize) -> () { bb7: { _15 = ((_11 as Some).0: usize); - _16 = opaque::(move _15) -> [return: bb8, unwind continue]; + _16 = opaque::(_15) -> [return: bb8, unwind continue]; } bb8: { 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 30bdc13109089..6869f6f0540b1 100644 --- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -10,6 +10,10 @@ fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { let mut _6: std::option::Option; let mut _7: isize; let _9: (); + let mut _10: std::iter::Map, impl Fn(T) -> U>; + let mut _11: impl Iterator; + let mut _12: impl Fn(T) -> U; + let mut _13: U; scope 1 { debug iter => _4; let _8: U; 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..45406a497a493 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 @@ -9,6 +9,8 @@ fn vec_move(_1: Vec) -> () { let mut _5: std::option::Option; let mut _6: isize; let _8: (); + let mut _9: std::vec::Vec; + let mut _10: impl Sized; scope 1 { debug iter => _3; let _7: impl Sized; diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir index 3ca24e152a4e0..decddf2c750ff 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir @@ -4,6 +4,8 @@ fn manual_replace(_1: &mut u32, _2: u32) -> u32 { debug r => _1; debug v => _2; let mut _0: u32; + let _3: u32; + let mut _4: u32; scope 1 { debug temp => _0; } 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 713d6cc558acc..419b1b996ade1 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 @@ -4,6 +4,7 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { debug r => _1; debug v => _2; let mut _0: u32; + let mut _3: u32; scope 1 (inlined std::mem::replace::) { debug dest => _1; debug src => _2; @@ -19,22 +20,23 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { } scope 4 (inlined std::ptr::read::) { debug src => _1; + let mut _4: *const u32; scope 5 { scope 6 (inlined std::ptr::read::runtime::) { - debug src => _1; + debug src => _4; scope 7 (inlined intrinsics::is_aligned_and_not_null::) { - debug ptr => _1; + debug ptr => _4; scope 8 (inlined std::ptr::const_ptr::::is_null) { - debug self => _1; - let mut _3: *const u8; + debug self => _4; + let mut _5: *const u8; scope 9 { scope 10 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { - debug ptr => _3; + debug ptr => _5; scope 11 (inlined std::ptr::const_ptr::::addr) { - debug self => _3; + debug self => _5; scope 12 { scope 13 (inlined std::ptr::const_ptr::::cast::<()>) { - debug self => _3; + debug self => _5; } } } @@ -42,7 +44,7 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { } } scope 14 (inlined std::ptr::const_ptr::::is_aligned) { - debug self => _1; + debug self => _4; scope 15 (inlined align_of::) { } } @@ -54,9 +56,11 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { } bb0: { - StorageLive(_3); + StorageLive(_4); + StorageLive(_5); _0 = (*_1); - StorageDead(_3); + StorageDead(_5); + StorageDead(_4); (*_1) = _2; return; } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff index bddd961c93309..0467c14b0ad46 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff @@ -4,60 +4,37 @@ 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: u32; scope 1 { debug x => _1; - let _3: i32; + let _2: i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => _2; + let _3: u32; scope 3 { - debug z => _9; + debug z => _3; } } } 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]; -+ _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = move (_2.0: i32); -+ _1 = const 4_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 = const 6_usize; -- _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]; -+ _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]; + _1 = const 4_i32; + StorageLive(_2); + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _3 = _4[_5]; -+ _3 = const 3_i32; - StorageDead(_5); - StorageDead(_4); - _9 = const 42_u32; + _2 = const 3_i32; + StorageLive(_3); + _3 = const 42_u32; StorageDead(_3); + StorageDead(_2); StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 04 00 00 00 00 __ __ __ │ .....░░░ } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff index 297ebd79fad70..75dd05a342359 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff @@ -4,60 +4,37 @@ 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: u32; scope 1 { debug x => _1; - let _3: i32; + let _2: i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => _2; + let _3: u32; scope 3 { - debug z => _9; + debug z => _3; } } } 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]; -+ _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { -- _1 = move (_2.0: i32); -+ _1 = const 4_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 = const 6_usize; -- _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]; -+ _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]; + _1 = const 4_i32; + StorageLive(_2); + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } bb2: { -- _3 = _4[_5]; -+ _3 = const 3_i32; - StorageDead(_5); - StorageDead(_4); - _9 = const 42_u32; + _2 = const 3_i32; + StorageLive(_3); + _3 = const 42_u32; StorageDead(_3); + StorageDead(_2); StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 04 00 00 00 00 __ __ __ │ .....░░░ } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff index bddd961c93309..0467c14b0ad46 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff @@ -4,60 +4,37 @@ 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: u32; scope 1 { debug x => _1; - let _3: i32; + let _2: i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => _2; + let _3: u32; scope 3 { - debug z => _9; + debug z => _3; } } } 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]; -+ _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = move (_2.0: i32); -+ _1 = const 4_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 = const 6_usize; -- _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]; -+ _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]; + _1 = const 4_i32; + StorageLive(_2); + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _3 = _4[_5]; -+ _3 = const 3_i32; - StorageDead(_5); - StorageDead(_4); - _9 = const 42_u32; + _2 = const 3_i32; + StorageLive(_3); + _3 = const 42_u32; StorageDead(_3); + StorageDead(_2); StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 04 00 00 00 00 __ __ __ │ .....░░░ } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff index 297ebd79fad70..75dd05a342359 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff @@ -4,60 +4,37 @@ 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: u32; scope 1 { debug x => _1; - let _3: i32; + let _2: i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => _2; + let _3: u32; scope 3 { - debug z => _9; + debug z => _3; } } } 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]; -+ _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { -- _1 = move (_2.0: i32); -+ _1 = const 4_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 = const 6_usize; -- _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]; -+ _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]; + _1 = const 4_i32; + StorageLive(_2); + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } bb2: { -- _3 = _4[_5]; -+ _3 = const 3_i32; - StorageDead(_5); - StorageDead(_4); - _9 = const 42_u32; + _2 = const 3_i32; + StorageLive(_3); + _3 = const 42_u32; StorageDead(_3); + StorageDead(_2); StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 04 00 00 00 00 __ __ __ │ .....░░░ } 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 cd734b10fea4f..cdb5ae354c5b8 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 @@ -13,6 +13,10 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _17: &impl Fn(u32); let mut _18: (u32,); let _19: (); + let mut _20: std::ops::Range; + let mut _21: u32; + let mut _22: u32; + let mut _23: u32; scope 1 { debug iter => _5; let _16: u32; 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 3342da545aecc..b9b1d123313b4 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 @@ -13,6 +13,10 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _17: &impl Fn(u32); let mut _18: (u32,); let _19: (); + let mut _20: std::ops::Range; + let mut _21: u32; + let mut _22: u32; + let mut _23: u32; scope 1 { debug iter => _5; let _16: u32; diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir index 1b23e421368b6..76e2de124b4ee 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir @@ -13,6 +13,10 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _10: &impl Fn(u32); let mut _11: (u32,); let _12: (); + let mut _13: std::ops::RangeInclusive; + let mut _14: u32; + let mut _15: u32; + let mut _16: u32; scope 1 { debug iter => _5; let _9: u32; diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir index a677e8b439fa0..a8781d0e9d397 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir @@ -13,6 +13,10 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _10: &impl Fn(u32); let mut _11: (u32,); let _12: (); + let mut _13: std::ops::RangeInclusive; + let mut _14: u32; + let mut _15: u32; + let mut _16: u32; scope 1 { debug iter => _5; let _9: u32; diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir index b0f475b4db7fc..c1f59a72564a4 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir @@ -3,12 +3,13 @@ fn range_inclusive_iter_next(_1: &mut RangeInclusive) -> Option { debug it => _1; let mut _0: std::option::Option; + let mut _2: &mut std::ops::RangeInclusive; scope 1 (inlined iter::range::>::next) { debug self => _1; } bb0: { - _0 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind unreachable]; + _0 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir index 663ec229f723c..8265c0ab55af2 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir @@ -3,12 +3,13 @@ fn range_inclusive_iter_next(_1: &mut RangeInclusive) -> Option { debug it => _1; let mut _0: std::option::Option; + let mut _2: &mut std::ops::RangeInclusive; scope 1 (inlined iter::range::>::next) { debug self => _1; } bb0: { - _0 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind continue]; + _0 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> [return: bb1, unwind continue]; } bb1: { 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 af5d385a979bb..9cb91cd3ce78b 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 @@ -3,12 +3,15 @@ fn ezmap(_1: Option) -> Option { debug x => _1; let mut _0: std::option::Option; + let mut _5: std::option::Option; + let mut _6: i32; scope 1 (inlined map::) { debug slf => _1; debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:18:12: 18:15}; let mut _2: isize; let _3: i32; let mut _4: i32; + let mut _7: i32; scope 2 { debug x => _3; scope 3 (inlined ezmap::{closure#0}) { 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 05f16cdacceff..f06a6abd5b430 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 @@ -100,8 +100,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 StorageLive(_12); _12 = _8; _13 = &_12; - StorageLive(_14); - StorageLive(_15); _14 = deref_copy _4; _15 = deref_copy _12; StorageLive(_16); @@ -111,8 +109,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 _18 = Le(move _16, move _17); StorageDead(_17); StorageDead(_16); - StorageDead(_15); - StorageDead(_14); switchInt(move _18) -> [0: bb1, otherwise: bb2]; } @@ -134,8 +130,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 StorageLive(_20); _20 = _6; _21 = &_20; - StorageLive(_22); - StorageLive(_23); _22 = deref_copy _10; _23 = deref_copy _20; StorageLive(_24); @@ -145,8 +139,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 _26 = Le(move _24, move _25); StorageDead(_25); StorageDead(_24); - StorageDead(_23); - StorageDead(_22); switchInt(move _26) -> [0: bb3, otherwise: bb8]; } @@ -165,8 +157,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 StorageLive(_28); _28 = _4; _29 = &_28; - StorageLive(_30); - StorageLive(_31); _30 = deref_copy _8; _31 = deref_copy _28; StorageLive(_32); @@ -176,8 +166,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 _34 = Le(move _32, move _33); StorageDead(_33); StorageDead(_32); - StorageDead(_31); - StorageDead(_30); switchInt(move _34) -> [0: bb5, otherwise: bb6]; } @@ -199,8 +187,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 StorageLive(_36); _36 = _10; _37 = &_36; - StorageLive(_38); - StorageLive(_39); _38 = deref_copy _6; _39 = deref_copy _36; StorageLive(_40); @@ -210,8 +196,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 _0 = Le(move _40, move _41); StorageDead(_41); StorageDead(_40); - StorageDead(_39); - StorageDead(_38); StorageDead(_36); StorageDead(_37); StorageDead(_35); diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir index e2ed1d101dcbc..68cbd27f7463d 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir @@ -13,6 +13,14 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, let mut _11: bool; let mut _12: bool; let mut _13: bool; + let mut _14: usize; + let mut _15: usize; + let mut _16: usize; + let mut _17: usize; + let mut _18: usize; + let mut _19: usize; + let mut _20: usize; + let mut _21: usize; scope 1 { debug a => _4; debug b => _6; @@ -31,42 +39,50 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, _10 = ((*_9).3: usize); StorageLive(_11); _11 = Le(_4, _8); - switchInt(move _11) -> [0: bb2, otherwise: bb1]; + switchInt(move _11) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_12); - _12 = Le(_10, _6); - switchInt(move _12) -> [0: bb2, otherwise: bb6]; + goto -> bb4; } bb2: { - StorageLive(_13); - _13 = Le(_8, _4); - switchInt(move _13) -> [0: bb3, otherwise: bb4]; + StorageLive(_12); + _12 = Le(_10, _6); + switchInt(move _12) -> [0: bb3, otherwise: bb8]; } bb3: { - _0 = const false; - goto -> bb5; + goto -> bb4; } bb4: { - _0 = Le(_6, _10); - goto -> bb5; + StorageLive(_13); + _13 = Le(_8, _4); + switchInt(move _13) -> [0: bb5, otherwise: bb6]; } bb5: { - StorageDead(_13); + _0 = const false; goto -> bb7; } bb6: { - _0 = const true; + _0 = Le(_6, _10); goto -> bb7; } bb7: { + StorageDead(_13); + goto -> bb9; + } + + bb8: { + _0 = const true; + goto -> bb9; + } + + bb9: { StorageDead(_12); StorageDead(_11); 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 e4d9060d4cf51..35a03c4204237 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 @@ -4,6 +4,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { debug slice => _1; debug index => _2; let mut _0: std::option::Option<&mut u32>; + let mut _9: usize; scope 1 (inlined core::slice::::get_mut::) { debug self => _1; debug index => _2; @@ -20,7 +21,8 @@ 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: &[&str]; + let mut _10: *mut [u32]; + let mut _11: &[&str]; scope 5 { scope 10 (inlined std::ptr::mut_ptr::::as_mut_ptr) { debug self => _5; @@ -33,16 +35,16 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } } scope 6 (inlined std::ptr::mut_ptr::::len) { - debug self => _5; - let mut _10: *const [u32]; + debug self => _10; + let mut _12: *const [u32]; scope 7 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _10; + debug ptr => _12; scope 8 { } } } scope 9 (inlined Arguments::<'_>::new_const) { - debug pieces => _9; + debug pieces => _11; } } } @@ -60,7 +62,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb1: { StorageDead(_3); - _0 = const Option::<&mut u32>::None; + _0 = Option::<&mut u32>::None; goto -> bb3; } @@ -69,14 +71,16 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageLive(_8); StorageLive(_5); _5 = &raw mut (*_1); - StorageLive(_9); StorageLive(_10); + StorageLive(_11); + StorageLive(_12); StorageLive(_6); _6 = _5 as *mut u32 (PtrToPtr); _7 = Offset(_6, _2); StorageDead(_6); + StorageDead(_12); + StorageDead(_11); StorageDead(_10); - StorageDead(_9); StorageDead(_5); _8 = &mut (*_7); _0 = Option::<&mut u32>::Some(move _8); 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 e4d9060d4cf51..35a03c4204237 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 @@ -4,6 +4,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { debug slice => _1; debug index => _2; let mut _0: std::option::Option<&mut u32>; + let mut _9: usize; scope 1 (inlined core::slice::::get_mut::) { debug self => _1; debug index => _2; @@ -20,7 +21,8 @@ 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: &[&str]; + let mut _10: *mut [u32]; + let mut _11: &[&str]; scope 5 { scope 10 (inlined std::ptr::mut_ptr::::as_mut_ptr) { debug self => _5; @@ -33,16 +35,16 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } } scope 6 (inlined std::ptr::mut_ptr::::len) { - debug self => _5; - let mut _10: *const [u32]; + debug self => _10; + let mut _12: *const [u32]; scope 7 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _10; + debug ptr => _12; scope 8 { } } } scope 9 (inlined Arguments::<'_>::new_const) { - debug pieces => _9; + debug pieces => _11; } } } @@ -60,7 +62,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb1: { StorageDead(_3); - _0 = const Option::<&mut u32>::None; + _0 = Option::<&mut u32>::None; goto -> bb3; } @@ -69,14 +71,16 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageLive(_8); StorageLive(_5); _5 = &raw mut (*_1); - StorageLive(_9); StorageLive(_10); + StorageLive(_11); + StorageLive(_12); StorageLive(_6); _6 = _5 as *mut u32 (PtrToPtr); _7 = Offset(_6, _2); StorageDead(_6); + StorageDead(_12); + StorageDead(_11); StorageDead(_10); - StorageDead(_9); StorageDead(_5); _8 = &mut (*_7); _0 = Option::<&mut u32>::Some(move _8); 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 0d95f81c37c54..c2a77853eb94a 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 @@ -19,7 +19,11 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> debug slice => _5; let mut _7: *mut u32; let mut _8: *mut u32; - let mut _14: &[&str]; + let mut _14: *mut [u32]; + let mut _15: &[&str]; + let mut _16: usize; + let mut _17: usize; + let mut _18: usize; scope 4 { let _6: usize; scope 5 { @@ -53,16 +57,16 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> } } scope 6 (inlined std::ptr::mut_ptr::::len) { - debug self => _5; - let mut _15: *const [u32]; + debug self => _14; + let mut _19: *const [u32]; scope 7 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _15; + debug ptr => _19; scope 8 { } } } scope 9 (inlined Arguments::<'_>::new_const) { - debug pieces => _14; + debug pieces => _15; } } } @@ -74,8 +78,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_14); - StorageLive(_6); StorageLive(_15); + StorageLive(_6); + StorageLive(_19); _6 = SubUnchecked(_4, _3); StorageLive(_8); StorageLive(_7); @@ -96,8 +101,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> StorageDead(_12); StorageDead(_9); StorageDead(_8); - StorageDead(_15); + StorageDead(_19); StorageDead(_6); + StorageDead(_15); StorageDead(_14); StorageDead(_5); _0 = &mut (*_13); 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 0d95f81c37c54..c2a77853eb94a 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 @@ -19,7 +19,11 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> debug slice => _5; let mut _7: *mut u32; let mut _8: *mut u32; - let mut _14: &[&str]; + let mut _14: *mut [u32]; + let mut _15: &[&str]; + let mut _16: usize; + let mut _17: usize; + let mut _18: usize; scope 4 { let _6: usize; scope 5 { @@ -53,16 +57,16 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> } } scope 6 (inlined std::ptr::mut_ptr::::len) { - debug self => _5; - let mut _15: *const [u32]; + debug self => _14; + let mut _19: *const [u32]; scope 7 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _15; + debug ptr => _19; scope 8 { } } } scope 9 (inlined Arguments::<'_>::new_const) { - debug pieces => _14; + debug pieces => _15; } } } @@ -74,8 +78,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_14); - StorageLive(_6); StorageLive(_15); + StorageLive(_6); + StorageLive(_19); _6 = SubUnchecked(_4, _3); StorageLive(_8); StorageLive(_7); @@ -96,8 +101,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> StorageDead(_12); StorageDead(_9); StorageDead(_8); - StorageDead(_15); + StorageDead(_19); StorageDead(_6); + StorageDead(_15); StorageDead(_14); StorageDead(_5); _0 = &mut (*_13); 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..38ba99c1c99ce 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 @@ -4,13 +4,16 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range) -> &[u32] { debug slice => _1; debug index => _2; let mut _0: &[u32]; + let _3: &[u32]; + let mut _4: &[u32]; + let mut _5: std::ops::Range; scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { debug self => _1; debug index => _2; } bb0: { - _0 = as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable]; + _0 = as SliceIndex<[u32]>>::index(move _2, _1) -> [return: bb1, unwind unreachable]; } bb1: { 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..4f8d04fb1d2a2 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 @@ -4,13 +4,16 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range) -> &[u32] { debug slice => _1; debug index => _2; let mut _0: &[u32]; + let _3: &[u32]; + let mut _4: &[u32]; + let mut _5: std::ops::Range; scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { debug self => _1; debug index => _2; } bb0: { - _0 = as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue]; + _0 = as SliceIndex<[u32]>>::index(move _2, _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir index 210f9d6a12403..45c2e34d05da6 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir @@ -6,6 +6,7 @@ fn slice_index_usize(_1: &[u32], _2: usize) -> u32 { let mut _0: u32; let mut _3: usize; let mut _4: bool; + let _5: usize; bb0: { _3 = Len((*_1)); diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir index d576520a8d56b..0ce2a8a5bff27 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir @@ -6,6 +6,7 @@ fn slice_index_usize(_1: &[u32], _2: usize) -> u32 { let mut _0: u32; let mut _3: usize; let mut _4: bool; + let _5: usize; bb0: { _3 = Len((*_1)); 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 c58b630a0c365..459625303bd4b 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 @@ -13,6 +13,9 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _21: &impl Fn(usize, &T); let mut _22: (usize, &T); let _23: (); + let mut _24: std::iter::Enumerate>; + let mut _25: usize; + let mut _26: &T; scope 1 { debug iter => _15; let _19: usize; @@ -42,20 +45,21 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; let mut _10: *const T; + let mut _27: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _9; + debug ptr => _27; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _24: *mut u8; + debug self => _27; + let mut _28: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _24; + debug ptr => _28; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _24; + debug self => _28; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _24; + debug self => _28; } } } @@ -130,10 +134,12 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_9); _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); + StorageLive(_27); + StorageLive(_28); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull:: { pointer: _10 }; - StorageDead(_24); + StorageDead(_28); + StorageDead(_27); StorageDead(_10); StorageDead(_9); StorageLive(_12); 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 1a805f0fd8dc8..3324ffb7f7bc6 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 @@ -13,6 +13,9 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _21: &impl Fn(usize, &T); let mut _22: (usize, &T); let _23: (); + let mut _24: std::iter::Enumerate>; + let mut _25: usize; + let mut _26: &T; scope 1 { debug iter => _15; let _19: usize; @@ -42,20 +45,21 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; let mut _10: *const T; + let mut _27: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _9; + debug ptr => _27; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _24: *mut u8; + debug self => _27; + let mut _28: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _24; + debug ptr => _28; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _24; + debug self => _28; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _24; + debug self => _28; } } } @@ -130,10 +134,12 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_9); _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); + StorageLive(_27); + StorageLive(_28); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull:: { pointer: _10 }; - StorageDead(_24); + StorageDead(_28); + StorageDead(_27); StorageDead(_10); StorageDead(_9); StorageLive(_12); 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 09075eed6a9cd..4eff516ad4ee6 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 @@ -12,6 +12,8 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _19: &impl Fn(&T); let mut _20: (&T,); let _21: (); + let mut _22: std::slice::Iter<'_, T>; + let mut _23: &T; scope 1 { debug iter => _14; let _18: &T; @@ -39,20 +41,21 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { 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 => _9; + debug ptr => _24; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _22: *mut u8; + debug self => _24; + let mut _25: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _22; + debug ptr => _25; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _22; + debug self => _25; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _22; + debug self => _25; } } } @@ -120,10 +123,12 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_9); _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_22); + StorageLive(_24); + StorageLive(_25); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull:: { pointer: _10 }; - StorageDead(_22); + StorageDead(_25); + StorageDead(_24); StorageDead(_10); StorageDead(_9); StorageLive(_12); 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 47b84746468a0..a84345764432e 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 @@ -12,6 +12,8 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _19: &impl Fn(&T); let mut _20: (&T,); let _21: (); + let mut _22: std::slice::Iter<'_, T>; + let mut _23: &T; scope 1 { debug iter => _14; let _18: &T; @@ -39,20 +41,21 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { 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 => _9; + debug ptr => _24; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _22: *mut u8; + debug self => _24; + let mut _25: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _22; + debug ptr => _25; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _22; + debug self => _25; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _22; + debug self => _25; } } } @@ -120,10 +123,12 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_9); _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_22); + StorageLive(_24); + StorageLive(_25); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull:: { pointer: _10 }; - StorageDead(_22); + StorageDead(_25); + StorageDead(_24); StorageDead(_10); StorageDead(_9); StorageLive(_12); 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 db6922968ae9c..b0fb3fe716069 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 @@ -15,6 +15,10 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _20: &impl Fn(usize, &T); let mut _21: (usize, &T); let _22: (); + let mut _23: std::ops::Range; + let _24: usize; + let mut _25: usize; + let mut _26: &T; scope 1 { debug iter => _5; let _16: usize; 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 81d1832eebba2..efdc19a389234 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 @@ -15,6 +15,10 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _20: &impl Fn(usize, &T); let mut _21: (usize, &T); let _22: (); + let mut _23: std::ops::Range; + let _24: usize; + let mut _25: usize; + let mut _26: &T; scope 1 { debug iter => _5; let _16: usize; 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 5ed7ca5e2b86f..4d8a66146539d 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 @@ -13,6 +13,8 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _21: &impl Fn(&T); let mut _22: (&T,); let _23: (); + let mut _24: std::iter::Rev>; + let mut _25: &T; scope 1 { debug iter => _15; let _20: &T; @@ -44,20 +46,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; let mut _10: *const T; + let mut _26: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _9; + debug ptr => _26; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _24: *mut u8; + debug self => _26; + let mut _27: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _24; + debug ptr => _27; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _24; + debug self => _27; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _24; + debug self => _27; } } } @@ -132,10 +135,12 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_9); _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); + StorageLive(_26); + StorageLive(_27); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull:: { pointer: _10 }; - StorageDead(_24); + StorageDead(_27); + StorageDead(_26); StorageDead(_10); StorageDead(_9); StorageLive(_12); 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 bbb979d23b36a..fb3dc2ecd7791 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 @@ -13,6 +13,8 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _21: &impl Fn(&T); let mut _22: (&T,); let _23: (); + let mut _24: std::iter::Rev>; + let mut _25: &T; scope 1 { debug iter => _15; let _20: &T; @@ -44,20 +46,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 13 (inlined NonNull::::new_unchecked) { debug ptr => _9; let mut _10: *const T; + let mut _26: *mut T; scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _9; + debug ptr => _26; scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _24: *mut u8; + debug self => _26; + let mut _27: *mut u8; scope 17 { scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _24; + debug ptr => _27; scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _24; + debug self => _27; scope 20 { scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _24; + debug self => _27; } } } @@ -132,10 +135,12 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_9); _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); + StorageLive(_26); + StorageLive(_27); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull:: { pointer: _10 }; - StorageDead(_24); + StorageDead(_27); + StorageDead(_26); StorageDead(_10); StorageDead(_9); StorageLive(_12); 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..9b51d6e5a188d 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,9 +3,10 @@ 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>; + let mut _2: &mut std::slice::IterMut<'_, T>; bb0: { - _0 = as DoubleEndedIterator>::next_back(move _1) -> [return: bb1, unwind unreachable]; + _0 = as DoubleEndedIterator>::next_back(_1) -> [return: bb1, unwind unreachable]; } bb1: { 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..26ac6f59c5596 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,9 +3,10 @@ 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>; + let mut _2: &mut std::slice::IterMut<'_, T>; bb0: { - _0 = as DoubleEndedIterator>::next_back(move _1) -> [return: bb1, unwind continue]; + _0 = as DoubleEndedIterator>::next_back(_1) -> [return: bb1, unwind continue]; } bb1: { 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..4e81013ade781 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,9 +3,10 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { debug it => _1; let mut _0: std::option::Option<&T>; + let mut _2: &mut std::slice::Iter<'_, T>; bb0: { - _0 = as Iterator>::next(move _1) -> [return: bb1, unwind unreachable]; + _0 = as Iterator>::next(_1) -> [return: bb1, unwind unreachable]; } bb1: { 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..940b43cd8c96c 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,9 +3,10 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { debug it => _1; let mut _0: std::option::Option<&T>; + let mut _2: &mut std::slice::Iter<'_, T>; bb0: { - _0 = as Iterator>::next(move _1) -> [return: bb1, unwind continue]; + _0 = as Iterator>::next(_1) -> [return: bb1, unwind continue]; } bb1: { 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 0bf4a2670020d..461edaa74366e 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 @@ -10,6 +10,10 @@ fn new(_1: Result) -> Result { let mut _6: isize; let _7: T; let _8: E; + let mut _9: T; + let mut _10: T; + let mut _11: E; + let mut _12: E; scope 1 { debug v => _3; } diff --git a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir index 7ccb8b0430de1..29dbeccee02e3 100644 --- a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir @@ -6,6 +6,8 @@ fn old(_1: Result) -> Result { let mut _2: isize; let _3: T; let _4: E; + let mut _5: T; + let mut _6: E; scope 1 { debug v => _3; } diff --git a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff index d287b20c4ead0..5035f022e8258 100644 --- a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff +++ b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff @@ -4,61 +4,61 @@ fn identity(_1: Result) -> Result { debug x => _1; let mut _0: std::result::Result; - let mut _2: i32; - let mut _3: std::ops::ControlFlow, i32>; - let mut _4: std::result::Result; - let mut _5: isize; - let _6: std::result::Result; - let mut _7: std::result::Result; - let _8: i32; + 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 => _6; + debug residual => _5; scope 2 { scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { debug residual => _6; - let _13: i32; - let mut _14: i32; + let _12: i32; scope 9 { - debug e => _13; + debug e => _12; scope 10 (inlined >::from) { - debug t => _13; + debug t => _12; } } } } } scope 3 { - debug val => _8; + debug val => _7; scope 4 { } } scope 5 (inlined as Try>::branch) { - debug self => _1; - let mut _9: isize; + debug self => _3; + let mut _8: isize; + let _9: i32; let _10: i32; - let _11: i32; - let mut _12: std::result::Result; + let mut _11: std::result::Result; scope 6 { - debug v => _10; + debug v => _9; } scope 7 { - debug e => _11; + debug e => _10; } } bb0: { + StorageLive(_2); StorageLive(_3); + _3 = _1; + StorageLive(_8); StorageLive(_9); StorageLive(_10); - StorageLive(_11); - _9 = discriminant(_1); - switchInt(move _9) -> [0: bb6, 1: bb5, otherwise: bb2]; + _8 = discriminant(_1); + switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2]; } bb1: { - _8 = ((_3 as Continue).0: i32); - _0 = Result::::Ok(_8); - StorageDead(_3); + _7 = ((_2 as Continue).0: i32); + _0 = Result::::Ok(_7); + StorageDead(_2); return; } @@ -67,33 +67,37 @@ } bb3: { - _6 = ((_3 as Break).0: std::result::Result); - _13 = ((_6 as Err).0: i32); - _0 = Result::::Err(move _13); - StorageDead(_3); + _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; } bb4: { - StorageDead(_11); StorageDead(_10); StorageDead(_9); - _5 = discriminant(_3); - switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; + StorageDead(_8); + StorageDead(_3); + _4 = discriminant(_2); + switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; } bb5: { - _11 = ((_1 as Err).0: i32); - StorageLive(_12); - _12 = Result::::Err(move _11); - _3 = ControlFlow::, i32>::Break(move _12); - StorageDead(_12); + _10 = move ((_1 as Err).0: i32); + StorageLive(_11); + _11 = Result::::Err(move _10); + _2 = ControlFlow::, i32>::Break(move _11); + StorageDead(_11); goto -> bb4; } bb6: { - _10 = ((_1 as Ok).0: i32); - _3 = ControlFlow::, i32>::Continue(move _10); + _9 = move ((_1 as Ok).0: i32); + _2 = ControlFlow::, i32>::Continue(move _9); goto -> bb4; } } diff --git a/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff index e2bf33f7fbcc0..2ccad0d568d81 100644 --- a/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff +++ b/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff @@ -7,24 +7,21 @@ let mut _2: std::ops::ControlFlow; let mut _3: isize; let _4: i32; - let mut _5: i32; - let _6: usize; - let mut _7: usize; - let mut _8: isize; - let _9: i32; - let mut _10: i32; - let _11: usize; + let _5: usize; + let mut _6: isize; + let _7: i32; + let _8: usize; scope 1 { debug v => _4; } scope 2 { - debug r => _6; + debug r => _5; } scope 3 { - debug v => _9; + debug v => _7; } scope 4 { - debug r => _11; + debug r => _8; } bb0: { @@ -34,8 +31,8 @@ } bb1: { - _6 = ((_1 as Err).0: usize); - _2 = ControlFlow::::Break(_6); + _5 = ((_1 as Err).0: usize); + _2 = ControlFlow::::Break(_5); goto -> bb4; } @@ -50,21 +47,21 @@ } bb4: { - _8 = discriminant(_2); - switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2]; + _6 = discriminant(_2); + switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb2]; } bb5: { - StorageLive(_11); - _11 = ((_2 as Break).0: usize); - _0 = Option::::None; - StorageDead(_11); + StorageLive(_8); + _8 = ((_2 as Break).0: usize); + _0 = const Option::::None; + StorageDead(_8); goto -> bb7; } bb6: { - _9 = ((_2 as Continue).0: i32); - _0 = Option::::Some(_9); + _7 = ((_2 as Continue).0: i32); + _0 = Option::::Some(_7); goto -> bb7; } @@ -74,3 +71,7 @@ } } + ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ + } + diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff index 6025abb73825c..2bb54d5a66694 100644 --- a/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff @@ -3,16 +3,14 @@ fn main() -> () { let mut _0: (); - let mut _1: bool; - let _2: bool; + let _1: bool; scope 1 { - debug x => _2; + debug x => _1; } bb0: { - _2 = const false; -- switchInt(_2) -> [0: bb1, otherwise: bb2]; -+ switchInt(const false) -> [0: bb1, otherwise: bb2]; + _1 = const false; + switchInt(const false) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff index c881dec28c77d..2d60e234e066d 100644 --- a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff @@ -3,16 +3,14 @@ fn main() -> () { let mut _0: (); - let mut _1: bool; - let _2: bool; + let _1: bool; scope 1 { - debug x => _2; + debug x => _1; } bb0: { - _2 = const false; -- switchInt(_2) -> [0: bb1, otherwise: bb2]; -+ switchInt(const false) -> [0: bb1, otherwise: bb2]; + _1 = const false; + switchInt(const false) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr index f3ec3200f9465..7e764ca72390d 100644 --- a/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr +++ b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr @@ -10,12 +10,6 @@ note: erroneous constant encountered LL | & as Foo>::BAR | ^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant encountered - --> $DIR/issue-50814-2.rs:20:5 - | -LL | & as Foo>::BAR - | ^^^^^^^^^^^^^^^^^^^^^^ - error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0080`.