diff --git a/compiler/rustc_infer/src/infer/relate/generalize.rs b/compiler/rustc_infer/src/infer/relate/generalize.rs
index 665af7381dc75..07f283e5dc3b0 100644
--- a/compiler/rustc_infer/src/infer/relate/generalize.rs
+++ b/compiler/rustc_infer/src/infer/relate/generalize.rs
@@ -1,6 +1,7 @@
use std::mem;
use rustc_data_structures::sso::SsoHashMap;
+use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_hir::def_id::DefId;
use rustc_middle::infer::unify_key::{ConstVarValue, ConstVariableValue};
use rustc_middle::ty::error::TypeError;
@@ -226,7 +227,9 @@ where
let old_ambient_variance = self.ambient_variance;
self.ambient_variance = self.ambient_variance.xform(variance);
debug!(?self.ambient_variance, "new ambient variance");
- let r = self.relate(a, b)?;
+ // Recursive calls to `relate` can overflow the stack. For example a deeper version of
+ // `ui/associated-consts/issue-93775.rs`.
+ let r = ensure_sufficient_stack(|| self.relate(a, b))?;
self.ambient_variance = old_ambient_variance;
Ok(r)
}
diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs
index e66d5e0a9f99e..c5824c3077028 100644
--- a/compiler/rustc_mir_transform/src/const_prop.rs
+++ b/compiler/rustc_mir_transform/src/const_prop.rs
@@ -1,29 +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 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.
@@ -56,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,
@@ -267,297 +205,6 @@ 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 {
@@ -677,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/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs
index 3b8adf7e86b71..13e5ffea39095 100644
--- a/compiler/rustc_mir_transform/src/gvn.rs
+++ b/compiler/rustc_mir_transform/src/gvn.rs
@@ -109,7 +109,7 @@ pub struct GVN;
impl<'tcx> MirPass<'tcx> for GVN {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
- sess.mir_opt_level() >= 4
+ sess.mir_opt_level() >= 2
}
#[instrument(level = "trace", skip(self, tcx, body))]
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index 98d4d96d0c76c..7da18b647d1bc 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -588,7 +588,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
// 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,
diff --git a/tests/codegen/inherit_overflow.rs b/tests/codegen/inherit_overflow.rs
index 39909d7abfd40..fa9ee0ae12a16 100644
--- a/tests/codegen/inherit_overflow.rs
+++ b/tests/codegen/inherit_overflow.rs
@@ -1,4 +1,4 @@
-// compile-flags: -Zmir-enable-passes=+Inline,+ConstProp --crate-type lib
+// compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib
// revisions: ASSERT NOASSERT
//[ASSERT] compile-flags: -Coverflow-checks=on
//[NOASSERT] compile-flags: -Coverflow-checks=off
diff --git a/tests/coverage/async2.cov-map b/tests/coverage/async2.cov-map
index b120e28c46429..28f319bfb80bd 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 + 13, 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, 0d, 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, 0d, 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 + 13, 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, 15, 01, 00, 24]
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/incremental/hashes/for_loops.rs b/tests/incremental/hashes/for_loops.rs
index 98c762e409787..84a04ff913b84 100644
--- a/tests/incremental/hashes/for_loops.rs
+++ b/tests/incremental/hashes/for_loops.rs
@@ -103,9 +103,9 @@ pub fn change_iterable() {
}
#[cfg(not(any(cfail1,cfail4)))]
-#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, promoted_mir")]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, promoted_mir, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, promoted_mir")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, promoted_mir, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_iterable() {
let mut _x = 0;
diff --git a/tests/incremental/string_constant.rs b/tests/incremental/string_constant.rs
index e15a8d18f853d..47cd100b13691 100644
--- a/tests/incremental/string_constant.rs
+++ b/tests/incremental/string_constant.rs
@@ -1,5 +1,5 @@
// revisions: cfail1 cfail2
-// compile-flags: -Z query-dep-graph
+// compile-flags: -Z query-dep-graph -Copt-level=0
// build-pass (FIXME(62277): could be check-pass?)
#![allow(warnings)]
diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation.main.GVN.after.32bit.mir
similarity index 95%
rename from tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
rename to tests/mir-opt/const_allocation.main.GVN.after.32bit.mir
index 9cc4c7c4d7613..f089c6741fe8d 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation.main.GVN.after.32bit.mir
@@ -1,4 +1,4 @@
-// MIR for `main` after ConstProp
+// MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
_2 = const {ALLOC9: &&[(Option, &[&str])]};
_1 = (*_2);
- StorageDead(_2);
+ nop;
StorageDead(_1);
_0 = const ();
return;
diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation.main.GVN.after.64bit.mir
similarity index 95%
rename from tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
rename to tests/mir-opt/const_allocation.main.GVN.after.64bit.mir
index faa9d20f2d5cb..9cbbaf302bef3 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation.main.GVN.after.64bit.mir
@@ -1,4 +1,4 @@
-// MIR for `main` after ConstProp
+// MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
_2 = const {ALLOC9: &&[(Option, &[&str])]};
_1 = (*_2);
- StorageDead(_2);
+ nop;
StorageDead(_1);
_0 = const ();
return;
diff --git a/tests/mir-opt/const_allocation.rs b/tests/mir-opt/const_allocation.rs
index 577c61aeb7de9..5b5fb524fdb39 100644
--- a/tests/mir-opt/const_allocation.rs
+++ b/tests/mir-opt/const_allocation.rs
@@ -1,11 +1,11 @@
// skip-filecheck
-// unit-test: ConstProp
+// unit-test: GVN
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
static FOO: &[(Option, &[&str])] =
&[(None, &[]), (None, &["foo", "bar"]), (Some(42), &["meh", "mop", "möp"])];
-// EMIT_MIR const_allocation.main.ConstProp.after.mir
+// EMIT_MIR const_allocation.main.GVN.after.mir
fn main() {
FOO;
}
diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation2.main.GVN.after.32bit.mir
similarity index 94%
rename from tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
rename to tests/mir-opt/const_allocation2.main.GVN.after.32bit.mir
index 898835b46e46f..dfa2d80812865 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation2.main.GVN.after.32bit.mir
@@ -1,4 +1,4 @@
-// MIR for `main` after ConstProp
+// MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
_2 = const {ALLOC9: &&[(Option, &[&u8])]};
_1 = (*_2);
- StorageDead(_2);
+ nop;
StorageDead(_1);
_0 = const ();
return;
diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation2.main.GVN.after.64bit.mir
similarity index 95%
rename from tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
rename to tests/mir-opt/const_allocation2.main.GVN.after.64bit.mir
index f5352c2aebb36..02b669871698d 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation2.main.GVN.after.64bit.mir
@@ -1,4 +1,4 @@
-// MIR for `main` after ConstProp
+// MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
_2 = const {ALLOC9: &&[(Option, &[&u8])]};
_1 = (*_2);
- StorageDead(_2);
+ nop;
StorageDead(_1);
_0 = const ();
return;
diff --git a/tests/mir-opt/const_allocation2.rs b/tests/mir-opt/const_allocation2.rs
index 0fcfaad842c9f..171592889d574 100644
--- a/tests/mir-opt/const_allocation2.rs
+++ b/tests/mir-opt/const_allocation2.rs
@@ -1,8 +1,8 @@
// skip-filecheck
-// unit-test: ConstProp
+// unit-test: GVN
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// EMIT_MIR const_allocation2.main.ConstProp.after.mir
+// EMIT_MIR const_allocation2.main.GVN.after.mir
fn main() {
FOO;
}
diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation3.main.GVN.after.32bit.mir
similarity index 96%
rename from tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
rename to tests/mir-opt/const_allocation3.main.GVN.after.32bit.mir
index 624047f5b6f2f..386a55ee6fa11 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation3.main.GVN.after.32bit.mir
@@ -1,4 +1,4 @@
-// MIR for `main` after ConstProp
+// MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
_2 = const {ALLOC4: &&Packed};
_1 = (*_2);
- StorageDead(_2);
+ nop;
StorageDead(_1);
_0 = const ();
return;
diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation3.main.GVN.after.64bit.mir
similarity index 96%
rename from tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
rename to tests/mir-opt/const_allocation3.main.GVN.after.64bit.mir
index cdd4758e153c0..b9e98f8cd4c8f 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation3.main.GVN.after.64bit.mir
@@ -1,4 +1,4 @@
-// MIR for `main` after ConstProp
+// MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
_2 = const {ALLOC2: &&Packed};
_1 = (*_2);
- StorageDead(_2);
+ nop;
StorageDead(_1);
_0 = const ();
return;
diff --git a/tests/mir-opt/const_allocation3.rs b/tests/mir-opt/const_allocation3.rs
index b8c9f50977e34..91a30f0587bff 100644
--- a/tests/mir-opt/const_allocation3.rs
+++ b/tests/mir-opt/const_allocation3.rs
@@ -1,8 +1,8 @@
// skip-filecheck
-// unit-test: ConstProp
+// unit-test: GVN
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// EMIT_MIR const_allocation3.main.ConstProp.after.mir
+// EMIT_MIR const_allocation3.main.GVN.after.mir
fn main() {
FOO;
}
diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
index 87c07279552f4..c1529dbee13cb 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;
@@ -54,11 +55,11 @@
}
bb0: {
- StorageLive(_1);
+ nop;
_1 = const 1_u8;
- StorageLive(_2);
+ nop;
_2 = const 2_u8;
- StorageLive(_3);
+ nop;
_3 = const 3_u8;
StorageLive(_4);
StorageLive(_5);
@@ -79,17 +80,17 @@
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);
- StorageLive(_14);
+ nop;
_14 = const 32_u32;
StorageLive(_15);
_15 = const 32_u32;
_13 = const 64_u32;
StorageDead(_15);
- StorageDead(_14);
+ nop;
_0 = const ();
StorageDead(_13);
StorageDead(_12);
@@ -97,9 +98,9 @@
StorageDead(_10);
StorageDead(_9);
StorageDead(_4);
- StorageDead(_3);
- StorageDead(_2);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
return;
}
}
@@ -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..db0c5dbb28fad 100644
--- a/tests/mir-opt/const_debuginfo.rs
+++ b/tests/mir-opt/const_debuginfo.rs
@@ -1,5 +1,5 @@
// unit-test: ConstDebugInfo
-// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+ConstProp
+// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN
struct Point {
x: u32,
@@ -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/address_of_pair.fn0.ConstProp.diff b/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff
similarity index 61%
rename from tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff
rename to tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff
index 6b96c24d46063..2285962fad1e6 100644
--- a/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff
+++ b/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `fn0` before ConstProp
-+ // MIR for `fn0` after ConstProp
+- // MIR for `fn0` before GVN
++ // MIR for `fn0` after GVN
fn fn0() -> bool {
let mut _0: bool;
@@ -23,24 +23,34 @@
bb0: {
StorageLive(_2);
- _2 = (const 1_i32, const false);
- StorageLive(_3);
+- _2 = (const 1_i32, const false);
+- StorageLive(_3);
++ _2 = const (1_i32, false);
++ nop;
_3 = &raw mut (_2.1: bool);
- _2 = (const 1_i32, const false);
+- _2 = (const 1_i32, const false);
++ _2 = const (1_i32, false);
StorageLive(_4);
(*_3) = const true;
_4 = const ();
StorageDead(_4);
- StorageLive(_5);
+- StorageLive(_5);
++ nop;
StorageLive(_6);
_6 = (_2.1: bool);
_5 = Not(move _6);
StorageDead(_6);
_0 = _5;
- StorageDead(_5);
- StorageDead(_3);
+- StorageDead(_5);
+- StorageDead(_3);
++ nop;
++ nop;
StorageDead(_2);
return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 01 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs
index 730ebe2ca636b..1ab8a6028233d 100644
--- a/tests/mir-opt/const_prop/address_of_pair.rs
+++ b/tests/mir-opt/const_prop/address_of_pair.rs
@@ -1,6 +1,6 @@
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR address_of_pair.fn0.ConstProp.diff
+// EMIT_MIR address_of_pair.fn0.GVN.diff
pub fn fn0() -> bool {
// CHECK-LABEL: fn fn0(
// CHECK: debug pair => [[pair:_.*]];
diff --git a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff
similarity index 85%
rename from tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff
index 5e2db148de83b..4f0f7fa8fa274 100644
--- a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `foo` before ConstProp
-+ // MIR for `foo` after ConstProp
+- // MIR for `foo` before GVN
++ // MIR for `foo` after GVN
fn foo(_1: u8) -> () {
debug x => _1;
@@ -25,7 +25,8 @@
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- _4 = (const 0_i32, move _5);
+- _4 = (const 0_i32, move _5);
++ _4 = (const 0_i32, _1);
StorageDead(_5);
- _3 = (_4.0: i32);
- _2 = Add(move _3, const 1_i32);
@@ -38,7 +39,8 @@
StorageLive(_8);
StorageLive(_9);
_9 = _1;
- _8 = (move _9, const 1_i32);
+- _8 = (move _9, const 1_i32);
++ _8 = (_1, const 1_i32);
StorageDead(_9);
- _7 = (_8.1: i32);
- _6 = Add(move _7, const 2_i32);
diff --git a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff
similarity index 85%
rename from tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff
index 5e2db148de83b..4f0f7fa8fa274 100644
--- a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `foo` before ConstProp
-+ // MIR for `foo` after ConstProp
+- // MIR for `foo` before GVN
++ // MIR for `foo` after GVN
fn foo(_1: u8) -> () {
debug x => _1;
@@ -25,7 +25,8 @@
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- _4 = (const 0_i32, move _5);
+- _4 = (const 0_i32, move _5);
++ _4 = (const 0_i32, _1);
StorageDead(_5);
- _3 = (_4.0: i32);
- _2 = Add(move _3, const 1_i32);
@@ -38,7 +39,8 @@
StorageLive(_8);
StorageLive(_9);
_9 = _1;
- _8 = (move _9, const 1_i32);
+- _8 = (move _9, const 1_i32);
++ _8 = (_1, const 1_i32);
StorageDead(_9);
- _7 = (_8.1: i32);
- _6 = Add(move _7, const 2_i32);
diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff
similarity index 85%
rename from tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff
index a4911a6d48ade..854e27445afb9 100644
--- a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -13,7 +13,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
StorageLive(_2);
StorageLive(_3);
_3 = (const 0_i32, const 1_u8, const 2_i32);
@@ -35,7 +36,8 @@
StorageDead(_5);
StorageDead(_4);
_0 = const ();
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff
similarity index 85%
rename from tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff
index b8b9fa5cc1c5c..f6c4b2c924097 100644
--- a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -13,7 +13,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
StorageLive(_2);
StorageLive(_3);
_3 = (const 0_i32, const 1_u8, const 2_i32);
@@ -35,7 +36,8 @@
StorageDead(_5);
StorageDead(_4);
_0 = const ();
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs
index fa716b0843de7..3dd37b5910eff 100644
--- a/tests/mir-opt/const_prop/aggregate.rs
+++ b/tests/mir-opt/const_prop/aggregate.rs
@@ -1,8 +1,8 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -O
-// EMIT_MIR aggregate.main.ConstProp.diff
+// EMIT_MIR aggregate.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
@@ -15,7 +15,7 @@ fn main() {
}
// Verify that we still propagate if part of the aggregate is not known.
-// EMIT_MIR aggregate.foo.ConstProp.diff
+// EMIT_MIR aggregate.foo.GVN.diff
fn foo(x: u8) {
// CHECK-LABEL: fn foo(
// CHECK: debug first => [[first:_.*]];
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.GVN.32bit.panic-abort.diff
similarity index 71%
rename from tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff
rename to tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff
index b2f58f8f771d7..f9537661e8ca1 100644
--- a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,12 +18,11 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
StorageLive(_3);
_3 = const 2_usize;
-- _4 = Len(_2);
+ _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];
++ _5 = Lt(const 2_usize, _4);
++ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
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.GVN.32bit.panic-unwind.diff
similarity index 71%
rename from tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff
index f9e3f8f171ad4..07886779fead4 100644
--- a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,12 +18,11 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
StorageLive(_3);
_3 = const 2_usize;
-- _4 = Len(_2);
+ _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];
++ _5 = Lt(const 2_usize, _4);
++ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {
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.GVN.64bit.panic-abort.diff
similarity index 71%
rename from tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff
rename to tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff
index b2f58f8f771d7..f9537661e8ca1 100644
--- a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,12 +18,11 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
StorageLive(_3);
_3 = const 2_usize;
-- _4 = Len(_2);
+ _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];
++ _5 = Lt(const 2_usize, _4);
++ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
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.GVN.64bit.panic-unwind.diff
similarity index 71%
rename from tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff
index f9e3f8f171ad4..07886779fead4 100644
--- a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,12 +18,11 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
StorageLive(_3);
_3 = const 2_usize;
-- _4 = Len(_2);
+ _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];
++ _5 = Lt(const 2_usize, _4);
++ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs
index c4c46d78f753c..2ae5087751f25 100644
--- a/tests/mir-opt/const_prop/array_index.rs
+++ b/tests/mir-opt/const_prop/array_index.rs
@@ -1,8 +1,8 @@
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// EMIT_MIR array_index.main.ConstProp.diff
+// EMIT_MIR array_index.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff
similarity index 91%
rename from tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff
index cead70110dcb8..4838efba6f9d1 100644
--- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,7 +18,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
@@ -47,7 +48,8 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff
similarity index 91%
rename from tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff
index c9c4ba8548c67..7f403d6efc103 100644
--- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,7 +18,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
@@ -47,7 +48,8 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
index 0e8765a077163..2ba53a80c43d9 100644
--- a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
+++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
@@ -1,7 +1,7 @@
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
+// EMIT_MIR bad_op_div_by_zero.main.GVN.diff
#[allow(unconditional_panic)]
fn main() {
// CHECK-LABEL: fn main(
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff
similarity index 91%
rename from tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff
index 2666fd9eb91f6..59f2eb86f5095 100644
--- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,7 +18,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
@@ -47,7 +48,8 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff
similarity index 91%
rename from tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff
index 679df90f16fea..9b866082788cd 100644
--- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,7 +18,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
@@ -47,7 +48,8 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
index d895d9e2155d6..9ab57750de0bb 100644
--- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
+++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
@@ -1,7 +1,7 @@
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff
+// EMIT_MIR bad_op_mod_by_zero.main.GVN.diff
#[allow(unconditional_panic)]
fn main() {
// CHECK-LABEL: fn main(
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.GVN.32bit.panic-abort.diff
similarity index 85%
rename from tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff
rename to tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff
index e443c8991f9a6..a42f9291324b3 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.GVN.32bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -22,15 +22,18 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
StorageLive(_2);
- StorageLive(_3);
+- StorageLive(_3);
++ nop;
_9 = const _;
_3 = &(*_9);
_2 = &raw const (*_3);
_1 = move _2 as *const [i32] (PointerCoercion(Unsize));
StorageDead(_2);
- StorageDead(_3);
+- StorageDead(_3);
++ nop;
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
@@ -47,7 +50,8 @@
StorageDead(_6);
_0 = const ();
StorageDead(_5);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
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.GVN.32bit.panic-unwind.diff
similarity index 85%
rename from tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff
index 592f43f473979..f2d6de6621b1a 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.GVN.32bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -22,15 +22,18 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
StorageLive(_2);
- StorageLive(_3);
+- StorageLive(_3);
++ nop;
_9 = const _;
_3 = &(*_9);
_2 = &raw const (*_3);
_1 = move _2 as *const [i32] (PointerCoercion(Unsize));
StorageDead(_2);
- StorageDead(_3);
+- StorageDead(_3);
++ nop;
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
@@ -47,7 +50,8 @@
StorageDead(_6);
_0 = const ();
StorageDead(_5);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
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.GVN.64bit.panic-abort.diff
similarity index 85%
rename from tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff
rename to tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff
index e443c8991f9a6..a42f9291324b3 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.GVN.64bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -22,15 +22,18 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
StorageLive(_2);
- StorageLive(_3);
+- StorageLive(_3);
++ nop;
_9 = const _;
_3 = &(*_9);
_2 = &raw const (*_3);
_1 = move _2 as *const [i32] (PointerCoercion(Unsize));
StorageDead(_2);
- StorageDead(_3);
+- StorageDead(_3);
++ nop;
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
@@ -47,7 +50,8 @@
StorageDead(_6);
_0 = const ();
StorageDead(_5);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
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.GVN.64bit.panic-unwind.diff
similarity index 85%
rename from tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff
index 592f43f473979..f2d6de6621b1a 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.GVN.64bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -22,15 +22,18 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
StorageLive(_2);
- StorageLive(_3);
+- StorageLive(_3);
++ nop;
_9 = const _;
_3 = &(*_9);
_2 = &raw const (*_3);
_1 = move _2 as *const [i32] (PointerCoercion(Unsize));
StorageDead(_2);
- StorageDead(_3);
+- StorageDead(_3);
++ nop;
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
@@ -47,7 +50,8 @@
StorageDead(_6);
_0 = const ();
StorageDead(_5);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
index 266105c11f2cc..c6d63f0bf1846 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
@@ -1,8 +1,8 @@
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
+// EMIT_MIR bad_op_unsafe_oob_for_slices.main.GVN.diff
#[allow(unconditional_panic)]
fn main() {
// CHECK-LABEL: fn main(
diff --git a/tests/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs
index 2aa038034d8d7..f6575ac8e5474 100644
--- a/tests/mir-opt/const_prop/boolean_identities.rs
+++ b/tests/mir-opt/const_prop/boolean_identities.rs
@@ -1,13 +1,14 @@
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR boolean_identities.test.ConstProp.diff
+// EMIT_MIR boolean_identities.test.GVN.diff
pub fn test(x: bool, y: bool) -> bool {
// CHECK-LABEL: fn test(
// CHECK: debug a => [[a:_.*]];
// CHECK: debug b => [[b:_.*]];
- // CHECK: [[a]] = const true;
- // CHECK: [[b]] = const false;
- // CHECK: _0 = const false;
+ // FIXME(cjgillot) simplify algebraic identity
+ // CHECK-NOT: [[a]] = const true;
+ // CHECK-NOT: [[b]] = const false;
+ // CHECK-NOT: _0 = const false;
let a = (y | true);
let b = (x & false);
a & b
diff --git a/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff b/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff
similarity index 67%
rename from tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff
rename to tests/mir-opt/const_prop/boolean_identities.test.GVN.diff
index 41e1acdff59b6..eca87af752725 100644
--- a/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff
+++ b/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `test` before ConstProp
-+ // MIR for `test` after ConstProp
+- // MIR for `test` before GVN
++ // MIR for `test` after GVN
fn test(_1: bool, _2: bool) -> bool {
debug x => _1;
@@ -19,30 +19,32 @@
}
bb0: {
- StorageLive(_3);
+- StorageLive(_3);
++ nop;
StorageLive(_4);
_4 = _2;
- _3 = BitOr(move _4, const true);
-+ _3 = const true;
++ _3 = BitOr(_2, const true);
StorageDead(_4);
- StorageLive(_5);
+- StorageLive(_5);
++ nop;
StorageLive(_6);
_6 = _1;
- _5 = BitAnd(move _6, const false);
-+ _5 = const false;
++ _5 = BitAnd(_1, const false);
StorageDead(_6);
StorageLive(_7);
-- _7 = _3;
-+ _7 = const true;
+ _7 = _3;
StorageLive(_8);
-- _8 = _5;
+ _8 = _5;
- _0 = BitAnd(move _7, move _8);
-+ _8 = const false;
-+ _0 = const false;
++ _0 = BitAnd(_3, _5);
StorageDead(_8);
StorageDead(_7);
- StorageDead(_5);
- StorageDead(_3);
+- StorageDead(_5);
+- StorageDead(_3);
++ nop;
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff
similarity index 95%
rename from tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff
index c9670a5ee4366..b3fdaa5ee8257 100644
--- a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff
similarity index 95%
rename from tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff
index 64fe72be5c89d..d0350c97253a2 100644
--- a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs
index 90a8e33e8236b..5227d7b8b8bad 100644
--- a/tests/mir-opt/const_prop/boxes.rs
+++ b/tests/mir-opt/const_prop/boxes.rs
@@ -1,4 +1,4 @@
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -O
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
@@ -6,7 +6,7 @@
// Note: this test verifies that we, in fact, do not const prop `#[rustc_box]`
-// EMIT_MIR boxes.main.ConstProp.diff
+// EMIT_MIR boxes.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
diff --git a/tests/mir-opt/const_prop/cast.main.ConstProp.diff b/tests/mir-opt/const_prop/cast.main.GVN.diff
similarity index 87%
rename from tests/mir-opt/const_prop/cast.main.ConstProp.diff
rename to tests/mir-opt/const_prop/cast.main.GVN.diff
index c63adcf1191e0..bc442c4e4468b 100644
--- a/tests/mir-opt/const_prop/cast.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/cast.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs
index b81c2740a73d0..00a8bcd1adbe8 100644
--- a/tests/mir-opt/const_prop/cast.rs
+++ b/tests/mir-opt/const_prop/cast.rs
@@ -1,5 +1,5 @@
-// unit-test: ConstProp
-// EMIT_MIR cast.main.ConstProp.diff
+// unit-test: GVN
+// EMIT_MIR cast.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff
similarity index 92%
rename from tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff
index 5a958cc7a4701..d5117b2f63846 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff
similarity index 92%
rename from tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff
index ab48186aed9a7..2118d37672c0b 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs
index 571a5cc4e4dae..0abcb5dd3d42a 100644
--- a/tests/mir-opt/const_prop/checked_add.rs
+++ b/tests/mir-opt/const_prop/checked_add.rs
@@ -1,8 +1,8 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -C overflow-checks=on
-// EMIT_MIR checked_add.main.ConstProp.diff
+// EMIT_MIR checked_add.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
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.GVN.panic-abort.diff
similarity index 77%
rename from tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff
index ba2e89f0a7445..803e1d711dec3 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.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `hello` before ConstProp
-+ // MIR for `hello` after ConstProp
+- // MIR for `hello` before GVN
++ // MIR for `hello` after GVN
fn hello() -> () {
let mut _0: ();
@@ -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.GVN.panic-unwind.diff
similarity index 77%
rename from tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff
index e0a610f60a795..f40eb38c6340d 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.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `hello` before ConstProp
-+ // MIR for `hello` after ConstProp
+- // MIR for `hello` before GVN
++ // MIR for `hello` after GVN
fn hello() -> () {
let mut _0: ();
@@ -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.rs b/tests/mir-opt/const_prop/control_flow_simplification.rs
index 5fc13e202751b..3cb9a4911a9dc 100644
--- a/tests/mir-opt/const_prop/control_flow_simplification.rs
+++ b/tests/mir-opt/const_prop/control_flow_simplification.rs
@@ -1,6 +1,6 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -Zmir-opt-level=1
trait NeedsDrop: Sized {
@@ -9,7 +9,7 @@ trait NeedsDrop: Sized {
impl NeedsDrop for This {}
-// EMIT_MIR control_flow_simplification.hello.ConstProp.diff
+// EMIT_MIR control_flow_simplification.hello.GVN.diff
// EMIT_MIR control_flow_simplification.hello.PreCodegen.before.mir
fn hello(){
if ::NEEDS {
diff --git a/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/discriminant.main.GVN.32bit.diff
similarity index 93%
rename from tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/discriminant.main.GVN.32bit.diff
index e02e7f320b865..70c3c3fe7e495 100644
--- a/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/discriminant.main.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/discriminant.main.GVN.64bit.diff
similarity index 93%
rename from tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/discriminant.main.GVN.64bit.diff
index e02e7f320b865..70c3c3fe7e495 100644
--- a/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/discriminant.main.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/discriminant.rs b/tests/mir-opt/const_prop/discriminant.rs
index 0ed683d629cd1..53874e9528efe 100644
--- a/tests/mir-opt/const_prop/discriminant.rs
+++ b/tests/mir-opt/const_prop/discriminant.rs
@@ -1,4 +1,4 @@
-// unit-test: ConstProp
+// unit-test: GVN
// FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with
// `let x = 42` but that doesn't work because const-prop doesn't support `Operand::Indirect`
@@ -6,7 +6,7 @@
// Fixing either of those will allow us to const-prop this away.
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// EMIT_MIR discriminant.main.ConstProp.diff
+// EMIT_MIR discriminant.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: bb0: {
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff
similarity index 93%
rename from tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff
index 530cfc6539a34..8301a4c1aa864 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff
similarity index 93%
rename from tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff
index 08cf72e47a90e..8dcbfd2c2c11e 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs
index d3c42e3eb0bb1..d089418e89844 100644
--- a/tests/mir-opt/const_prop/indirect.rs
+++ b/tests/mir-opt/const_prop/indirect.rs
@@ -1,8 +1,8 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -C overflow-checks=on
-// EMIT_MIR indirect.main.ConstProp.diff
+// EMIT_MIR indirect.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
diff --git a/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff b/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff
similarity index 78%
rename from tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff
rename to tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff
index 4eafb8d09178e..7dd80d6436078 100644
--- a/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff
+++ b/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `bar` before ConstProp
-+ // MIR for `bar` after ConstProp
+- // MIR for `bar` before GVN
++ // MIR for `bar` after GVN
fn bar() -> () {
let mut _0: ();
@@ -19,12 +19,15 @@
bb0: {
StorageLive(_1);
- _1 = (const 1_i32,);
+- _1 = (const 1_i32,);
++ _1 = const (1_i32,);
StorageLive(_2);
- StorageLive(_3);
+- StorageLive(_3);
++ nop;
_3 = &raw mut (_1.0: i32);
(*_3) = const 5_i32;
- StorageDead(_3);
+- StorageDead(_3);
++ nop;
_2 = const ();
StorageDead(_2);
StorageLive(_4);
diff --git a/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff b/tests/mir-opt/const_prop/indirect_mutation.foo.GVN.diff
similarity index 75%
rename from tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff
rename to tests/mir-opt/const_prop/indirect_mutation.foo.GVN.diff
index 445d9895d6a8f..c4b647d9d2d2d 100644
--- a/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff
+++ b/tests/mir-opt/const_prop/indirect_mutation.foo.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `foo` before ConstProp
-+ // MIR for `foo` after ConstProp
+- // MIR for `foo` before GVN
++ // MIR for `foo` after GVN
fn foo() -> () {
let mut _0: ();
@@ -16,11 +16,14 @@
bb0: {
StorageLive(_1);
- _1 = (const 1_i32,);
- StorageLive(_2);
+- _1 = (const 1_i32,);
+- StorageLive(_2);
++ _1 = const (1_i32,);
++ nop;
_2 = &mut (_1.0: i32);
(*_2) = const 5_i32;
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
StorageLive(_3);
StorageLive(_4);
_4 = (_1.0: i32);
diff --git a/tests/mir-opt/const_prop/indirect_mutation.rs b/tests/mir-opt/const_prop/indirect_mutation.rs
index ec9da6e8e5c5e..a4236060c8141 100644
--- a/tests/mir-opt/const_prop/indirect_mutation.rs
+++ b/tests/mir-opt/const_prop/indirect_mutation.rs
@@ -1,13 +1,13 @@
-// unit-test: ConstProp
+// unit-test: GVN
// Check that we do not propagate past an indirect mutation.
#![feature(raw_ref_op)]
-// EMIT_MIR indirect_mutation.foo.ConstProp.diff
+// EMIT_MIR indirect_mutation.foo.GVN.diff
fn foo() {
// CHECK-LABEL: fn foo(
// CHECK: debug u => _1;
// CHECK: debug y => _3;
- // CHECK: _1 = (const 1_i32,);
+ // CHECK: _1 = const (1_i32,);
// CHECK: _2 = &mut (_1.0: i32);
// CHECK: (*_2) = const 5_i32;
// CHECK: _4 = (_1.0: i32);
@@ -18,7 +18,7 @@ fn foo() {
let y = { u.0 } == 5;
}
-// EMIT_MIR indirect_mutation.bar.ConstProp.diff
+// EMIT_MIR indirect_mutation.bar.GVN.diff
fn bar() {
// CHECK-LABEL: fn bar(
// CHECK: debug v => _1;
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff
similarity index 94%
rename from tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff
index 11cdf9e09db0c..4c2df228eb853 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff
similarity index 94%
rename from tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff
index 181a2f287d66a..c4e666b489e0b 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/inherit_overflow.rs b/tests/mir-opt/const_prop/inherit_overflow.rs
index 5b561ae14adfa..c5b1dbe37a95d 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.rs
+++ b/tests/mir-opt/const_prop/inherit_overflow.rs
@@ -1,10 +1,10 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -Zmir-enable-passes=+Inline
// After inlining, this will contain a `CheckedBinaryOp`.
// Propagating the overflow is ok as codegen will just skip emitting the panic.
-// EMIT_MIR inherit_overflow.main.ConstProp.diff
+// EMIT_MIR inherit_overflow.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: {{_.*}} = const (0_u8, true);
diff --git a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff
similarity index 83%
rename from tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff
rename to tests/mir-opt/const_prop/invalid_constant.main.GVN.diff
index 10e978a683acc..da5bf1cf42ca9 100644
--- a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -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/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs
index ff6b31a1ee214..142f148d064b6 100644
--- a/tests/mir-opt/const_prop/invalid_constant.rs
+++ b/tests/mir-opt/const_prop/invalid_constant.rs
@@ -1,5 +1,5 @@
// skip-filecheck
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -Zmir-enable-passes=+RemoveZsts
// Verify that we can pretty print invalid constants.
@@ -15,7 +15,7 @@ enum E { A, B, C }
enum Empty {}
// EMIT_MIR invalid_constant.main.RemoveZsts.diff
-// EMIT_MIR invalid_constant.main.ConstProp.diff
+// EMIT_MIR invalid_constant.main.GVN.diff
fn main() {
// An invalid char.
union InvalidChar {
diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_66971.main.GVN.panic-abort.diff
similarity index 78%
rename from tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/issue_66971.main.GVN.panic-abort.diff
index ff93c85e5869d..30e8916e2d04f 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -11,8 +11,9 @@
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
- _3 = ();
+- _3 = ();
- _2 = (move _3, const 0_u8, const 0_u8);
++ _3 = const ();
+ _2 = const ((), 0_u8, 0_u8);
StorageDead(_3);
- _1 = encode(move _2) -> [return: bb1, unwind unreachable];
@@ -28,10 +29,6 @@
+ }
+
+ 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.GVN.panic-unwind.diff
similarity index 78%
rename from tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/issue_66971.main.GVN.panic-unwind.diff
index 8790aad4559c1..4eb29b174a97b 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -11,8 +11,9 @@
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
- _3 = ();
+- _3 = ();
- _2 = (move _3, const 0_u8, const 0_u8);
++ _3 = const ();
+ _2 = const ((), 0_u8, 0_u8);
StorageDead(_3);
- _1 = encode(move _2) -> [return: bb1, unwind continue];
@@ -28,10 +29,6 @@
+ }
+
+ ALLOC0 (size: 2, align: 1) {
-+ 00 00 │ ..
-+ }
-+
-+ ALLOC1 (size: 2, align: 1) {
+ 00 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_66971.rs b/tests/mir-opt/const_prop/issue_66971.rs
index 49d598ff23064..30f8ea1606a70 100644
--- a/tests/mir-opt/const_prop/issue_66971.rs
+++ b/tests/mir-opt/const_prop/issue_66971.rs
@@ -1,8 +1,8 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected
-// outputs below, after ConstProp this is how _2 would look like with the bug:
+// outputs below, after GVN this is how _2 would look like with the bug:
//
// _2 = (const Scalar(0x00) : (), const 0u8);
//
@@ -12,7 +12,7 @@ fn encode(this: ((), u8, u8)) {
assert!(this.2 == 0);
}
-// EMIT_MIR issue_66971.main.ConstProp.diff
+// EMIT_MIR issue_66971.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: = encode(const ((), 0_u8, 0_u8))
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_67019.main.GVN.panic-abort.diff
similarity index 92%
rename from tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/issue_67019.main.GVN.panic-abort.diff
index 3de9cdd79bc04..fc0c8afd4cfda 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_67019.main.GVN.panic-unwind.diff
similarity index 92%
rename from tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/issue_67019.main.GVN.panic-unwind.diff
index 72cf48b5cba9d..cf4089598e736 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/issue_67019.rs b/tests/mir-opt/const_prop/issue_67019.rs
index f0a09e6e85216..e589ed4edccf8 100644
--- a/tests/mir-opt/const_prop/issue_67019.rs
+++ b/tests/mir-opt/const_prop/issue_67019.rs
@@ -1,5 +1,5 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
// This used to ICE in const-prop
@@ -7,7 +7,7 @@ fn test(this: ((u8, u8),)) {
assert!((this.0).0 == 1);
}
-// EMIT_MIR issue_67019.main.ConstProp.diff
+// EMIT_MIR issue_67019.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: = test(const ((1_u8, 2_u8),))
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff
similarity index 67%
rename from tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff
rename to tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff
index 20e2ee326986b..cf36109fdcbdd 100644
--- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,17 +18,16 @@
_2 = [const 0_u8; 5000];
StorageLive(_3);
_3 = const 2_usize;
-- _4 = Len(_2);
+ _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];
++ _5 = Lt(const 2_usize, _4);
++ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = _2[_3];
-+ _1 = _2[2 of 3];
++ _1 = const 0_u8;
StorageDead(_3);
StorageDead(_2);
_0 = const ();
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff
similarity index 67%
rename from tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff
index 1bdbbbf7863f9..40ed969718007 100644
--- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,17 +18,16 @@
_2 = [const 0_u8; 5000];
StorageLive(_3);
_3 = const 2_usize;
-- _4 = Len(_2);
+ _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];
++ _5 = Lt(const 2_usize, _4);
++ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = _2[_3];
-+ _1 = _2[2 of 3];
++ _1 = const 0_u8;
StorageDead(_3);
StorageDead(_2);
_0 = const ();
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff
similarity index 67%
rename from tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff
rename to tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff
index 20e2ee326986b..cf36109fdcbdd 100644
--- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,17 +18,16 @@
_2 = [const 0_u8; 5000];
StorageLive(_3);
_3 = const 2_usize;
-- _4 = Len(_2);
+ _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];
++ _5 = Lt(const 2_usize, _4);
++ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = _2[_3];
-+ _1 = _2[2 of 3];
++ _1 = const 0_u8;
StorageDead(_3);
StorageDead(_2);
_0 = const ();
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff
similarity index 67%
rename from tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff
index 1bdbbbf7863f9..40ed969718007 100644
--- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,17 +18,16 @@
_2 = [const 0_u8; 5000];
StorageLive(_3);
_3 = const 2_usize;
-- _4 = Len(_2);
+ _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];
++ _5 = Lt(const 2_usize, _4);
++ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = _2[_3];
-+ _1 = _2[2 of 3];
++ _1 = const 0_u8;
StorageDead(_3);
StorageDead(_2);
_0 = const ();
diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs
index d98d166ff7ccd..12507b9434f40 100644
--- a/tests/mir-opt/const_prop/large_array_index.rs
+++ b/tests/mir-opt/const_prop/large_array_index.rs
@@ -1,9 +1,9 @@
// skip-filecheck
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// EMIT_MIR large_array_index.main.ConstProp.diff
+// EMIT_MIR large_array_index.main.GVN.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/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs
index 2e9c63a1ca179..2fdb75c3100e9 100644
--- a/tests/mir-opt/const_prop/mult_by_zero.rs
+++ b/tests/mir-opt/const_prop/mult_by_zero.rs
@@ -1,9 +1,10 @@
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR mult_by_zero.test.ConstProp.diff
+// EMIT_MIR mult_by_zero.test.GVN.diff
fn test(x: i32) -> i32 {
// CHECK: fn test(
- // CHECK: _0 = const 0_i32;
+ // FIXME(cjgillot) simplify algebraic identity
+ // CHECK-NOT: _0 = const 0_i32;
x * 0
}
diff --git a/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff b/tests/mir-opt/const_prop/mult_by_zero.test.GVN.diff
similarity index 72%
rename from tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff
rename to tests/mir-opt/const_prop/mult_by_zero.test.GVN.diff
index 73b1da064237a..e9fb34749c104 100644
--- a/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mult_by_zero.test.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `test` before ConstProp
-+ // MIR for `test` after ConstProp
+- // MIR for `test` before GVN
++ // MIR for `test` after GVN
fn test(_1: i32) -> i32 {
debug x => _1;
@@ -10,7 +10,7 @@
StorageLive(_2);
_2 = _1;
- _0 = Mul(move _2, const 0_i32);
-+ _0 = const 0_i32;
++ _0 = Mul(_1, const 0_i32);
StorageDead(_2);
return;
}
diff --git a/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable.main.GVN.diff
similarity index 78%
rename from tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff
rename to tests/mir-opt/const_prop/mutable_variable.main.GVN.diff
index ad8d9ddb0743f..11464e3240028 100644
--- a/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -17,8 +17,7 @@
_1 = const 42_i32;
_1 = const 99_i32;
StorageLive(_2);
-- _2 = _1;
-+ _2 = const 99_i32;
+ _2 = _1;
_0 = const ();
StorageDead(_2);
StorageDead(_1);
diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs
index 6c74ea5b9f46f..194f39f826eb6 100644
--- a/tests/mir-opt/const_prop/mutable_variable.rs
+++ b/tests/mir-opt/const_prop/mutable_variable.rs
@@ -1,13 +1,13 @@
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR mutable_variable.main.ConstProp.diff
+// EMIT_MIR mutable_variable.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
// CHECK: debug y => [[y:_.*]];
// CHECK: [[x]] = const 42_i32;
// CHECK: [[x]] = const 99_i32;
- // CHECK: [[y]] = const 99_i32;
+ // CHECK: [[y]] = [[x]];
let mut x = 42;
x = 99;
let y = x;
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.GVN.diff
similarity index 72%
rename from tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
rename to tests/mir-opt/const_prop/mutable_variable_aggregate.main.GVN.diff
index c3ace9687e65d..b6ff7b0fc234d 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,8 +18,7 @@
+ _1 = const (42_i32, 43_i32);
(_1.1: i32) = const 99_i32;
StorageLive(_2);
-- _2 = _1;
-+ _2 = const (42_i32, 99_i32);
+ _2 = _1;
_0 = const ();
StorageDead(_2);
StorageDead(_1);
@@ -28,10 +27,6 @@
+ }
+
+ ALLOC0 (size: 8, align: 4) {
-+ 2a 00 00 00 63 00 00 00 │ *...c...
-+ }
-+
-+ ALLOC1 (size: 8, align: 4) {
+ 2a 00 00 00 2b 00 00 00 │ *...+...
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
index a3829650290f9..b59132007aa24 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
@@ -1,13 +1,13 @@
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff
+// EMIT_MIR mutable_variable_aggregate.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
// CHECK: debug y => [[y:_.*]];
// CHECK: [[x]] = const (42_i32, 43_i32);
// CHECK: ([[x]].1: i32) = const 99_i32;
- // CHECK: [[y]] = const (42_i32, 99_i32);
+ // CHECK: [[y]] = [[x]];
let mut x = (42, 43);
x.1 = 99;
let y = x;
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.GVN.diff
similarity index 63%
rename from tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff
rename to tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.GVN.diff
index 106e27f8f2768..bc60546cd1902 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,17 +18,24 @@
bb0: {
StorageLive(_1);
- _1 = (const 42_i32, const 43_i32);
- StorageLive(_2);
+- _1 = (const 42_i32, const 43_i32);
+- StorageLive(_2);
++ _1 = const (42_i32, 43_i32);
++ nop;
_2 = &mut _1;
((*_2).1: i32) = const 99_i32;
StorageLive(_3);
_3 = _1;
_0 = const ();
StorageDead(_3);
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 2a 00 00 00 2b 00 00 00 │ *...+...
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
index 60f414ae28692..1867f7300bd2b 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
@@ -1,12 +1,12 @@
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff
+// EMIT_MIR mutable_variable_aggregate_mut_ref.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
// CHECK: debug z => [[z:_.*]];
// CHECK: debug y => [[y:_.*]];
- // CHECK: [[x]] = (const 42_i32, const 43_i32);
+ // CHECK: [[x]] = const (42_i32, 43_i32);
// CHECK: [[z]] = &mut [[x]];
// CHECK: ((*[[z]]).1: i32) = const 99_i32;
// CHECK: [[y]] = [[x]];
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-abort.diff
similarity index 80%
rename from tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-abort.diff
index 34288c62fee12..6480e480f8c58 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -21,8 +21,7 @@
(_1.1: i32) = const 99_i32;
(_1.0: i32) = const 42_i32;
StorageLive(_2);
-- _2 = (_1.1: i32);
-+ _2 = const 99_i32;
+ _2 = (_1.1: i32);
_0 = const ();
StorageDead(_2);
StorageDead(_1);
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-unwind.diff
similarity index 80%
rename from tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-unwind.diff
index 7ba2b483dc3fb..fb757801082ee 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -21,8 +21,7 @@
(_1.1: i32) = const 99_i32;
(_1.0: i32) = const 42_i32;
StorageLive(_2);
-- _2 = (_1.1: i32);
-+ _2 = const 99_i32;
+ _2 = (_1.1: i32);
_0 = const ();
StorageDead(_2);
StorageDead(_1);
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
index 888fcde2de609..d0a44d8f4a01d 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
@@ -1,7 +1,7 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff
+// EMIT_MIR mutable_variable_aggregate_partial_read.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
@@ -9,7 +9,7 @@ fn main() {
// CHECK: [[x]] = foo()
// CHECK: ([[x]].1: i32) = const 99_i32;
// CHECK: ([[x]].0: i32) = const 42_i32;
- // CHECK: [[y]] = const 99_i32;
+ // CHECK: [[y]] = ([[x]].1: i32);
let mut x: (i32, i32) = foo();
x.1 = 99;
x.0 = 42;
diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff
similarity index 85%
rename from tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff
rename to tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff
index 1f74bdcfd0321..d02c392f6bd69 100644
--- a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -22,12 +22,14 @@
_1 = const 42_u32;
StorageLive(_2);
StorageLive(_3);
- StorageLive(_4);
+- StorageLive(_4);
++ nop;
_4 = const {ALLOC0: *mut u32};
_3 = (*_4);
_1 = move _3;
StorageDead(_3);
- StorageDead(_4);
+- StorageDead(_4);
++ nop;
_2 = const ();
StorageDead(_2);
StorageLive(_5);
diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
index 49e9a701581b3..180e194928e5d 100644
--- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
@@ -1,9 +1,9 @@
-// unit-test: ConstProp
+// unit-test: GVN
// Verify that we do not propagate the contents of this mutable static.
static mut STATIC: u32 = 0x42424242;
-// EMIT_MIR mutable_variable_no_prop.main.ConstProp.diff
+// EMIT_MIR mutable_variable_no_prop.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-abort.diff
similarity index 81%
rename from tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-abort.diff
index 85bd2b6e722ff..d1d23675bfd91 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -22,7 +22,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
_1 = foo() -> [return: bb1, unwind unreachable];
}
@@ -32,18 +33,19 @@
+ _2 = const (1_i32, 2_i32);
StorageLive(_3);
_3 = _1;
- (_2.1: i32) = move _3;
+- (_2.1: i32) = move _3;
++ (_2.1: i32) = _1;
StorageDead(_3);
StorageLive(_4);
_4 = (_2.1: i32);
StorageLive(_5);
-- _5 = (_2.0: i32);
-+ _5 = const 1_i32;
+ _5 = (_2.0: i32);
_0 = const ();
StorageDead(_5);
StorageDead(_4);
StorageDead(_2);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
+ }
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-unwind.diff
similarity index 81%
rename from tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-unwind.diff
index 06e96e57a62fd..4d69c9ce2efe6 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -22,7 +22,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
_1 = foo() -> [return: bb1, unwind continue];
}
@@ -32,18 +33,19 @@
+ _2 = const (1_i32, 2_i32);
StorageLive(_3);
_3 = _1;
- (_2.1: i32) = move _3;
+- (_2.1: i32) = move _3;
++ (_2.1: i32) = _1;
StorageDead(_3);
StorageLive(_4);
_4 = (_2.1: i32);
StorageLive(_5);
-- _5 = (_2.0: i32);
-+ _5 = const 1_i32;
+ _5 = (_2.0: i32);
_0 = const ();
StorageDead(_5);
StorageDead(_4);
StorageDead(_2);
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
+ }
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
index 04e347fc03deb..585363572a51f 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
@@ -1,7 +1,7 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR mutable_variable_unprop_assign.main.ConstProp.diff
+// EMIT_MIR mutable_variable_unprop_assign.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
@@ -10,10 +10,9 @@ fn main() {
// CHECK: debug z => [[z:_.*]];
// CHECK: [[a]] = foo()
// CHECK: [[x]] = const (1_i32, 2_i32);
- // CHECK: [[tmp:_.*]] = [[a]];
- // CHECK: ([[x]].1: i32) = move [[tmp]];
+ // CHECK: ([[x]].1: i32) = [[a]];
// CHECK: [[y]] = ([[x]].1: i32);
- // CHECK: [[z]] = const 1_i32;
+ // CHECK: [[z]] = ([[x]].0: i32);
let a = foo();
let mut x: (i32, i32) = (1, 2);
x.1 = a;
diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-abort.diff
similarity index 97%
rename from tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-abort.diff
index 711db3d21dd72..5d94797905db4 100644
--- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `concrete` before ConstProp
-+ // MIR for `concrete` after ConstProp
+- // MIR for `concrete` before GVN
++ // MIR for `concrete` after GVN
fn concrete() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-unwind.diff
similarity index 97%
rename from tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-unwind.diff
index 49458145415c7..4d890742ee99c 100644
--- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `concrete` before ConstProp
-+ // MIR for `concrete` after ConstProp
+- // MIR for `concrete` before GVN
++ // MIR for `concrete` after GVN
fn concrete() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-abort.diff
similarity index 84%
rename from tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/offset_of.generic.GVN.panic-abort.diff
index 768970a7250f0..025241dd1bf96 100644
--- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `generic` before ConstProp
-+ // MIR for `generic` after ConstProp
+- // MIR for `generic` before GVN
++ // MIR for `generic` after GVN
fn generic() -> () {
let mut _0: ();
@@ -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.GVN.panic-unwind.diff
similarity index 84%
rename from tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/offset_of.generic.GVN.panic-unwind.diff
index 04ccd2b36e0d8..27f2b2f7355ed 100644
--- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `generic` before ConstProp
-+ // MIR for `generic` after ConstProp
+- // MIR for `generic` before GVN
++ // MIR for `generic` after GVN
fn generic() -> () {
let mut _0: ();
@@ -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/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs
index 2571c3856f462..43ecbbed186f6 100644
--- a/tests/mir-opt/const_prop/offset_of.rs
+++ b/tests/mir-opt/const_prop/offset_of.rs
@@ -1,5 +1,5 @@
// skip-filecheck
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(offset_of, offset_of_enum)]
@@ -39,7 +39,7 @@ enum Zeta {
B(char),
}
-// EMIT_MIR offset_of.concrete.ConstProp.diff
+// EMIT_MIR offset_of.concrete.GVN.diff
fn concrete() {
let x = offset_of!(Alpha, x);
let y = offset_of!(Alpha, y);
@@ -50,7 +50,7 @@ fn concrete() {
let eC = offset_of!(Epsilon, C.c);
}
-// EMIT_MIR offset_of.generic.ConstProp.diff
+// EMIT_MIR offset_of.generic.GVN.diff
fn generic() {
let gx = offset_of!(Gamma, x);
let gy = offset_of!(Gamma, y);
diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs
index 4cf6d7c139643..2a3499bf2fe42 100644
--- a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs
+++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs
@@ -1,4 +1,4 @@
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -O
// Regression test for https://github.com/rust-lang/rust/issues/118328
@@ -10,7 +10,7 @@ impl SizeOfConst {
const SIZE: usize = std::mem::size_of::();
}
-// EMIT_MIR overwrite_with_const_with_params.size_of.ConstProp.diff
+// EMIT_MIR overwrite_with_const_with_params.size_of.GVN.diff
fn size_of() -> usize {
// CHECK-LABEL: fn size_of(
// CHECK: _1 = const 0_usize;
diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.GVN.diff
similarity index 79%
rename from tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff
rename to tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.GVN.diff
index ad8318832d63b..caa78b7316e43 100644
--- a/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff
+++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `size_of` before ConstProp
-+ // MIR for `size_of` after ConstProp
+- // MIR for `size_of` before GVN
++ // MIR for `size_of` after GVN
fn size_of() -> usize {
let mut _0: usize;
diff --git a/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/pointer_expose_address.main.GVN.panic-abort.diff
similarity index 62%
rename from tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/pointer_expose_address.main.GVN.panic-abort.diff
index bd1de7476a2cc..425bc3ff6c1b2 100644
--- a/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/pointer_expose_address.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -13,25 +13,30 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
StorageLive(_2);
- StorageLive(_3);
+- StorageLive(_3);
++ nop;
_3 = const _;
_2 = &raw const (*_3);
_1 = move _2 as usize (PointerExposeAddress);
StorageDead(_2);
- StorageDead(_3);
+- StorageDead(_3);
++ nop;
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- _4 = read(move _5) -> [return: bb1, unwind unreachable];
+- _4 = read(move _5) -> [return: bb1, unwind unreachable];
++ _4 = read(_1) -> [return: bb1, unwind unreachable];
}
bb1: {
StorageDead(_5);
StorageDead(_4);
_0 = const ();
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/pointer_expose_address.main.GVN.panic-unwind.diff
similarity index 63%
rename from tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/pointer_expose_address.main.GVN.panic-unwind.diff
index 850b743feb1ca..e9360ab8d6299 100644
--- a/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/pointer_expose_address.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -13,25 +13,30 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
StorageLive(_2);
- StorageLive(_3);
+- StorageLive(_3);
++ nop;
_3 = const _;
_2 = &raw const (*_3);
_1 = move _2 as usize (PointerExposeAddress);
StorageDead(_2);
- StorageDead(_3);
+- StorageDead(_3);
++ nop;
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- _4 = read(move _5) -> [return: bb1, unwind continue];
+- _4 = read(move _5) -> [return: bb1, unwind continue];
++ _4 = read(_1) -> [return: bb1, unwind continue];
}
bb1: {
StorageDead(_5);
StorageDead(_4);
_0 = const ();
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/pointer_expose_address.rs b/tests/mir-opt/const_prop/pointer_expose_address.rs
index 631aac901b964..8944232f71ee4 100644
--- a/tests/mir-opt/const_prop/pointer_expose_address.rs
+++ b/tests/mir-opt/const_prop/pointer_expose_address.rs
@@ -1,17 +1,16 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// unit-test: ConstProp
+// unit-test: GVN
#[inline(never)]
fn read(_: usize) { }
-// EMIT_MIR pointer_expose_address.main.ConstProp.diff
+// EMIT_MIR pointer_expose_address.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: [[ptr:_.*]] = const _;
// CHECK: [[ref:_.*]] = &raw const (*[[ptr]]);
// CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeAddress);
- // CHECK: [[arg:_.*]] = [[x]];
- // CHECK: = read(move [[arg]])
+ // CHECK: = read([[x]])
const FOO: &i32 = &1;
let x = FOO as *const i32 as usize;
read(x);
diff --git a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff b/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff
similarity index 77%
rename from tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
rename to tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff
index e193c82d2c0ea..38f235052303f 100644
--- a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -14,8 +14,10 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
- StorageLive(_3);
+- StorageLive(_2);
+- StorageLive(_3);
++ nop;
++ nop;
_3 = const {ALLOC0: &u8};
- _2 = (*_3);
+ _2 = const 2_u8;
@@ -27,9 +29,11 @@
+ _4 = const 2_u8;
+ _1 = const 4_u8;
StorageDead(_4);
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
StorageDead(_5);
- StorageDead(_3);
+- StorageDead(_3);
++ nop;
_0 = const ();
StorageDead(_1);
return;
diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs
index 0fa18dd101a0b..a3d8fee65d745 100644
--- a/tests/mir-opt/const_prop/read_immutable_static.rs
+++ b/tests/mir-opt/const_prop/read_immutable_static.rs
@@ -1,8 +1,8 @@
-// unit-test: ConstProp
+// unit-test: GVN
static FOO: u8 = 2;
-// EMIT_MIR read_immutable_static.main.ConstProp.diff
+// EMIT_MIR read_immutable_static.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
diff --git a/tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff b/tests/mir-opt/const_prop/ref_deref.main.GVN.diff
similarity index 64%
rename from tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff
rename to tests/mir-opt/const_prop/ref_deref.main.GVN.diff
index a54ae8d2fdde6..8f9aa20524d06 100644
--- a/tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/ref_deref.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -13,11 +13,14 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+- StorageLive(_2);
++ nop;
_4 = const _;
_2 = &(*_4);
- _1 = (*_2);
- StorageDead(_2);
+- _1 = (*_2);
+- StorageDead(_2);
++ _1 = const 4_i32;
++ nop;
_0 = const ();
StorageDead(_1);
return;
diff --git a/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs
index 5bceae749ff23..67de110d8bb55 100644
--- a/tests/mir-opt/const_prop/ref_deref.rs
+++ b/tests/mir-opt/const_prop/ref_deref.rs
@@ -1,9 +1,9 @@
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR ref_deref.main.ConstProp.diff
+// EMIT_MIR ref_deref.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
- // CHECK: [[a]] = (*{{_.*}});
+ // CHECK: [[a]] = const 4_i32;
let a = *(&4);
}
diff --git a/tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff b/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff
similarity index 65%
rename from tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff
rename to tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff
index 05a4e17742d82..8d38888b7d6ac 100644
--- a/tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -13,11 +13,14 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+- StorageLive(_2);
++ nop;
_4 = const _;
_2 = &((*_4).1: i32);
- _1 = (*_2);
- StorageDead(_2);
+- _1 = (*_2);
+- StorageDead(_2);
++ _1 = const 5_i32;
++ nop;
_0 = const ();
StorageDead(_1);
return;
diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs
index 4b5c67303161d..0f706b91b3869 100644
--- a/tests/mir-opt/const_prop/ref_deref_project.rs
+++ b/tests/mir-opt/const_prop/ref_deref_project.rs
@@ -1,10 +1,10 @@
// This does not currently propagate (#67862)
-// unit-test: ConstProp
+// unit-test: GVN
-// EMIT_MIR ref_deref_project.main.ConstProp.diff
+// EMIT_MIR ref_deref_project.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
- // CHECK: [[a]] = (*{{_.*}});
+ // CHECK: [[a]] = const 5_i32;
let a = *(&(4, 5).1);
}
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff b/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff
similarity index 88%
rename from tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff
rename to tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff
index e7aa015d078ec..cde0cb32f7563 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs
index 33fdd4142c13f..96077d5b773ba 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.rs
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs
@@ -1,5 +1,5 @@
-// unit-test: ConstProp
-// EMIT_MIR reify_fn_ptr.main.ConstProp.diff
+// unit-test: GVN
+// EMIT_MIR reify_fn_ptr.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff
similarity index 74%
rename from tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff
rename to tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff
index a55bd029e99ab..a52e6e35483d6 100644
--- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -20,12 +20,11 @@
_3 = [const 42_u32; 8];
StorageLive(_4);
_4 = const 2_usize;
-- _5 = Len(_3);
+ _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];
++ _6 = Lt(const 2_usize, _5);
++ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff
similarity index 74%
rename from tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff
index d49ef2e0179f8..fe0acee71ebe4 100644
--- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -20,12 +20,11 @@
_3 = [const 42_u32; 8];
StorageLive(_4);
_4 = const 2_usize;
-- _5 = Len(_3);
+ _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];
++ _6 = Lt(const 2_usize, _5);
++ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff
similarity index 74%
rename from tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff
rename to tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff
index a55bd029e99ab..a52e6e35483d6 100644
--- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -20,12 +20,11 @@
_3 = [const 42_u32; 8];
StorageLive(_4);
_4 = const 2_usize;
-- _5 = Len(_3);
+ _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];
++ _6 = Lt(const 2_usize, _5);
++ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff
similarity index 74%
rename from tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff
index d49ef2e0179f8..fe0acee71ebe4 100644
--- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -20,12 +20,11 @@
_3 = [const 42_u32; 8];
StorageLive(_4);
_4 = const 2_usize;
-- _5 = Len(_3);
+ _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];
++ _6 = Lt(const 2_usize, _5);
++ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs
index 9f688bbb53e5c..2c8717d25bb57 100644
--- a/tests/mir-opt/const_prop/repeat.rs
+++ b/tests/mir-opt/const_prop/repeat.rs
@@ -1,8 +1,8 @@
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// EMIT_MIR repeat.main.ConstProp.diff
+// EMIT_MIR repeat.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/return_place.add.GVN.panic-abort.diff
similarity index 91%
rename from tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/return_place.add.GVN.panic-abort.diff
index 974a42e507809..51f8227c36b41 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/return_place.add.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `add` before ConstProp
-+ // MIR for `add` after ConstProp
+- // MIR for `add` before GVN
++ // MIR for `add` after GVN
fn add() -> u32 {
let mut _0: u32;
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/return_place.add.GVN.panic-unwind.diff
similarity index 90%
rename from tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/return_place.add.GVN.panic-unwind.diff
index 55dbc70028592..8174b4edea65c 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/return_place.add.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `add` before ConstProp
-+ // MIR for `add` after ConstProp
+- // MIR for `add` before GVN
++ // MIR for `add` after GVN
fn add() -> u32 {
let mut _0: u32;
diff --git a/tests/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs
index 286543abb9950..c207bcbdd6203 100644
--- a/tests/mir-opt/const_prop/return_place.rs
+++ b/tests/mir-opt/const_prop/return_place.rs
@@ -1,8 +1,8 @@
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -C overflow-checks=on
-// EMIT_MIR return_place.add.ConstProp.diff
+// EMIT_MIR return_place.add.GVN.diff
// EMIT_MIR return_place.add.PreCodegen.before.mir
fn add() -> u32 {
// CHECK-LABEL: fn add(
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff
similarity index 79%
rename from tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff
index c5c09c8edd7f8..0a20fb0e59ef0 100644
--- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -11,7 +11,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
_1 = const 1_u32;
StorageLive(_2);
StorageLive(_3);
@@ -25,7 +26,8 @@
StorageDead(_3);
StorageDead(_2);
_0 = const ();
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff
similarity index 79%
rename from tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff
index b256c56765e3e..8b9519d3adc49 100644
--- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -11,7 +11,8 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
++ nop;
_1 = const 1_u32;
StorageLive(_2);
StorageLive(_3);
@@ -25,7 +26,8 @@
StorageDead(_3);
StorageDead(_2);
_0 = const ();
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
}
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
index 782cd35d422d6..70d0eb5359183 100644
--- a/tests/mir-opt/const_prop/scalar_literal_propagation.rs
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
@@ -1,7 +1,7 @@
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// EMIT_MIR scalar_literal_propagation.main.ConstProp.diff
+// EMIT_MIR scalar_literal_propagation.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: = consume(const 1_u32)
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.GVN.32bit.panic-abort.diff
similarity index 53%
rename from tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff
rename to tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff
index 7d5d036f46023..8b2411e50ab06 100644
--- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,33 +18,41 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+- StorageLive(_2);
++ nop;
StorageLive(_3);
StorageLive(_4);
_9 = const _;
- _4 = _9;
- _3 = _4;
- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+- _4 = _9;
+- _3 = _4;
+- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
++ _4 = const {ALLOC0: &[u32; 3]};
++ _3 = const {ALLOC0: &[u32; 3]};
++ _2 = const {ALLOC0: &[u32; 3]} as &[u32] (PointerCoercion(Unsize));
StorageDead(_3);
StorageLive(_6);
_6 = const 1_usize;
-- _7 = Len((*_2));
+ _7 = Len((*_2));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
-+ _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];
++ _8 = Lt(const 1_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = (*_2)[_6];
-+ _1 = const 2_u32;
++ _1 = (*_2)[1 of 2];
StorageDead(_6);
StorageDead(_4);
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
_0 = const ();
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 12, align: 4) {
++ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............
}
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff
similarity index 53%
rename from tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff
index fa4c5a71be50c..9b20d243f876b 100644
--- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,33 +18,41 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+- StorageLive(_2);
++ nop;
StorageLive(_3);
StorageLive(_4);
_9 = const _;
- _4 = _9;
- _3 = _4;
- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+- _4 = _9;
+- _3 = _4;
+- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
++ _4 = const {ALLOC0: &[u32; 3]};
++ _3 = const {ALLOC0: &[u32; 3]};
++ _2 = const {ALLOC0: &[u32; 3]} as &[u32] (PointerCoercion(Unsize));
StorageDead(_3);
StorageLive(_6);
_6 = const 1_usize;
-- _7 = Len((*_2));
+ _7 = Len((*_2));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
-+ _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];
++ _8 = Lt(const 1_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = (*_2)[_6];
-+ _1 = const 2_u32;
++ _1 = (*_2)[1 of 2];
StorageDead(_6);
StorageDead(_4);
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
_0 = const ();
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 12, align: 4) {
++ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............
}
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff
similarity index 53%
rename from tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff
rename to tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff
index 7d5d036f46023..8b2411e50ab06 100644
--- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,33 +18,41 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+- StorageLive(_2);
++ nop;
StorageLive(_3);
StorageLive(_4);
_9 = const _;
- _4 = _9;
- _3 = _4;
- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+- _4 = _9;
+- _3 = _4;
+- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
++ _4 = const {ALLOC0: &[u32; 3]};
++ _3 = const {ALLOC0: &[u32; 3]};
++ _2 = const {ALLOC0: &[u32; 3]} as &[u32] (PointerCoercion(Unsize));
StorageDead(_3);
StorageLive(_6);
_6 = const 1_usize;
-- _7 = Len((*_2));
+ _7 = Len((*_2));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
-+ _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];
++ _8 = Lt(const 1_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = (*_2)[_6];
-+ _1 = const 2_u32;
++ _1 = (*_2)[1 of 2];
StorageDead(_6);
StorageDead(_4);
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
_0 = const ();
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 12, align: 4) {
++ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............
}
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff
similarity index 53%
rename from tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff
rename to tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff
index fa4c5a71be50c..9b20d243f876b 100644
--- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -18,33 +18,41 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+- StorageLive(_2);
++ nop;
StorageLive(_3);
StorageLive(_4);
_9 = const _;
- _4 = _9;
- _3 = _4;
- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+- _4 = _9;
+- _3 = _4;
+- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
++ _4 = const {ALLOC0: &[u32; 3]};
++ _3 = const {ALLOC0: &[u32; 3]};
++ _2 = const {ALLOC0: &[u32; 3]} as &[u32] (PointerCoercion(Unsize));
StorageDead(_3);
StorageLive(_6);
_6 = const 1_usize;
-- _7 = Len((*_2));
+ _7 = Len((*_2));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
-+ _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];
++ _8 = Lt(const 1_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = (*_2)[_6];
-+ _1 = const 2_u32;
++ _1 = (*_2)[1 of 2];
StorageDead(_6);
StorageDead(_4);
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
_0 = const ();
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 12, align: 4) {
++ 01 00 00 00 02 00 00 00 03 00 00 00 │ ............
}
diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs
index 0bf44272698ad..79cd926df2144 100644
--- a/tests/mir-opt/const_prop/slice_len.rs
+++ b/tests/mir-opt/const_prop/slice_len.rs
@@ -1,13 +1,16 @@
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -Zmir-enable-passes=+InstSimplify
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// EMIT_MIR slice_len.main.ConstProp.diff
+// EMIT_MIR slice_len.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
- // CHECK: assert(const true,
- // CHECK: [[a]] = const 2_u32;
+ // CHECK: [[slice:_.*]] = const {{.*}} as &[u32] (PointerCoercion(Unsize));
+ // FIXME(cjgillot) simplify Len and projection into unsized slice.
+ // CHECK-NOT: assert(const true,
+ // CHECK: [[a]] = (*[[slice]])[1 of 2];
+ // CHECK-NOT: [[a]] = const 2_u32;
let a = (&[1u32, 2, 3] as &[u32])[1];
}
diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/switch_int.main.GVN.panic-abort.diff
similarity index 87%
rename from tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/switch_int.main.GVN.panic-abort.diff
index 508cc15732c0c..ee9f2d5c7f5bd 100644
--- a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/switch_int.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/switch_int.main.GVN.panic-unwind.diff
similarity index 87%
rename from tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/switch_int.main.GVN.panic-unwind.diff
index 1ce28e979a5b0..143d04ac984bc 100644
--- a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/switch_int.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs
index d1cbaae49aa3b..c81b574d15009 100644
--- a/tests/mir-opt/const_prop/switch_int.rs
+++ b/tests/mir-opt/const_prop/switch_int.rs
@@ -1,11 +1,11 @@
-// unit-test: ConstProp
+// unit-test: GVN
// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#[inline(never)]
fn foo(_: i32) { }
-// EMIT_MIR switch_int.main.ConstProp.diff
+// EMIT_MIR switch_int.main.GVN.diff
// EMIT_MIR switch_int.main.SimplifyConstCondition-after-const-prop.diff
fn main() {
// CHECK-LABEL: fn main(
diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.from_char.GVN.32bit.diff
similarity index 70%
rename from tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.from_char.GVN.32bit.diff
index febfebc85347c..47dfb421ebc8f 100644
--- a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.from_char.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `from_char` before ConstProp
-+ // MIR for `from_char` after ConstProp
+- // MIR for `from_char` before GVN
++ // MIR for `from_char` after GVN
fn from_char() -> i32 {
let mut _0: i32;
diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.from_char.GVN.64bit.diff
similarity index 70%
rename from tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.from_char.GVN.64bit.diff
index febfebc85347c..47dfb421ebc8f 100644
--- a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.from_char.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `from_char` before ConstProp
-+ // MIR for `from_char` after ConstProp
+- // MIR for `from_char` before GVN
++ // MIR for `from_char` after GVN
fn from_char() -> i32 {
let mut _0: i32;
diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.32bit.diff
similarity index 71%
rename from tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.invalid_bool.GVN.32bit.diff
index 38a1eb5a15b57..f0c6f55f775f6 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `invalid_bool` before ConstProp
-+ // MIR for `invalid_bool` after ConstProp
+- // MIR for `invalid_bool` before GVN
++ // MIR for `invalid_bool` after GVN
fn invalid_bool() -> bool {
let mut _0: bool;
diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.64bit.diff
similarity index 71%
rename from tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.invalid_bool.GVN.64bit.diff
index 38a1eb5a15b57..f0c6f55f775f6 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_bool.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `invalid_bool` before ConstProp
-+ // MIR for `invalid_bool` after ConstProp
+- // MIR for `invalid_bool` before GVN
++ // MIR for `invalid_bool` after GVN
fn invalid_bool() -> bool {
let mut _0: bool;
diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.GVN.32bit.diff
similarity index 71%
rename from tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.invalid_char.GVN.32bit.diff
index 2c0998f77eaee..a9e32d4d92544 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_char.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `invalid_char` before ConstProp
-+ // MIR for `invalid_char` after ConstProp
+- // MIR for `invalid_char` before GVN
++ // MIR for `invalid_char` after GVN
fn invalid_char() -> char {
let mut _0: char;
diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.GVN.64bit.diff
similarity index 71%
rename from tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.invalid_char.GVN.64bit.diff
index 2c0998f77eaee..a9e32d4d92544 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_char.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `invalid_char` before ConstProp
-+ // MIR for `invalid_char` after ConstProp
+- // MIR for `invalid_char` before GVN
++ // MIR for `invalid_char` after GVN
fn invalid_char() -> char {
let mut _0: char;
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.GVN.32bit.diff
similarity index 79%
rename from tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.less_as_i8.GVN.32bit.diff
index 7ac7bed8a5f70..5e0c076b9819f 100644
--- a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `less_as_i8` before ConstProp
-+ // MIR for `less_as_i8` after ConstProp
+- // MIR for `less_as_i8` before GVN
++ // MIR for `less_as_i8` after GVN
fn less_as_i8() -> i8 {
let mut _0: i8;
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.GVN.64bit.diff
similarity index 79%
rename from tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.less_as_i8.GVN.64bit.diff
index 7ac7bed8a5f70..5e0c076b9819f 100644
--- a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.less_as_i8.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `less_as_i8` before ConstProp
-+ // MIR for `less_as_i8` after ConstProp
+- // MIR for `less_as_i8` before GVN
++ // MIR for `less_as_i8` after GVN
fn less_as_i8() -> i8 {
let mut _0: i8;
diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs
index 99988d0599454..6ff0ba422f42e 100644
--- a/tests/mir-opt/const_prop/transmute.rs
+++ b/tests/mir-opt/const_prop/transmute.rs
@@ -1,46 +1,46 @@
-// unit-test: ConstProp
+// unit-test: GVN
// 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.ConstProp.diff
+// EMIT_MIR transmute.less_as_i8.GVN.diff
pub fn less_as_i8() -> i8 {
// CHECK-LABEL: fn less_as_i8(
// CHECK: _0 = const -1_i8;
unsafe { transmute(std::cmp::Ordering::Less) }
}
-// EMIT_MIR transmute.from_char.ConstProp.diff
+// EMIT_MIR transmute.from_char.GVN.diff
pub fn from_char() -> i32 {
// CHECK-LABEL: fn from_char(
// CHECK: _0 = const 82_i32;
unsafe { transmute('R') }
}
-// EMIT_MIR transmute.valid_char.ConstProp.diff
+// EMIT_MIR transmute.valid_char.GVN.diff
pub fn valid_char() -> char {
// CHECK-LABEL: fn valid_char(
// CHECK: _0 = const 'R';
unsafe { transmute(0x52_u32) }
}
-// EMIT_MIR transmute.invalid_char.ConstProp.diff
+// EMIT_MIR transmute.invalid_char.GVN.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.ConstProp.diff
+// EMIT_MIR transmute.invalid_bool.GVN.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.ConstProp.diff
+// EMIT_MIR transmute.undef_union_as_integer.GVN.diff
pub unsafe fn undef_union_as_integer() -> u32 {
// CHECK-LABEL: fn undef_union_as_integer(
// CHECK: _1 = Union32 {
@@ -49,16 +49,16 @@ pub unsafe fn undef_union_as_integer() -> u32 {
unsafe { transmute(Union32 { unit: () }) }
}
-// EMIT_MIR transmute.unreachable_direct.ConstProp.diff
+// EMIT_MIR transmute.unreachable_direct.GVN.diff
pub unsafe fn unreachable_direct() -> ! {
// CHECK-LABEL: fn unreachable_direct(
- // CHECK: [[unit:_.*]] = ();
- // CHECK: move [[unit]] as Never (Transmute);
+ // CHECK: = const ();
+ // CHECK: = const () as Never (Transmute);
let x: Never = unsafe { transmute(()) };
match x {}
}
-// EMIT_MIR transmute.unreachable_ref.ConstProp.diff
+// EMIT_MIR transmute.unreachable_ref.GVN.diff
pub unsafe fn unreachable_ref() -> ! {
// CHECK-LABEL: fn unreachable_ref(
// CHECK: = const {0x1 as &Never};
@@ -66,7 +66,7 @@ pub unsafe fn unreachable_ref() -> ! {
match *x {}
}
-// EMIT_MIR transmute.unreachable_mut.ConstProp.diff
+// EMIT_MIR transmute.unreachable_mut.GVN.diff
pub unsafe fn unreachable_mut() -> ! {
// CHECK-LABEL: fn unreachable_mut(
// CHECK: = const {0x1 as &mut Never};
@@ -74,7 +74,7 @@ pub unsafe fn unreachable_mut() -> ! {
match *x {}
}
-// EMIT_MIR transmute.unreachable_box.ConstProp.diff
+// EMIT_MIR transmute.unreachable_box.GVN.diff
pub unsafe fn unreachable_box() -> ! {
// CHECK-LABEL: fn unreachable_box(
// CHECK: = const Box::(
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.GVN.32bit.diff
similarity index 74%
rename from tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.32bit.diff
index afedf2a306137..c6a428019d81a 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.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `undef_union_as_integer` before ConstProp
-+ // MIR for `undef_union_as_integer` after ConstProp
+- // MIR for `undef_union_as_integer` before GVN
++ // MIR for `undef_union_as_integer` after GVN
fn undef_union_as_integer() -> u32 {
let mut _0: u32;
@@ -11,7 +11,8 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
+- _2 = ();
++ _2 = const ();
_1 = Union32 { value: move _2 };
StorageDead(_2);
_0 = move _1 as u32 (Transmute);
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.GVN.64bit.diff
similarity index 74%
rename from tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.undef_union_as_integer.GVN.64bit.diff
index afedf2a306137..c6a428019d81a 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.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `undef_union_as_integer` before ConstProp
-+ // MIR for `undef_union_as_integer` after ConstProp
+- // MIR for `undef_union_as_integer` before GVN
++ // MIR for `undef_union_as_integer` after GVN
fn undef_union_as_integer() -> u32 {
let mut _0: u32;
@@ -11,7 +11,8 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
+- _2 = ();
++ _2 = const ();
_1 = Union32 { value: move _2 };
StorageDead(_2);
_0 = move _1 as u32 (Transmute);
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff
similarity index 87%
rename from tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff
index 16519749b8207..2ef83abfac0a3 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `unreachable_box` before ConstProp
-+ // MIR for `unreachable_box` after ConstProp
+- // MIR for `unreachable_box` before GVN
++ // MIR for `unreachable_box` after GVN
fn unreachable_box() -> ! {
let mut _0: !;
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff
similarity index 87%
rename from tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff
index 16519749b8207..2ef83abfac0a3 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `unreachable_box` before ConstProp
-+ // MIR for `unreachable_box` after ConstProp
+- // MIR for `unreachable_box` before GVN
++ // MIR for `unreachable_box` after GVN
fn unreachable_box() -> ! {
let mut _0: !;
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff
similarity index 55%
rename from tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff
index 896608e7eff5d..b2e91014625c4 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `unreachable_direct` before ConstProp
-+ // MIR for `unreachable_direct` after ConstProp
+- // MIR for `unreachable_direct` before GVN
++ // MIR for `unreachable_direct` after GVN
fn unreachable_direct() -> ! {
let mut _0: !;
@@ -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 () as Never (Transmute);
unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff
similarity index 55%
rename from tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff
index 896608e7eff5d..b2e91014625c4 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `unreachable_direct` before ConstProp
-+ // MIR for `unreachable_direct` after ConstProp
+- // MIR for `unreachable_direct` before GVN
++ // MIR for `unreachable_direct` after GVN
fn unreachable_direct() -> ! {
let mut _0: !;
@@ -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 () as Never (Transmute);
unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff
similarity index 69%
rename from tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff
index c9d5ccf0bfdd1..93dfef96cf154 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `unreachable_mut` before ConstProp
-+ // MIR for `unreachable_mut` after ConstProp
+- // MIR for `unreachable_mut` before GVN
++ // MIR for `unreachable_mut` after GVN
fn unreachable_mut() -> ! {
let mut _0: !;
@@ -13,11 +13,13 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+- StorageLive(_2);
- _2 = const 1_usize as &mut Never (Transmute);
++ nop;
+ _2 = const {0x1 as &mut Never};
_1 = &mut (*_2);
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff
similarity index 69%
rename from tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff
index c9d5ccf0bfdd1..93dfef96cf154 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `unreachable_mut` before ConstProp
-+ // MIR for `unreachable_mut` after ConstProp
+- // MIR for `unreachable_mut` before GVN
++ // MIR for `unreachable_mut` after GVN
fn unreachable_mut() -> ! {
let mut _0: !;
@@ -13,11 +13,13 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+- StorageLive(_2);
- _2 = const 1_usize as &mut Never (Transmute);
++ nop;
+ _2 = const {0x1 as &mut Never};
_1 = &mut (*_2);
- StorageDead(_2);
+- StorageDead(_2);
++ nop;
unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff
similarity index 77%
rename from tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff
index b684ba34c691a..430d16c97a6c5 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `unreachable_ref` before ConstProp
-+ // MIR for `unreachable_ref` after ConstProp
+- // MIR for `unreachable_ref` before GVN
++ // MIR for `unreachable_ref` after GVN
fn unreachable_ref() -> ! {
let mut _0: !;
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff
similarity index 77%
rename from tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff
index b684ba34c691a..430d16c97a6c5 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `unreachable_ref` before ConstProp
-+ // MIR for `unreachable_ref` after ConstProp
+- // MIR for `unreachable_ref` before GVN
++ // MIR for `unreachable_ref` after GVN
fn unreachable_ref() -> ! {
let mut _0: !;
diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.GVN.32bit.diff
similarity index 70%
rename from tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff
rename to tests/mir-opt/const_prop/transmute.valid_char.GVN.32bit.diff
index f215b3ca398a7..f9d002f96ab09 100644
--- a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.valid_char.GVN.32bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `valid_char` before ConstProp
-+ // MIR for `valid_char` after ConstProp
+- // MIR for `valid_char` before GVN
++ // MIR for `valid_char` after GVN
fn valid_char() -> char {
let mut _0: char;
diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.GVN.64bit.diff
similarity index 70%
rename from tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff
rename to tests/mir-opt/const_prop/transmute.valid_char.GVN.64bit.diff
index f215b3ca398a7..f9d002f96ab09 100644
--- a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.valid_char.GVN.64bit.diff
@@ -1,5 +1,5 @@
-- // MIR for `valid_char` before ConstProp
-+ // MIR for `valid_char` after ConstProp
+- // MIR for `valid_char` before GVN
++ // MIR for `valid_char` after GVN
fn valid_char() -> char {
let mut _0: char;
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff
similarity index 69%
rename from tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff
index f19650d5a83d7..c2f3fb1b3b575 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -11,8 +11,9 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
- _1 = (const 1_u32, const 2_u32);
++ nop;
+ _1 = const (1_u32, 2_u32);
StorageLive(_2);
StorageLive(_3);
@@ -26,20 +27,13 @@
StorageDead(_3);
StorageDead(_2);
_0 = const ();
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
-+ 01 00 00 00 02 00 00 00 │ ........
-+ }
-+
-+ ALLOC1 (size: 8, align: 4) {
-+ 01 00 00 00 02 00 00 00 │ ........
-+ }
-+
-+ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff
similarity index 69%
rename from tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff
index 67307c4233102..55d9a3b0cac67 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -11,8 +11,9 @@
}
bb0: {
- StorageLive(_1);
+- StorageLive(_1);
- _1 = (const 1_u32, const 2_u32);
++ nop;
+ _1 = const (1_u32, 2_u32);
StorageLive(_2);
StorageLive(_3);
@@ -26,20 +27,13 @@
StorageDead(_3);
StorageDead(_2);
_0 = const ();
- StorageDead(_1);
+- StorageDead(_1);
++ nop;
return;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
-+ 01 00 00 00 02 00 00 00 │ ........
-+ }
-+
-+ ALLOC1 (size: 8, align: 4) {
-+ 01 00 00 00 02 00 00 00 │ ........
-+ }
-+
-+ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.rs b/tests/mir-opt/const_prop/tuple_literal_propagation.rs
index dfc4a6f3fbb91..6803612f0a5c4 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.rs
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.rs
@@ -1,6 +1,6 @@
-// unit-test: ConstProp
+// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// EMIT_MIR tuple_literal_propagation.main.ConstProp.diff
+// EMIT_MIR tuple_literal_propagation.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
diff --git a/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.GVN.diff
similarity index 68%
rename from tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff
rename to tests/mir-opt/const_prop/while_let_loops.change_loop_body.GVN.diff
index f54908b4a38a6..9548afc9d4027 100644
--- a/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff
+++ b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.GVN.diff
@@ -1,5 +1,5 @@
-- // MIR for `change_loop_body` before ConstProp
-+ // MIR for `change_loop_body` after ConstProp
+- // MIR for `change_loop_body` before GVN
++ // MIR for `change_loop_body` after GVN
fn change_loop_body() -> () {
let mut _0: ();
@@ -21,15 +21,17 @@
StorageLive(_1);
_1 = const 0_i32;
StorageLive(_3);
- _3 = Option::::None;
+- _3 = Option::::None;
- _4 = discriminant(_3);
- switchInt(move _4) -> [1: bb1, otherwise: bb3];
++ _3 = const Option::::None;
+ _4 = const 0_isize;
+ switchInt(const 0_isize) -> [1: bb1, otherwise: bb3];
}
bb1: {
- switchInt(((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3];
+- switchInt(((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3];
++ switchInt(const Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: u32) -> [0: bb2, otherwise: bb3];
}
bb2: {
@@ -50,5 +52,9 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 __ __ __ __ │ ....░░░░
}
diff --git a/tests/mir-opt/const_prop/while_let_loops.rs b/tests/mir-opt/const_prop/while_let_loops.rs
index 8b2a73438d61a..d6527552bb045 100644
--- a/tests/mir-opt/const_prop/while_let_loops.rs
+++ b/tests/mir-opt/const_prop/while_let_loops.rs
@@ -1,5 +1,5 @@
-// unit-test: ConstProp
-// EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff
+// unit-test: GVN
+// EMIT_MIR while_let_loops.change_loop_body.GVN.diff
pub fn change_loop_body() {
// CHECK-LABEL: fn change_loop_body(
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
index ddfe2e8c83119..6925fdb1e704f 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
@@ -74,18 +74,18 @@
StorageDead(_7);
StorageLive(_8);
StorageLive(_9);
- _8 = const {0x1 as *const [bool; 0]};
- _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+ _5 = NonNull::<[bool; 0]> { pointer: _8 };
StorageDead(_9);
StorageDead(_8);
StorageDead(_6);
- _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const 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(_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 +97,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/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
index 861295faa5a16..82ad842505c5a 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -74,18 +74,18 @@
StorageDead(_7);
StorageLive(_8);
StorageLive(_9);
- _8 = const {0x1 as *const [bool; 0]};
- _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+ _5 = NonNull::<[bool; 0]> { pointer: _8 };
StorageDead(_9);
StorageDead(_8);
StorageDead(_6);
- _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const 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(_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 +101,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/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
index cbb639edc53a6..6925fdb1e704f 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
@@ -74,18 +74,18 @@
StorageDead(_7);
StorageLive(_8);
StorageLive(_9);
- _8 = const {0x1 as *const [bool; 0]};
- _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+ _5 = NonNull::<[bool; 0]> { pointer: _8 };
StorageDead(_9);
StorageDead(_8);
StorageDead(_6);
- _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const 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(_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 +97,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/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
index 656846e9f976c..82ad842505c5a 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -74,18 +74,18 @@
StorageDead(_7);
StorageLive(_8);
StorageLive(_9);
- _8 = const {0x1 as *const [bool; 0]};
- _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+ _5 = NonNull::<[bool; 0]> { pointer: _8 };
StorageDead(_9);
StorageDead(_8);
StorageDead(_6);
- _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const 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(_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 +101,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.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff
similarity index 70%
rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff
rename to tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff
index 8363783e64e0d..13545aa464aa5 100644
--- 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.GVN.32bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -77,23 +77,18 @@
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]} }};
++ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+ _5 = NonNull::<[bool; 0]> { pointer: _8 };
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]> }};
+ _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const 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]> }};
+ _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
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);
+ _2 = Box::<[bool]>(_3, const 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) };
+ _1 = A { foo: move _2 };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
@@ -103,17 +98,5 @@
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.GVN.32bit.panic-unwind.diff
similarity index 70%
rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff
rename to tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff
index 19326b6a93355..bf32691538148 100644
--- 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.GVN.32bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -77,23 +77,18 @@
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]} }};
++ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+ _5 = NonNull::<[bool; 0]> { pointer: _8 };
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]> }};
+ _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const 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]> }};
+ _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
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);
+ _2 = Box::<[bool]>(_3, const 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) };
+ _1 = A { foo: move _2 };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
@@ -107,17 +102,5 @@
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.GVN.64bit.panic-abort.diff
similarity index 69%
rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff
rename to tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff
index 0d1e2430ce34b..13545aa464aa5 100644
--- 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.GVN.64bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -77,23 +77,18 @@
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]} }};
++ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+ _5 = NonNull::<[bool; 0]> { pointer: _8 };
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]> }};
+ _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const 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]> }};
+ _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
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);
+ _2 = Box::<[bool]>(_3, const 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) };
+ _1 = A { foo: move _2 };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
@@ -103,17 +98,5 @@
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.GVN.64bit.panic-unwind.diff
similarity index 70%
rename from tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff
rename to tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff
index 35f1e5ba796ef..bf32691538148 100644
--- 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.GVN.64bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
@@ -77,23 +77,18 @@
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]} }};
++ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+ _5 = NonNull::<[bool; 0]> { pointer: _8 };
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]> }};
+ _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const 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]> }};
+ _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
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);
+ _2 = Box::<[bool]>(_3, const 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) };
+ _1 = A { foo: move _2 };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
@@ -107,17 +102,5 @@
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/default_boxed_slice.rs b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
index 1bb052736c05d..8006bd510e150 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
@@ -1,6 +1,6 @@
// skip-filecheck
// unit-test: DataflowConstProp
-// compile-flags: -Zmir-enable-passes=+ConstProp,+Inline
+// compile-flags: -Zmir-enable-passes=+GVN,+Inline
// ignore-debug assertions change the output MIR
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
@@ -9,7 +9,7 @@ struct A {
foo: Box<[bool]>,
}
-// EMIT_MIR default_boxed_slice.main.ConstProp.diff
+// EMIT_MIR default_boxed_slice.main.GVN.diff
// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff
fn main() {
// ConstProp will create a constant of type `Box<[bool]>`.
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/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff
index 97ca825092e4a..80b5681ad062c 100644
--- a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff
+++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff
@@ -33,8 +33,8 @@
- StorageLive(_5);
- _5 = _1;
- StorageLive(_6);
-- _6 = _2;
-- _4 = g::(move _5, move _6) -> [return: bb2, unwind unreachable];
+- _6 = _1;
+- _4 = g::(_1, _1) -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
@@ -48,20 +48,22 @@
- bb3: {
StorageLive(_7);
- StorageLive(_8);
-- _8 = _2;
+- _8 = _1;
+- StorageLive(_9);
+- _9 = _1;
+- _7 = g::(_1, _1) -> [return: bb4, unwind unreachable];
+ nop;
+ nop;
- StorageLive(_9);
-- _9 = _2;
-- _7 = g::(move _8, move _9) -> [return: bb4, unwind unreachable];
-+ _9 = _1;
-+ _7 = g::(move _1, move _9) -> [return: bb2, unwind unreachable];
++ nop;
++ nop;
++ _7 = g::(_1, _1) -> [return: bb2, unwind unreachable];
}
- bb4: {
-+ bb2: {
- StorageDead(_9);
+- StorageDead(_9);
- StorageDead(_8);
++ bb2: {
++ nop;
+ nop;
StorageDead(_7);
_0 = const ();
diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff
index 7f730a77b06ab..eae7dd17b4882 100644
--- a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff
+++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff
@@ -33,8 +33,8 @@
- StorageLive(_5);
- _5 = _1;
- StorageLive(_6);
-- _6 = _2;
-- _4 = g::(move _5, move _6) -> [return: bb2, unwind continue];
+- _6 = _1;
+- _4 = g::(_1, _1) -> [return: bb2, unwind continue];
- }
-
- bb2: {
@@ -48,20 +48,22 @@
- bb3: {
StorageLive(_7);
- StorageLive(_8);
-- _8 = _2;
+- _8 = _1;
+- StorageLive(_9);
+- _9 = _1;
+- _7 = g::(_1, _1) -> [return: bb4, unwind continue];
+ nop;
+ nop;
- StorageLive(_9);
-- _9 = _2;
-- _7 = g::(move _8, move _9) -> [return: bb4, unwind continue];
-+ _9 = _1;
-+ _7 = g::(move _1, move _9) -> [return: bb2, unwind continue];
++ nop;
++ nop;
++ _7 = g::(_1, _1) -> [return: bb2, unwind continue];
}
- bb4: {
-+ bb2: {
- StorageDead(_9);
+- StorageDead(_9);
- StorageDead(_8);
++ bb2: {
++ nop;
+ nop;
StorageDead(_7);
_0 = const ();
diff --git a/tests/mir-opt/dest-prop/unreachable.rs b/tests/mir-opt/dest-prop/unreachable.rs
index a47d2a0c8e248..0bde157ff6185 100644
--- a/tests/mir-opt/dest-prop/unreachable.rs
+++ b/tests/mir-opt/dest-prop/unreachable.rs
@@ -4,7 +4,7 @@
// Regression test for issue #105428.
//
// compile-flags: --crate-type=lib -Zmir-opt-level=0
-// compile-flags: -Zmir-enable-passes=+ConstProp,+SimplifyConstCondition-after-const-prop,+DestinationPropagation
+// compile-flags: -Zmir-enable-passes=+GVN,+SimplifyConstCondition-after-const-prop,+DestinationPropagation
// EMIT_MIR unreachable.f.DestinationPropagation.diff
pub fn f(a: T) {
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.GVN.panic-abort.diff
similarity index 96%
rename from tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff
rename to tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff
index 298a608489937..0ba1bac0a0308 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.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `float_to_exponential_common` before ConstProp
-+ // MIR for `float_to_exponential_common` after ConstProp
+- // MIR for `float_to_exponential_common` before GVN
++ // MIR for `float_to_exponential_common` after GVN
fn float_to_exponential_common(_1: &mut Formatter<'_>, _2: &T, _3: bool) -> Result<(), std::fmt::Error> {
debug fmt => _1;
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.GVN.panic-unwind.diff
similarity index 96%
rename from tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff
rename to tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff
index 037f4f7cfac25..27ea43ef12b77 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.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `float_to_exponential_common` before ConstProp
-+ // MIR for `float_to_exponential_common` after ConstProp
+- // MIR for `float_to_exponential_common` before GVN
++ // MIR for `float_to_exponential_common` after GVN
fn float_to_exponential_common(_1: &mut Formatter<'_>, _2: &T, _3: bool) -> Result<(), std::fmt::Error> {
debug fmt => _1;
diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs
index 14aad039946e1..eae158f9f7789 100644
--- a/tests/mir-opt/funky_arms.rs
+++ b/tests/mir-opt/funky_arms.rs
@@ -9,7 +9,7 @@ extern crate core;
use core::num::flt2dec;
use std::fmt::{Formatter, Result};
-// EMIT_MIR funky_arms.float_to_exponential_common.ConstProp.diff
+// EMIT_MIR funky_arms.float_to_exponential_common.GVN.diff
pub fn float_to_exponential_common(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result
where
T: flt2dec::DecodableFloat,
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
index 62d7e839f5a84..408cc5bb3419a 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
@@ -19,7 +19,7 @@ fn b(_1: &mut Box) -> &mut T {
_4 = &mut (*_1);
StorageLive(_5);
StorageLive(_6);
- _5 = deref_copy (*_4);
+ _5 = (*_4);
_6 = (((_5.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T);
_3 = &mut (*_6);
StorageDead(_6);
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
index bc0aa06a7523c..4d20f6c441993 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
@@ -17,7 +17,7 @@ fn d(_1: &Box) -> &T {
_3 = &(*_1);
StorageLive(_4);
StorageLive(_5);
- _4 = deref_copy (*_3);
+ _4 = (*_3);
_5 = (((_4.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T);
_2 = &(*_5);
StorageDead(_5);
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff b/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff
similarity index 97%
rename from tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
rename to tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff
index 3748d14838032..d2db8f61916a9 100644
--- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `inner` before ConstProp
-+ // MIR for `inner` after ConstProp
+- // MIR for `inner` before GVN
++ // MIR for `inner` after GVN
fn inner(_1: u32) -> i64 {
debug fields => _1;
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff
similarity index 97%
rename from tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
rename to tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff
index 9dab4233c5681..514183b3bc05e 100644
--- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `inner` before ConstProp
-+ // MIR for `inner` after ConstProp
+- // MIR for `inner` before GVN
++ // MIR for `inner` after GVN
fn inner(_1: u32) -> i64 {
debug fields => _1;
diff --git a/tests/mir-opt/issue_101973.rs b/tests/mir-opt/issue_101973.rs
index 3de325bc170b5..83a4dfb20b52d 100644
--- a/tests/mir-opt/issue_101973.rs
+++ b/tests/mir-opt/issue_101973.rs
@@ -1,7 +1,7 @@
// skip-filecheck
// 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".
+// This needs inlining followed by GVN to reproduce, so we cannot use "unit-test".
#[inline]
pub fn imm8(x: u32) -> u32 {
@@ -10,7 +10,7 @@ pub fn imm8(x: u32) -> u32 {
out
}
-// EMIT_MIR issue_101973.inner.ConstProp.diff
+// EMIT_MIR issue_101973.inner.GVN.diff
#[inline(never)]
pub fn inner(fields: u32) -> i64 {
imm8(fields).rotate_right(((fields >> 8) & 0xf) << 1) as i32 as i64
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..9c6c30214aa2a 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
@@ -55,7 +55,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option {
}
bb3: {
- _0 = Option::::None;
+ _0 = const Option::::None;
goto -> bb4;
}
@@ -66,3 +66,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option {
return;
}
}
+
+ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 __ __ __ __ │ ....░░░░
+}
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
index d5628dc7a6eae..5cb528c0d5f9d 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
@@ -55,8 +55,10 @@
- _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: {
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..1e1585f20aefa 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
@@ -40,8 +40,10 @@
- _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: {
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..e655af559a18a 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
@@ -55,8 +55,10 @@
- _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: {
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..a6658713a026b 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
@@ -40,8 +40,10 @@
- _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: {
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..42c7eb3c6aad0 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
@@ -72,7 +72,7 @@ fn int_range(_1: usize, _2: usize) -> () {
bb2: {
StorageDead(_7);
StorageDead(_6);
- _11 = Option::::None;
+ _11 = const Option::::None;
goto -> bb5;
}
@@ -118,3 +118,7 @@ fn int_range(_1: usize, _2: usize) -> () {
unreachable;
}
}
+
+ALLOC0 (size: 16, align: 8) {
+ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
+}
diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs
index 7f9c26f4fffdd..9412c3f234e37 100644
--- a/tests/mir-opt/pre-codegen/loops.rs
+++ b/tests/mir-opt/pre-codegen/loops.rs
@@ -1,6 +1,7 @@
// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -g
// needs-unwind
+// only-64bit
#![crate_type = "lib"]
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.GVN.32bit.panic-abort.diff
similarity index 96%
rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff
index bddd961c93309..4e34233a9798d 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.GVN.32bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
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.GVN.32bit.panic-unwind.diff
similarity index 96%
rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff
index 297ebd79fad70..275f17e52aeca 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.GVN.32bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
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.GVN.64bit.panic-abort.diff
similarity index 96%
rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff
index bddd961c93309..4e34233a9798d 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.GVN.64bit.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
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.GVN.64bit.panic-unwind.diff
similarity index 96%
rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff
index 297ebd79fad70..275f17e52aeca 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.GVN.64bit.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
index bb089ea445544..fb634ca85ef09 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
@@ -9,7 +9,7 @@ struct Point {
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR optimizes_into_variable.main.ScalarReplacementOfAggregates.diff
-// EMIT_MIR optimizes_into_variable.main.ConstProp.diff
+// EMIT_MIR optimizes_into_variable.main.GVN.diff
// EMIT_MIR optimizes_into_variable.main.SimplifyLocals-final.after.mir
// EMIT_MIR optimizes_into_variable.main.PreCodegen.after.mir
fn main() {
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..e5940bd82019e 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
@@ -75,7 +75,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
bb2: {
StorageDead(_8);
StorageDead(_7);
- _12 = Option::::None;
+ _12 = const Option::::None;
goto -> bb5;
}
@@ -131,3 +131,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
unreachable;
}
}
+
+ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 __ __ __ __ │ ....░░░░
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index 3342da545aecc..87e7485cb3604 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
@@ -75,7 +75,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
bb2: {
StorageDead(_8);
StorageDead(_7);
- _12 = Option::::None;
+ _12 = const Option::::None;
goto -> bb5;
}
@@ -139,3 +139,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
resume;
}
}
+
+ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 __ __ __ __ │ ....░░░░
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
index 6ed3d73b11d3c..f674f6a300900 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
@@ -46,7 +46,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option {
bb1: {
StorageDead(_3);
StorageDead(_2);
- _0 = Option::::None;
+ _0 = const Option::::None;
goto -> bb4;
}
@@ -71,3 +71,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option {
return;
}
}
+
+ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 __ __ __ __ │ ....░░░░
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
index a030647deae38..a5029dcad3ad6 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
@@ -46,7 +46,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option {
bb1: {
StorageDead(_3);
StorageDead(_2);
- _0 = Option::::None;
+ _0 = const Option::::None;
goto -> bb4;
}
@@ -71,3 +71,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option {
return;
}
}
+
+ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 __ __ __ __ │ ....░░░░
+}
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..718dba21a95de 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
@@ -24,7 +24,7 @@ fn ezmap(_1: Option) -> Option {
}
bb1: {
- _0 = Option::::None;
+ _0 = const Option::::None;
goto -> bb3;
}
@@ -46,3 +46,7 @@ fn ezmap(_1: Option) -> Option {
unreachable;
}
}
+
+ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 __ __ __ __ │ ....░░░░
+}
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..cc009e45e7e73 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
@@ -4,239 +4,217 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: &usize;
- let mut _5: &(usize, usize, usize, usize);
+ let _5: &usize;
let _6: &usize;
- let mut _7: &(usize, usize, usize, usize);
- let _8: &usize;
- let mut _9: &(usize, usize, usize, usize);
- let _10: &usize;
- let mut _11: &&usize;
- let _12: &usize;
- let mut _13: &&usize;
- let mut _18: bool;
- let mut _19: &&usize;
- let _20: &usize;
- let mut _21: &&usize;
- let mut _26: bool;
- let mut _27: &&usize;
- let _28: &usize;
- let mut _29: &&usize;
- let mut _34: bool;
- let mut _35: &&usize;
- let _36: &usize;
- let mut _37: &&usize;
+ let _7: &usize;
+ let mut _8: &&usize;
+ let _9: &usize;
+ let mut _10: &&usize;
+ let mut _15: bool;
+ let mut _16: &&usize;
+ let _17: &usize;
+ let mut _18: &&usize;
+ let mut _23: bool;
+ let mut _24: &&usize;
+ let _25: &usize;
+ let mut _26: &&usize;
+ let mut _31: bool;
+ let mut _32: &&usize;
+ let _33: &usize;
+ let mut _34: &&usize;
scope 1 {
debug a => _4;
- debug b => _6;
- debug c => _8;
- debug d => _10;
+ debug b => _5;
+ debug c => _6;
+ debug d => _7;
scope 2 (inlined std::cmp::impls::::le) {
- debug self => _11;
- debug other => _13;
- let mut _14: &usize;
- let mut _15: &usize;
+ debug self => _8;
+ debug other => _10;
+ let mut _11: &usize;
+ let mut _12: &usize;
scope 3 (inlined std::cmp::impls::::le) {
- debug self => _14;
- debug other => _15;
- let mut _16: usize;
- let mut _17: usize;
+ debug self => _11;
+ debug other => _12;
+ let mut _13: usize;
+ let mut _14: usize;
}
}
scope 4 (inlined std::cmp::impls::::le) {
- debug self => _19;
- debug other => _21;
- let mut _22: &usize;
- let mut _23: &usize;
+ debug self => _16;
+ debug other => _18;
+ let mut _19: &usize;
+ let mut _20: &usize;
scope 5 (inlined std::cmp::impls::::le) {
- debug self => _22;
- debug other => _23;
- let mut _24: usize;
- let mut _25: usize;
+ debug self => _19;
+ debug other => _20;
+ let mut _21: usize;
+ let mut _22: usize;
}
}
scope 6 (inlined std::cmp::impls::::le) {
- debug self => _27;
- debug other => _29;
- let mut _30: &usize;
- let mut _31: &usize;
+ debug self => _24;
+ debug other => _26;
+ let mut _27: &usize;
+ let mut _28: &usize;
scope 7 (inlined std::cmp::impls::::le) {
- debug self => _30;
- debug other => _31;
- let mut _32: usize;
- let mut _33: usize;
+ debug self => _27;
+ debug other => _28;
+ let mut _29: usize;
+ let mut _30: usize;
}
}
scope 8 (inlined std::cmp::impls::::le) {
- debug self => _35;
- debug other => _37;
- let mut _38: &usize;
- let mut _39: &usize;
+ debug self => _32;
+ debug other => _34;
+ let mut _35: &usize;
+ let mut _36: &usize;
scope 9 (inlined std::cmp::impls::::le) {
- debug self => _38;
- debug other => _39;
- let mut _40: usize;
- let mut _41: usize;
+ debug self => _35;
+ debug other => _36;
+ let mut _37: usize;
+ let mut _38: usize;
}
}
}
bb0: {
StorageLive(_4);
- _3 = deref_copy (*_2);
+ _3 = (*_2);
_4 = &((*_3).0: usize);
+ StorageLive(_5);
+ _5 = &((*_3).1: usize);
StorageLive(_6);
- _5 = deref_copy (*_2);
- _6 = &((*_5).1: usize);
+ _6 = &((*_3).2: usize);
+ StorageLive(_7);
+ _7 = &((*_3).3: usize);
+ StorageLive(_15);
StorageLive(_8);
- _7 = deref_copy (*_2);
- _8 = &((*_7).2: usize);
+ _8 = &_4;
StorageLive(_10);
- _9 = deref_copy (*_2);
- _10 = &((*_9).3: usize);
- StorageLive(_18);
- StorageLive(_11);
- _11 = &_4;
+ StorageLive(_9);
+ _9 = _6;
+ _10 = &_9;
+ _11 = _4;
+ _12 = _9;
StorageLive(_13);
- StorageLive(_12);
- _12 = _8;
- _13 = &_12;
+ _13 = (*_11);
StorageLive(_14);
- StorageLive(_15);
- _14 = deref_copy _4;
- _15 = deref_copy _12;
- StorageLive(_16);
- _16 = (*_14);
- StorageLive(_17);
- _17 = (*_15);
- _18 = Le(move _16, move _17);
- StorageDead(_17);
- StorageDead(_16);
- StorageDead(_15);
+ _14 = (*_12);
+ _15 = Le(move _13, move _14);
StorageDead(_14);
- switchInt(move _18) -> [0: bb1, otherwise: bb2];
+ StorageDead(_13);
+ switchInt(move _15) -> [0: bb1, otherwise: bb2];
}
bb1: {
- StorageDead(_12);
- StorageDead(_13);
- StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_10);
+ StorageDead(_8);
goto -> bb4;
}
bb2: {
- StorageDead(_12);
- StorageDead(_13);
- StorageDead(_11);
- StorageLive(_26);
- StorageLive(_19);
- _19 = &_10;
+ StorageDead(_9);
+ StorageDead(_10);
+ StorageDead(_8);
+ StorageLive(_23);
+ StorageLive(_16);
+ _16 = &_7;
+ StorageLive(_18);
+ StorageLive(_17);
+ _17 = _5;
+ _18 = &_17;
+ _19 = _7;
+ _20 = _17;
StorageLive(_21);
- StorageLive(_20);
- _20 = _6;
- _21 = &_20;
+ _21 = (*_19);
StorageLive(_22);
- StorageLive(_23);
- _22 = deref_copy _10;
- _23 = deref_copy _20;
- StorageLive(_24);
- _24 = (*_22);
- StorageLive(_25);
- _25 = (*_23);
- _26 = Le(move _24, move _25);
- StorageDead(_25);
- StorageDead(_24);
- StorageDead(_23);
+ _22 = (*_20);
+ _23 = Le(move _21, move _22);
StorageDead(_22);
- switchInt(move _26) -> [0: bb3, otherwise: bb8];
+ StorageDead(_21);
+ switchInt(move _23) -> [0: bb3, otherwise: bb8];
}
bb3: {
- StorageDead(_20);
- StorageDead(_21);
- StorageDead(_19);
+ StorageDead(_17);
+ StorageDead(_18);
+ StorageDead(_16);
goto -> bb4;
}
bb4: {
- StorageLive(_34);
- StorageLive(_27);
- _27 = &_8;
+ StorageLive(_31);
+ StorageLive(_24);
+ _24 = &_6;
+ StorageLive(_26);
+ StorageLive(_25);
+ _25 = _4;
+ _26 = &_25;
+ _27 = _6;
+ _28 = _25;
StorageLive(_29);
- StorageLive(_28);
- _28 = _4;
- _29 = &_28;
+ _29 = (*_27);
StorageLive(_30);
- StorageLive(_31);
- _30 = deref_copy _8;
- _31 = deref_copy _28;
- StorageLive(_32);
- _32 = (*_30);
- StorageLive(_33);
- _33 = (*_31);
- _34 = Le(move _32, move _33);
- StorageDead(_33);
- StorageDead(_32);
- StorageDead(_31);
+ _30 = (*_28);
+ _31 = Le(move _29, move _30);
StorageDead(_30);
- switchInt(move _34) -> [0: bb5, otherwise: bb6];
+ StorageDead(_29);
+ switchInt(move _31) -> [0: bb5, otherwise: bb6];
}
bb5: {
- StorageDead(_28);
- StorageDead(_29);
- StorageDead(_27);
+ StorageDead(_25);
+ StorageDead(_26);
+ StorageDead(_24);
_0 = const false;
goto -> bb7;
}
bb6: {
- StorageDead(_28);
- StorageDead(_29);
- StorageDead(_27);
- StorageLive(_35);
- _35 = &_6;
+ StorageDead(_25);
+ StorageDead(_26);
+ StorageDead(_24);
+ StorageLive(_32);
+ _32 = &_5;
+ StorageLive(_34);
+ StorageLive(_33);
+ _33 = _7;
+ _34 = &_33;
+ _35 = _5;
+ _36 = _33;
StorageLive(_37);
- StorageLive(_36);
- _36 = _10;
- _37 = &_36;
+ _37 = (*_35);
StorageLive(_38);
- StorageLive(_39);
- _38 = deref_copy _6;
- _39 = deref_copy _36;
- StorageLive(_40);
- _40 = (*_38);
- StorageLive(_41);
- _41 = (*_39);
- _0 = Le(move _40, move _41);
- StorageDead(_41);
- StorageDead(_40);
- StorageDead(_39);
+ _38 = (*_36);
+ _0 = Le(move _37, move _38);
StorageDead(_38);
- StorageDead(_36);
StorageDead(_37);
- StorageDead(_35);
+ StorageDead(_33);
+ StorageDead(_34);
+ StorageDead(_32);
goto -> bb7;
}
bb7: {
- StorageDead(_34);
+ StorageDead(_31);
goto -> bb9;
}
bb8: {
- StorageDead(_20);
- StorageDead(_21);
- StorageDead(_19);
+ StorageDead(_17);
+ StorageDead(_18);
+ StorageDead(_16);
_0 = const true;
goto -> bb9;
}
bb9: {
- StorageDead(_26);
- StorageDead(_18);
- StorageDead(_10);
- StorageDead(_8);
+ StorageDead(_23);
+ StorageDead(_15);
+ StorageDead(_7);
StorageDead(_6);
+ StorageDead(_5);
StorageDead(_4);
return;
}
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..5477796512c57 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
@@ -4,46 +4,40 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41},
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: usize;
- let mut _5: &(usize, usize, usize, usize);
+ let _5: usize;
let _6: usize;
- let mut _7: &(usize, usize, usize, usize);
- let _8: usize;
- let mut _9: &(usize, usize, usize, usize);
- let _10: usize;
- let mut _11: bool;
- let mut _12: bool;
- let mut _13: bool;
+ let _7: usize;
+ let mut _8: bool;
+ let mut _9: bool;
+ let mut _10: bool;
scope 1 {
debug a => _4;
- debug b => _6;
- debug c => _8;
- debug d => _10;
+ debug b => _5;
+ debug c => _6;
+ debug d => _7;
}
bb0: {
- _3 = deref_copy (*_2);
+ _3 = (*_2);
_4 = ((*_3).0: usize);
- _5 = deref_copy (*_2);
- _6 = ((*_5).1: usize);
- _7 = deref_copy (*_2);
- _8 = ((*_7).2: usize);
- _9 = deref_copy (*_2);
- _10 = ((*_9).3: usize);
- StorageLive(_11);
- _11 = Le(_4, _8);
- switchInt(move _11) -> [0: bb2, otherwise: bb1];
+ _5 = ((*_3).1: usize);
+ _6 = ((*_3).2: usize);
+ _7 = ((*_3).3: usize);
+ StorageLive(_8);
+ _8 = Le(_4, _6);
+ switchInt(move _8) -> [0: bb2, otherwise: bb1];
}
bb1: {
- StorageLive(_12);
- _12 = Le(_10, _6);
- switchInt(move _12) -> [0: bb2, otherwise: bb6];
+ StorageLive(_9);
+ _9 = Le(_7, _5);
+ switchInt(move _9) -> [0: bb2, otherwise: bb6];
}
bb2: {
- StorageLive(_13);
- _13 = Le(_8, _4);
- switchInt(move _13) -> [0: bb3, otherwise: bb4];
+ StorageLive(_10);
+ _10 = Le(_6, _4);
+ switchInt(move _10) -> [0: bb3, otherwise: bb4];
}
bb3: {
@@ -52,12 +46,12 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41},
}
bb4: {
- _0 = Le(_6, _10);
+ _0 = Le(_5, _7);
goto -> bb5;
}
bb5: {
- StorageDead(_13);
+ StorageDead(_10);
goto -> bb7;
}
@@ -67,8 +61,8 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41},
}
bb7: {
- StorageDead(_12);
- StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_8);
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..a12411a041378 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
@@ -50,7 +50,6 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
}
bb0: {
- StorageLive(_7);
StorageLive(_4);
StorageLive(_3);
_3 = Len((*_1));
@@ -86,7 +85,6 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
bb3: {
StorageDead(_4);
- StorageDead(_7);
return;
}
}
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..a12411a041378 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
@@ -50,7 +50,6 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
}
bb0: {
- StorageLive(_7);
StorageLive(_4);
StorageLive(_3);
_3 = Len((*_1));
@@ -86,7 +85,6 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
bb3: {
StorageDead(_4);
- StorageDead(_7);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
index db6922968ae9c..6a99f15774ff4 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
@@ -84,7 +84,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
bb2: {
StorageDead(_8);
StorageDead(_7);
- _12 = Option::::None;
+ _12 = const Option::::None;
goto -> bb5;
}
@@ -147,3 +147,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
unreachable;
}
}
+
+ALLOC0 (size: 16, align: 8) {
+ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
index 81d1832eebba2..4f028fa0a6468 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
@@ -84,7 +84,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
bb2: {
StorageDead(_8);
StorageDead(_7);
- _12 = Option::::None;
+ _12 = const Option::::None;
goto -> bb5;
}
@@ -155,3 +155,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
resume;
}
}
+
+ALLOC0 (size: 16, align: 8) {
+ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
+}
diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff b/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff
similarity index 86%
rename from tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff
rename to tests/mir-opt/simplify_match.main.GVN.panic-abort.diff
index 6025abb73825c..825babe7994ac 100644
--- a/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff b/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff
similarity index 86%
rename from tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff
rename to tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff
index c881dec28c77d..24ab6c39788fa 100644
--- a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff
@@ -1,5 +1,5 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/simplify_match.rs b/tests/mir-opt/simplify_match.rs
index eb385005cd996..2eac93edbb8e3 100644
--- a/tests/mir-opt/simplify_match.rs
+++ b/tests/mir-opt/simplify_match.rs
@@ -3,7 +3,7 @@
#[inline(never)]
fn noop() {}
-// EMIT_MIR simplify_match.main.ConstProp.diff
+// EMIT_MIR simplify_match.main.GVN.diff
fn main() {
match { let x = false; x } {
true => noop(),
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`.