diff --git a/compiler/rustc_middle/src/mir/consts.rs b/compiler/rustc_middle/src/mir/consts.rs index 5764a9c84eeaf..ca80c9995b95e 100644 --- a/compiler/rustc_middle/src/mir/consts.rs +++ b/compiler/rustc_middle/src/mir/consts.rs @@ -495,6 +495,11 @@ impl<'tcx> Const<'tcx> { /// Return true if any evaluation of this constant always returns the same value, /// taking into account even pointer identity tests. pub fn is_deterministic(&self) -> bool { + if self.ty().is_primitive() { + // Primitive types hold no provenance, so their result is deterministic. + return true; + } + // Some constants may generate fresh allocations for pointers they contain, // so using the same constant twice can yield two different results. // Notably, valtrees purposefully generate new allocations. diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 03a40f83732ac..aeee897069c05 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -145,6 +145,10 @@ impl<'tcx> crate::MirPass<'tcx> for GVN { state.visit_basic_block_data(bb, data); } + for var_debug_info in body.var_debug_info.iter_mut() { + state.visit_var_debug_info(var_debug_info); + } + // For each local that is reused (`y` above), we remove its storage statements do avoid any // difficulty. Those locals are SSA, so should be easy to optimize by LLVM without storage // statements. @@ -865,10 +869,11 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { /// Simplify the projection chain if we know better. #[instrument(level = "trace", skip(self))] - fn simplify_place_projection(&mut self, place: &mut Place<'tcx>, location: Location) { + fn simplify_place_projection(&mut self, place: &mut Place<'tcx>, location: Option) { // If the projection is indirect, we treat the local as a value, so can replace it with // another local. - if place.is_indirect_first_projection() + if let Some(location) = location + && place.is_indirect_first_projection() && let Some(base) = self.locals[place.local] && let Some(new_local) = self.try_as_local(base, location) && place.local != new_local @@ -890,7 +895,8 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { { projection.to_mut()[i] = ProjectionElem::ConstantIndex { offset, min_length, from_end: false }; - } else if let Some(new_idx_local) = self.try_as_local(idx, location) + } else if let Some(location) = location + && let Some(new_idx_local) = self.try_as_local(idx, location) && idx_local != new_idx_local { projection.to_mut()[i] = ProjectionElem::Index(new_idx_local); @@ -912,7 +918,7 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { fn compute_place_value( &mut self, place: Place<'tcx>, - location: Location, + location: Option, ) -> Result> { // Invariant: `place` and `place_ref` point to the same value, even if they point to // different memory locations. @@ -923,7 +929,9 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { // Invariant: `value` has type `place_ty`, with optional downcast variant if needed. let mut place_ty = PlaceTy::from_ty(self.local_decls[place.local].ty); for (index, proj) in place.projection.iter().enumerate() { - if let Some(local) = self.try_as_local(value, location) { + if let Some(location) = location + && let Some(local) = self.try_as_local(value, location) + { // Both `local` and `Place { local: place.local, projection: projection[..index] }` // hold the same value. Therefore, following place holds the value in the original // `place`. @@ -948,13 +956,14 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { fn simplify_place_value( &mut self, place: &mut Place<'tcx>, - location: Location, + location: Option, ) -> Option { self.simplify_place_projection(place, location); match self.compute_place_value(*place, location) { Ok(value) => { - if let Some(new_place) = self.try_as_place(value, location, true) + if let Some(location) = location + && let Some(new_place) = self.try_as_place(value, location, true) && (new_place.local != place.local || new_place.projection.len() < place.projection.len()) { @@ -982,16 +991,16 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { operand: &mut Operand<'tcx>, location: Location, ) -> Option { - match *operand { - Operand::Constant(ref constant) => Some(self.insert_constant(constant.const_)), + let value = match *operand { + Operand::Constant(ref constant) => self.insert_constant(constant.const_), Operand::Copy(ref mut place) | Operand::Move(ref mut place) => { - let value = self.simplify_place_value(place, location)?; - if let Some(const_) = self.try_as_constant(value) { - *operand = Operand::Constant(Box::new(const_)); - } - Some(value) + self.simplify_place_value(place, Some(location))? } + }; + if let Some(const_) = self.try_as_constant(value) { + *operand = Operand::Constant(Box::new(const_)); } + Some(value) } #[instrument(level = "trace", skip(self), ret)] @@ -1019,11 +1028,11 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { Rvalue::NullaryOp(op, ty) => Value::NullaryOp(op, ty), Rvalue::Aggregate(..) => return self.simplify_aggregate(lhs, rvalue, location), Rvalue::Ref(_, borrow_kind, ref mut place) => { - self.simplify_place_projection(place, location); + self.simplify_place_projection(place, Some(location)); return self.new_pointer(*place, AddressKind::Ref(borrow_kind)); } Rvalue::RawPtr(mutbl, ref mut place) => { - self.simplify_place_projection(place, location); + self.simplify_place_projection(place, Some(location)); return self.new_pointer(*place, AddressKind::Address(mutbl)); } Rvalue::WrapUnsafeBinder(ref mut op, _) => { @@ -1042,7 +1051,7 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { return self.simplify_unary(op, arg_op, location); } Rvalue::Discriminant(ref mut place) => { - let place = self.simplify_place_value(place, location)?; + let place = self.simplify_place_value(place, Some(location))?; if let Some(discr) = self.simplify_discriminant(place) { return Some(discr); } @@ -1762,14 +1771,30 @@ impl<'tcx> VnState<'_, '_, 'tcx> { /// If `index` is a `Value::Constant`, return the `Constant` to be put in the MIR. fn try_as_constant(&mut self, index: VnIndex) -> Option> { - // This was already constant in MIR, do not change it. If the constant is not - // deterministic, adding an additional mention of it in MIR will not give the same value as - // the former mention. - if let Value::Constant { value, disambiguator: None } = self.get(index) { + let value = self.get(index); + + // This was already an *evaluated* constant in MIR, do not change it. + if let Value::Constant { value, disambiguator: None } = value + && let Const::Val(..) = value + { + debug_assert!(value.is_deterministic()); + return Some(ConstOperand { span: DUMMY_SP, user_ty: None, const_: value }); + } + + if let Some(value) = self.try_as_evaluated_constant(index) { + return Some(ConstOperand { span: DUMMY_SP, user_ty: None, const_: value }); + } + + // We failed to provide an evaluated form, fallback to using the unevaluated constant. + if let Value::Constant { value, disambiguator: None } = value { debug_assert!(value.is_deterministic()); return Some(ConstOperand { span: DUMMY_SP, user_ty: None, const_: value }); } + None + } + + fn try_as_evaluated_constant(&mut self, index: VnIndex) -> Option> { let op = self.evaluated[index].as_ref()?; if op.layout.is_unsized() { // Do not attempt to propagate unsized locals. @@ -1783,8 +1808,7 @@ impl<'tcx> VnState<'_, '_, 'tcx> { // FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed. assert!(!value.may_have_provenance(self.tcx, op.layout.size)); - let const_ = Const::Val(value, op.layout.ty); - Some(ConstOperand { span: DUMMY_SP, user_ty: None, const_ }) + Some(Const::Val(value, op.layout.ty)) } /// Construct a place which holds the same value as `index` and for which all locals strictly @@ -1837,8 +1861,21 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, '_, 'tcx> { self.tcx } + fn visit_var_debug_info(&mut self, var_debug_info: &mut VarDebugInfo<'tcx>) { + match &mut var_debug_info.value { + VarDebugInfoContents::Const(_) => {} + VarDebugInfoContents::Place(place) => { + if let Some(value) = self.simplify_place_value(place, None) + && let Some(constant) = self.try_as_constant(value) + { + var_debug_info.value = VarDebugInfoContents::Const(constant); + } + } + } + } + fn visit_place(&mut self, place: &mut Place<'tcx>, context: PlaceContext, location: Location) { - self.simplify_place_projection(place, location); + self.simplify_place_projection(place, Some(location)); if context.is_mutating_use() && place.is_indirect() { // Non-local mutation maybe invalidate deref. self.invalidate_derefs(); @@ -1857,7 +1894,7 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, '_, 'tcx> { rvalue: &mut Rvalue<'tcx>, location: Location, ) { - self.simplify_place_projection(lhs, location); + self.simplify_place_projection(lhs, Some(location)); let value = self.simplify_rvalue(lhs, rvalue, location); if let Some(value) = value { diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 9ff7e0b550030..13e0f2916c215 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -191,7 +191,6 @@ declare_passes! { Final }; mod simplify_comparison_integral : SimplifyComparisonIntegral; - mod single_use_consts : SingleUseConsts; mod sroa : ScalarReplacementOfAggregates; mod strip_debuginfo : StripDebugInfo; mod unreachable_enum_branching : UnreachableEnumBranching; @@ -709,7 +708,6 @@ pub(crate) fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<' &simplify::SimplifyLocals::AfterGVN, &match_branches::MatchBranchSimplification, &dataflow_const_prop::DataflowConstProp, - &single_use_consts::SingleUseConsts, &o1(simplify_branches::SimplifyConstCondition::AfterConstProp), &jump_threading::JumpThreading, &early_otherwise_branch::EarlyOtherwiseBranch, diff --git a/compiler/rustc_mir_transform/src/single_use_consts.rs b/compiler/rustc_mir_transform/src/single_use_consts.rs deleted file mode 100644 index 02caa92ad3fc8..0000000000000 --- a/compiler/rustc_mir_transform/src/single_use_consts.rs +++ /dev/null @@ -1,205 +0,0 @@ -use rustc_index::IndexVec; -use rustc_index::bit_set::DenseBitSet; -use rustc_middle::bug; -use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor}; -use rustc_middle::mir::*; -use rustc_middle::ty::TyCtxt; - -/// Various parts of MIR building introduce temporaries that are commonly not needed. -/// -/// Notably, `if CONST` and `match CONST` end up being used-once temporaries, which -/// obfuscates the structure for other passes and codegen, which would like to always -/// be able to just see the constant directly. -/// -/// At higher optimization levels fancier passes like GVN will take care of this -/// in a more general fashion, but this handles the easy cases so can run in debug. -/// -/// This only removes constants with a single-use because re-evaluating constants -/// isn't always an improvement, especially for large ones. -/// -/// It also removes *never*-used constants, since it had all the information -/// needed to do that too, including updating the debug info. -pub(super) struct SingleUseConsts; - -impl<'tcx> crate::MirPass<'tcx> for SingleUseConsts { - fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - sess.mir_opt_level() > 0 - } - - fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let mut finder = SingleUseConstsFinder { - ineligible_locals: DenseBitSet::new_empty(body.local_decls.len()), - locations: IndexVec::from_elem(LocationPair::new(), &body.local_decls), - locals_in_debug_info: DenseBitSet::new_empty(body.local_decls.len()), - }; - - finder.ineligible_locals.insert_range(..=Local::from_usize(body.arg_count)); - - finder.visit_body(body); - - for (local, locations) in finder.locations.iter_enumerated() { - if finder.ineligible_locals.contains(local) { - continue; - } - - let Some(init_loc) = locations.init_loc else { - continue; - }; - - // We're only changing an operand, not the terminator kinds or successors - let basic_blocks = body.basic_blocks.as_mut_preserves_cfg(); - let init_statement_kind = std::mem::replace( - &mut basic_blocks[init_loc.block].statements[init_loc.statement_index].kind, - StatementKind::Nop, - ); - let StatementKind::Assign(place_and_rvalue) = init_statement_kind else { - bug!("No longer an assign?"); - }; - let (place, rvalue) = *place_and_rvalue; - assert_eq!(place.as_local(), Some(local)); - let Rvalue::Use(operand) = rvalue else { bug!("No longer a use?") }; - - let mut replacer = LocalReplacer { tcx, local, operand: Some(operand) }; - - if finder.locals_in_debug_info.contains(local) { - for var_debug_info in &mut body.var_debug_info { - replacer.visit_var_debug_info(var_debug_info); - } - } - - let Some(use_loc) = locations.use_loc else { continue }; - - let use_block = &mut basic_blocks[use_loc.block]; - if let Some(use_statement) = use_block.statements.get_mut(use_loc.statement_index) { - replacer.visit_statement(use_statement, use_loc); - } else { - replacer.visit_terminator(use_block.terminator_mut(), use_loc); - } - - if replacer.operand.is_some() { - bug!( - "operand wasn't used replacing local {local:?} with locations {locations:?} in body {body:#?}" - ); - } - } - } - - fn is_required(&self) -> bool { - true - } -} - -#[derive(Copy, Clone, Debug)] -struct LocationPair { - init_loc: Option, - use_loc: Option, -} - -impl LocationPair { - fn new() -> Self { - Self { init_loc: None, use_loc: None } - } -} - -struct SingleUseConstsFinder { - ineligible_locals: DenseBitSet, - locations: IndexVec, - locals_in_debug_info: DenseBitSet, -} - -impl<'tcx> Visitor<'tcx> for SingleUseConstsFinder { - fn visit_assign(&mut self, place: &Place<'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { - if let Some(local) = place.as_local() - && let Rvalue::Use(operand) = rvalue - && let Operand::Constant(_) = operand - { - let locations = &mut self.locations[local]; - if locations.init_loc.is_some() { - self.ineligible_locals.insert(local); - } else { - locations.init_loc = Some(location); - } - } else { - self.super_assign(place, rvalue, location); - } - } - - fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) { - if let Some(place) = operand.place() - && let Some(local) = place.as_local() - { - let locations = &mut self.locations[local]; - if locations.use_loc.is_some() { - self.ineligible_locals.insert(local); - } else { - locations.use_loc = Some(location); - } - } else { - self.super_operand(operand, location); - } - } - - fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) { - match &statement.kind { - // Storage markers are irrelevant to this. - StatementKind::StorageLive(_) | StatementKind::StorageDead(_) => {} - _ => self.super_statement(statement, location), - } - } - - fn visit_var_debug_info(&mut self, var_debug_info: &VarDebugInfo<'tcx>) { - if let VarDebugInfoContents::Place(place) = &var_debug_info.value - && let Some(local) = place.as_local() - { - self.locals_in_debug_info.insert(local); - } else { - self.super_var_debug_info(var_debug_info); - } - } - - fn visit_local(&mut self, local: Local, _context: PlaceContext, _location: Location) { - // If there's any path that gets here, rather than being understood elsewhere, - // then we'd better not do anything with this local. - self.ineligible_locals.insert(local); - } -} - -struct LocalReplacer<'tcx> { - tcx: TyCtxt<'tcx>, - local: Local, - operand: Option>, -} - -impl<'tcx> MutVisitor<'tcx> for LocalReplacer<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx> { - self.tcx - } - - fn visit_operand(&mut self, operand: &mut Operand<'tcx>, _location: Location) { - if let Operand::Copy(place) | Operand::Move(place) = operand - && let Some(local) = place.as_local() - && local == self.local - { - *operand = self.operand.take().unwrap_or_else(|| { - bug!("there was a second use of the operand"); - }); - } - } - - fn visit_var_debug_info(&mut self, var_debug_info: &mut VarDebugInfo<'tcx>) { - if let VarDebugInfoContents::Place(place) = &var_debug_info.value - && let Some(local) = place.as_local() - && local == self.local - { - let const_op = *self - .operand - .as_ref() - .unwrap_or_else(|| { - bug!("the operand was already stolen"); - }) - .constant() - .unwrap(); - var_debug_info.value = VarDebugInfoContents::Const(const_op); - } - } -} diff --git a/tests/codegen-llvm/amdgpu-addrspacecast.rs b/tests/codegen-llvm/amdgpu-addrspacecast.rs index 829133de00d8b..2b895cf256d6d 100644 --- a/tests/codegen-llvm/amdgpu-addrspacecast.rs +++ b/tests/codegen-llvm/amdgpu-addrspacecast.rs @@ -10,7 +10,7 @@ extern crate minicore; // CHECK-LABEL: @ref_of_local // CHECK: [[alloca:%[0-9]]] = alloca -// CHECK: %i = addrspacecast ptr addrspace(5) [[alloca]] to ptr +// CHECK: {{%.*}} = addrspacecast ptr addrspace(5) [[alloca]] to ptr #[no_mangle] pub fn ref_of_local(f: fn(&i32)) { let i = 0; diff --git a/tests/incremental/hashes/enum_constructors.rs b/tests/incremental/hashes/enum_constructors.rs index d839dabf293af..4bcf546107c87 100644 --- a/tests/incremental/hashes/enum_constructors.rs +++ b/tests/incremental/hashes/enum_constructors.rs @@ -64,7 +64,7 @@ pub fn change_field_order_struct_like() -> Enum { #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,typeck,optimized_mir")] +#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail6")] // FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it // would if it were not all constants diff --git a/tests/incremental/hashes/struct_constructors.rs b/tests/incremental/hashes/struct_constructors.rs index 31c549c6e7a90..648bd82e02d14 100644 --- a/tests/incremental/hashes/struct_constructors.rs +++ b/tests/incremental/hashes/struct_constructors.rs @@ -61,7 +61,7 @@ pub fn change_field_order_regular_struct() -> RegularStruct { #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,typeck,optimized_mir")] +#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail6")] pub fn change_field_order_regular_struct() -> RegularStruct { RegularStruct { diff --git a/tests/mir-opt/building/match/sort_candidates.rs b/tests/mir-opt/building/match/sort_candidates.rs index d7dd82791ffa1..da8bf48084c12 100644 --- a/tests/mir-opt/building/match/sort_candidates.rs +++ b/tests/mir-opt/building/match/sort_candidates.rs @@ -1,4 +1,5 @@ -// Check specific cases of sorting candidates in match lowering. +//! Check specific cases of sorting candidates in match lowering. +//@ compile-flags: -Zmir-opt-level=0 // EMIT_MIR sort_candidates.constant_eq.SimplifyCfg-initial.after.mir fn constant_eq(s: &str, b: bool) -> u32 { @@ -6,7 +7,7 @@ fn constant_eq(s: &str, b: bool) -> u32 { // CHECK-LABEL: fn constant_eq( // CHECK-NOT: const "a" - // CHECK: {{_[0-9]+}} = const "a" as &[u8] (Transmute); + // CHECK: eq({{.*}}, const "a") // CHECK-NOT: const "a" match (s, b) { ("a", _) if true => 1, @@ -23,11 +24,16 @@ fn disjoint_ranges(x: i32, b: bool) -> u32 { // other candidates. // CHECK-LABEL: fn disjoint_ranges( - // CHECK: debug b => _2; - // CHECK: bb0: { - // CHECK: switchInt(copy _2) -> [0: [[jump:bb.*]], otherwise: {{bb.*}}]; + // CHECK: debug b => [[b:_.*]]; + // CHECK: [[tmp:_.*]] = copy [[b]]; + // CHECK-NEXT: switchInt(move [[tmp]]) -> [0: [[jump:bb.*]], otherwise: {{bb.*}}]; // CHECK: [[jump]]: { + // CHECK-NEXT: StorageDead([[tmp]]); + // CHECK-NEXT: goto -> [[jump3:bb.*]]; + // CHECK: [[jump3]]: { // CHECK-NEXT: _0 = const 3_u32; + // CHECK-NEXT: goto -> [[jumpret:bb.*]]; + // CHECK: [[jumpret]]: { // CHECK-NEXT: return; match x { 0..10 if b => 0, diff --git a/tests/mir-opt/const_debuginfo.main.SingleUseConsts.diff b/tests/mir-opt/const_debuginfo.main.GVN.diff similarity index 68% rename from tests/mir-opt/const_debuginfo.main.SingleUseConsts.diff rename to tests/mir-opt/const_debuginfo.main.GVN.diff index 9baf8439e59f5..9f37626a7fbf0 100644 --- a/tests/mir-opt/const_debuginfo.main.SingleUseConsts.diff +++ b/tests/mir-opt/const_debuginfo.main.GVN.diff @@ -1,5 +1,5 @@ -- // MIR for `main` before SingleUseConsts -+ // MIR for `main` after SingleUseConsts +- // MIR for `main` before GVN ++ // MIR for `main` after GVN fn main() -> () { let mut _0: (); @@ -55,56 +55,57 @@ } bb0: { - nop; -- _1 = const 1_u8; - nop; -- _2 = const 2_u8; - nop; -- _3 = const 3_u8; +- 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); StorageLive(_6); -- _6 = const 1_u8; -+ nop; +- _6 = copy _1; ++ _6 = const 1_u8; StorageLive(_7); -- _7 = const 2_u8; -- _5 = const 3_u8; -+ nop; -+ nop; +- _7 = copy _2; +- _5 = Add(move _6, move _7); ++ _7 = const 2_u8; ++ _5 = const 3_u8; StorageDead(_7); StorageDead(_6); StorageLive(_8); -- _8 = const 3_u8; -- _4 = const 6_u8; -+ nop; -+ nop; +- _8 = copy _3; +- _4 = Add(move _5, move _8); ++ _8 = const 3_u8; ++ _4 = const 6_u8; StorageDead(_8); StorageDead(_5); StorageLive(_9); -- _9 = const "hello, world!"; -+ nop; + _9 = const "hello, world!"; StorageLive(_10); _10 = (const true, const false, const 123_u32); StorageLive(_11); -- _11 = const Option::::Some(99_u16); -+ nop; +- _11 = Option::::Some(const 99_u16); ++ _11 = const Option::::Some(99_u16); StorageLive(_12); -- _12 = const Point {{ x: 32_u32, y: 32_u32 }}; -+ nop; +- _12 = Point { x: const 32_u32, y: const 32_u32 }; ++ _12 = const Point {{ x: 32_u32, y: 32_u32 }}; StorageLive(_13); - nop; -- _14 = const 32_u32; +- StorageLive(_14); +- _14 = copy (_12.0: u32); + nop; ++ _14 = const 32_u32; StorageLive(_15); -- _15 = const 32_u32; -- _13 = const 64_u32; -+ nop; -+ nop; +- _15 = copy (_12.1: u32); +- _13 = Add(move _14, move _15); ++ _15 = const 32_u32; ++ _13 = const 64_u32; StorageDead(_15); - nop; +- StorageDead(_14); ++ nop; _0 = const (); StorageDead(_13); StorageDead(_12); @@ -112,16 +113,20 @@ StorageDead(_10); StorageDead(_9); StorageDead(_4); - nop; - nop; - nop; +- StorageDead(_3); +- StorageDead(_2); +- StorageDead(_1); ++ nop; ++ nop; ++ nop; return; } } - ALLOC0 (size: 8, align: 4) { .. } - - ALLOC1 (size: 4, align: 2) { .. } - - ALLOC2 (size: 13, align: 1) { .. } +- ALLOC0 (size: 13, align: 1) { .. } ++ ALLOC0 (size: 8, align: 4) { .. } ++ ++ ALLOC1 (size: 4, align: 2) { .. } ++ ++ ALLOC2 (size: 13, align: 1) { .. } diff --git a/tests/mir-opt/const_debuginfo.rs b/tests/mir-opt/const_debuginfo.rs index 3b2bc4559ced9..c286786682410 100644 --- a/tests/mir-opt/const_debuginfo.rs +++ b/tests/mir-opt/const_debuginfo.rs @@ -1,4 +1,4 @@ -//@ test-mir-pass: SingleUseConsts +//@ test-mir-pass: GVN //@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN -Zdump-mir-exclude-alloc-bytes #![allow(unused)] @@ -8,7 +8,7 @@ struct Point { y: u32, } -// EMIT_MIR const_debuginfo.main.SingleUseConsts.diff +// EMIT_MIR const_debuginfo.main.GVN.diff fn main() { // CHECK-LABEL: fn main( // CHECK: debug x => const 1_u8; diff --git a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff index c6d3bad0790c4..1cfb63d9ee774 100644 --- a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff @@ -12,10 +12,12 @@ let mut _8: (u8, i32); let mut _9: u8; scope 1 { - debug first => _2; +- debug first => _2; ++ debug first => const 1_i32; let _6: i32; scope 2 { - debug second => _6; +- debug second => _6; ++ debug second => const 3_i32; } } diff --git a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff index c6d3bad0790c4..1cfb63d9ee774 100644 --- a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff @@ -12,10 +12,12 @@ let mut _8: (u8, i32); let mut _9: u8; scope 1 { - debug first => _2; +- debug first => _2; ++ debug first => const 1_i32; let _6: i32; scope 2 { - debug second => _6; +- debug second => _6; ++ debug second => const 3_i32; } } diff --git a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff index 0a59c59c2ed2c..769c07ab468cb 100644 --- a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff @@ -9,7 +9,8 @@ let _4: (); let mut _5: u8; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff index 100369a2eee31..5d4a6a2296387 100644 --- a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff @@ -9,7 +9,8 @@ let _4: (); let mut _5: u8; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs index 8f8f92bbba19b..cf020371af820 100644 --- a/tests/mir-opt/const_prop/aggregate.rs +++ b/tests/mir-opt/const_prop/aggregate.rs @@ -5,9 +5,7 @@ // EMIT_MIR aggregate.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK-NOT: = Add( - // CHECK: [[x]] = const 1_u8; + // CHECK: debug x => const 1_u8; // CHECK-NOT: = Add( // CHECK: foo(const 1_u8) let x = (0, 1, 2).1 + 0; @@ -18,12 +16,9 @@ fn main() { // EMIT_MIR aggregate.foo.GVN.diff fn foo(x: u8) { // CHECK-LABEL: fn foo( - // CHECK: debug first => [[first:_.*]]; - // CHECK: debug second => [[second:_.*]]; - // CHECK-NOT: = Add( - // CHECK: [[first]] = const 1_i32; + // CHECK: debug first => const 1_i32; + // CHECK: debug second => const 3_i32; // CHECK-NOT: = Add( - // CHECK: [[second]] = const 3_i32; let first = (0, x).0 + 1; let second = (x, 1).1 + 2; } diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff index 3a5a8d0099128..2888c9265d193 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff @@ -8,7 +8,8 @@ let _3: usize; let mut _4: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff index 62d6e6007e5c9..91626ffd34cb0 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff @@ -8,7 +8,8 @@ let _3: usize; let mut _4: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff index 3a5a8d0099128..2888c9265d193 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff @@ -8,7 +8,8 @@ let _3: usize; let mut _4: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff index 62d6e6007e5c9..91626ffd34cb0 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff @@ -8,7 +8,8 @@ let _3: usize; let mut _4: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs index aff72268223b2..ee8056e51e974 100644 --- a/tests/mir-opt/const_prop/array_index.rs +++ b/tests/mir-opt/const_prop/array_index.rs @@ -5,7 +5,6 @@ // EMIT_MIR array_index.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: [[x]] = const 2_u32; + // CHECK: debug x => const 2_u32; let x: u32 = [0, 1, 2, 3][2]; } diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff index 8c535b567c328..8a8b9fbf6145e 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff @@ -10,7 +10,8 @@ let mut _6: bool; let mut _7: bool; scope 1 { - debug y => _1; +- debug y => _1; ++ debug y => const 0_i32; let _2: i32; scope 2 { debug _z => _2; diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff index 045f4d81db62e..e3deaa278e3b3 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff @@ -10,7 +10,8 @@ let mut _6: bool; let mut _7: bool; scope 1 { - debug y => _1; +- debug y => _1; ++ debug y => const 0_i32; let _2: i32; scope 2 { debug _z => _2; diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs index 6c576718ac878..951ed51fcd53b 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs @@ -5,7 +5,7 @@ #[allow(unconditional_panic)] fn main() { // CHECK-LABEL: fn main( - // CHECK: debug y => [[y:_.*]]; + // CHECK: debug y => const 0_i32; // CHECK: debug _z => [[z:_.*]]; // CHECK: assert(!const true, "attempt to divide `{}` by zero", const 1_i32) // CHECK: assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff index e5a8726b855c4..ebbd3d58365ad 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff @@ -10,7 +10,8 @@ let mut _6: bool; let mut _7: bool; scope 1 { - debug y => _1; +- debug y => _1; ++ debug y => const 0_i32; let _2: i32; scope 2 { debug _z => _2; diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff index 1110ff186dc6e..188cd422de352 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff @@ -10,7 +10,8 @@ let mut _6: bool; let mut _7: bool; scope 1 { - debug y => _1; +- debug y => _1; ++ debug y => const 0_i32; let _2: i32; scope 2 { debug _z => _2; diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs index b7623dc23da1b..fc47aaea5fe60 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs @@ -5,7 +5,7 @@ #[allow(unconditional_panic)] fn main() { // CHECK-LABEL: fn main( - // CHECK: debug y => [[y:_.*]]; + // CHECK: debug y => const 0_i32; // CHECK: debug _z => [[z:_.*]]; // CHECK: assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of // zero", const 1_i32) diff --git a/tests/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs index f23749312f232..5915986b9f74d 100644 --- a/tests/mir-opt/const_prop/boolean_identities.rs +++ b/tests/mir-opt/const_prop/boolean_identities.rs @@ -3,10 +3,8 @@ // EMIT_MIR boolean_identities.test.GVN.diff pub fn test(x: bool, y: bool) -> bool { // CHECK-LABEL: fn test( - // CHECK: debug a => [[a:_.*]]; - // CHECK: debug b => [[b:_.*]]; - // CHECK: [[a]] = const true; - // CHECK: [[b]] = const false; + // CHECK: debug a => const true; + // CHECK: debug b => const false; // CHECK: _0 = const false; let a = (y | true); let b = (x & false); diff --git a/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff b/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff index 3fe70302b21cf..f65ecdcbc599e 100644 --- a/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff +++ b/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff @@ -11,10 +11,12 @@ let mut _7: bool; let mut _8: bool; scope 1 { - debug a => _3; +- debug a => _3; ++ debug a => const true; let _5: bool; scope 2 { - debug b => _5; +- debug b => _5; ++ debug b => const false; } } diff --git a/tests/mir-opt/const_prop/cast.main.GVN.diff b/tests/mir-opt/const_prop/cast.main.GVN.diff index bc442c4e4468b..c4a84e1733bc5 100644 --- a/tests/mir-opt/const_prop/cast.main.GVN.diff +++ b/tests/mir-opt/const_prop/cast.main.GVN.diff @@ -5,10 +5,12 @@ let mut _0: (); let _1: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; let _2: u8; scope 2 { - debug y => _2; +- debug y => _2; ++ debug y => const 42_u8; } } diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs index dce2e38fa9173..39027ce8ef065 100644 --- a/tests/mir-opt/const_prop/cast.rs +++ b/tests/mir-opt/const_prop/cast.rs @@ -3,10 +3,8 @@ fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: debug y => [[y:_.*]]; - // CHECK: [[x]] = const 42_u32; - // CHECK: [[y]] = const 42_u8; + // CHECK: debug x => const 42_u32; + // CHECK: debug y => const 42_u8; let x = 42u8 as u32; let y = 42u32 as u8; } diff --git a/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff index 798f957caa58c..8714ef45ea240 100644 --- a/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff @@ -6,7 +6,8 @@ let _1: u32; let mut _2: (u32, bool); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff index a09f8ee5be12a..5cefd83e06c04 100644 --- a/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff @@ -6,7 +6,8 @@ let _1: u32; let mut _2: (u32, bool); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs index d450f7d03f38c..7e747b1686fe5 100644 --- a/tests/mir-opt/const_prop/checked_add.rs +++ b/tests/mir-opt/const_prop/checked_add.rs @@ -5,8 +5,7 @@ // EMIT_MIR checked_add.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; + // CHECK: debug x => const 2_u32; // CHECK: assert(!const false, - // CHECK: [[x]] = const 2_u32; let x: u32 = 1 + 1; } diff --git a/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff index 208845942c76d..a4cc65a91ac4d 100644 --- a/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff @@ -7,7 +7,8 @@ let mut _2: u8; let mut _3: (u8, bool); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 3_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff index 4a7c69bae3ca8..ef2c274aa73f9 100644 --- a/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff @@ -7,7 +7,8 @@ let mut _2: u8; let mut _3: (u8, bool); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 3_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs index ca53e2b2f2b00..a2ee5be16d285 100644 --- a/tests/mir-opt/const_prop/indirect.rs +++ b/tests/mir-opt/const_prop/indirect.rs @@ -5,7 +5,6 @@ // EMIT_MIR indirect.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: [[x]] = const 3_u8; + // CHECK: debug x => const 3_u8; let x = (2u32 as u8) + 1; } diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff index 3569998b13fa5..939610ffe0703 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff @@ -8,7 +8,8 @@ let _3: usize; let mut _4: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 0_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff index 50b31c9ac136c..f520b7fc19613 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff @@ -8,7 +8,8 @@ let _3: usize; let mut _4: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 0_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff index 3569998b13fa5..939610ffe0703 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff @@ -8,7 +8,8 @@ let _3: usize; let mut _4: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 0_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff index 50b31c9ac136c..f520b7fc19613 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff @@ -8,7 +8,8 @@ let _3: usize; let mut _4: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 0_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-abort.diff index 77a2c5bcccc72..9b352c39037aa 100644 --- a/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-abort.diff @@ -5,25 +5,32 @@ let mut _0: (); let _1: usize; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_usize; let _2: usize; scope 2 { - debug y => _2; +- debug y => _2; ++ debug y => const 0_usize; let _3: usize; scope 3 { - debug z0 => _3; +- debug z0 => _3; ++ debug z0 => const 2_usize; let _4: usize; scope 4 { - debug z1 => _4; +- debug z1 => _4; ++ debug z1 => const 3_usize; let _5: usize; scope 5 { - debug eA0 => _5; +- debug eA0 => _5; ++ debug eA0 => const 1_usize; let _6: usize; scope 6 { - debug eA1 => _6; +- debug eA1 => _6; ++ debug eA1 => const 2_usize; let _7: usize; scope 7 { - debug eC => _7; +- debug eC => _7; ++ debug eC => const 4_usize; } } } diff --git a/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-unwind.diff index 77a2c5bcccc72..9b352c39037aa 100644 --- a/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/offset_of.concrete.GVN.panic-unwind.diff @@ -5,25 +5,32 @@ let mut _0: (); let _1: usize; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_usize; let _2: usize; scope 2 { - debug y => _2; +- debug y => _2; ++ debug y => const 0_usize; let _3: usize; scope 3 { - debug z0 => _3; +- debug z0 => _3; ++ debug z0 => const 2_usize; let _4: usize; scope 4 { - debug z1 => _4; +- debug z1 => _4; ++ debug z1 => const 3_usize; let _5: usize; scope 5 { - debug eA0 => _5; +- debug eA0 => _5; ++ debug eA0 => const 1_usize; let _6: usize; scope 6 { - debug eA1 => _6; +- debug eA1 => _6; ++ debug eA1 => const 2_usize; let _7: usize; scope 7 { - debug eC => _7; +- debug eC => _7; ++ debug eC => const 4_usize; } } } diff --git a/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-abort.diff index 130c31eff8ccc..b67c3c41d67e0 100644 --- a/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-abort.diff @@ -11,10 +11,12 @@ debug gy => _2; let _3: usize; scope 3 { - debug dx => _3; +- debug dx => _3; ++ debug dx => const 0_usize; let _4: usize; scope 4 { - debug dy => _4; +- debug dy => _4; ++ debug dy => const 2_usize; let _5: usize; scope 5 { debug zA0 => _5; diff --git a/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-unwind.diff index 130c31eff8ccc..b67c3c41d67e0 100644 --- a/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/offset_of.generic.GVN.panic-unwind.diff @@ -11,10 +11,12 @@ debug gy => _2; let _3: usize; scope 3 { - debug dx => _3; +- debug dx => _3; ++ debug dx => const 0_usize; let _4: usize; scope 4 { - debug dy => _4; +- debug dy => _4; ++ debug dy => const 2_usize; let _5: usize; scope 5 { debug zA0 => _5; diff --git a/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff b/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff index 8df262b351f12..1dffd99b5a62e 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff +++ b/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff @@ -9,7 +9,8 @@ let mut _4: u8; let mut _5: &u8; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_u8; } bb0: { diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs index 05fec2f3303b0..e030b09937c24 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.rs +++ b/tests/mir-opt/const_prop/read_immutable_static.rs @@ -5,7 +5,6 @@ static FOO: u8 = 2; // EMIT_MIR read_immutable_static.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: [[x]] = const 4_u8; + // CHECK: debug x => const 4_u8; let x = FOO + FOO; } diff --git a/tests/mir-opt/const_prop/ref_deref.main.GVN.diff b/tests/mir-opt/const_prop/ref_deref.main.GVN.diff index b9e269266b0b1..a52b50042dd06 100644 --- a/tests/mir-opt/const_prop/ref_deref.main.GVN.diff +++ b/tests/mir-opt/const_prop/ref_deref.main.GVN.diff @@ -8,7 +8,8 @@ let _3: i32; let mut _4: &i32; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 4_i32; } bb0: { diff --git a/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs index aef36323cc033..51a67f8499956 100644 --- a/tests/mir-opt/const_prop/ref_deref.rs +++ b/tests/mir-opt/const_prop/ref_deref.rs @@ -3,7 +3,6 @@ // EMIT_MIR ref_deref.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug a => [[a:_.*]]; - // CHECK: [[a]] = const 4_i32; + // CHECK: debug a => const 4_i32; let a = *(&4); } diff --git a/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff b/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff index dcc13c9251c41..f1c13a9316989 100644 --- a/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff +++ b/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff @@ -8,7 +8,8 @@ let _3: (i32, i32); let mut _4: &(i32, i32); scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 5_i32; } bb0: { diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs index 5a48a887f93d7..459b7a71af705 100644 --- a/tests/mir-opt/const_prop/ref_deref_project.rs +++ b/tests/mir-opt/const_prop/ref_deref_project.rs @@ -4,7 +4,6 @@ // EMIT_MIR ref_deref_project.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug a => [[a:_.*]]; - // CHECK: [[a]] = const 5_i32; + // CHECK: debug a => const 5_i32; let a = *(&(4, 5).1); } diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff index a41668b6fa36a..a63eef0dd6b7f 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff @@ -9,7 +9,8 @@ let _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff index 2313084b49e6f..b7529e8baa7ed 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff @@ -9,7 +9,8 @@ let _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff index a41668b6fa36a..a63eef0dd6b7f 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff @@ -9,7 +9,8 @@ let _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff index 2313084b49e6f..b7529e8baa7ed 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff @@ -9,7 +9,8 @@ let _4: usize; let mut _5: bool; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 42_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs index d778191389518..0bc8d46617518 100644 --- a/tests/mir-opt/const_prop/repeat.rs +++ b/tests/mir-opt/const_prop/repeat.rs @@ -5,7 +5,6 @@ // EMIT_MIR repeat.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug x => [[x:_.*]]; - // CHECK: [[x]] = const 42_u32; + // CHECK: debug x => const 42_u32; let x: u32 = [42; 8][2] + 0; } diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff index 3c73d34474c13..886d121a4cfdd 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff @@ -7,7 +7,8 @@ let _2: (); let mut _3: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff index 0a7fddee39b62..e39368326f25c 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff @@ -7,7 +7,8 @@ let _2: (); let mut _3: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff index d6e81debccd81..046a3ebb26320 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff @@ -13,7 +13,8 @@ let mut _8: bool; let mut _9: &[u32; 3]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff index 6713e531892ae..5a2209af07676 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff @@ -13,7 +13,8 @@ let mut _8: bool; let mut _9: &[u32; 3]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff index d6e81debccd81..046a3ebb26320 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff @@ -13,7 +13,8 @@ let mut _8: bool; let mut _9: &[u32; 3]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff index 6713e531892ae..5a2209af07676 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff @@ -13,7 +13,8 @@ let mut _8: bool; let mut _9: &[u32; 3]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const 2_u32; } bb0: { diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index ebd3c9e792dca..c47a8d0ee6377 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -6,9 +6,8 @@ // EMIT_MIR slice_len.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug a => [[a:_.*]]; + // CHECK: debug a => const 2_u32; // CHECK: [[slice:_.*]] = copy {{.*}} as &[u32] (PointerCoercion(Unsize, AsCast)); // CHECK: assert(const true, - // CHECK: [[a]] = const 2_u32; let a = (&[1u32, 2, 3] as &[u32])[1]; } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff index b698d8f373575..9a28e6e8a8047 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff @@ -6,7 +6,8 @@ let _1: std::boxed::Box; let mut _2: *const Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); } bb0: { diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff index b698d8f373575..9a28e6e8a8047 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff @@ -6,7 +6,8 @@ let _1: std::boxed::Box; let mut _2: *const Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); } bb0: { diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff index 5aeb55a5a6a53..ff5545b02dca9 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff @@ -6,7 +6,8 @@ let _1: Never; let mut _2: (); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const ZeroSized: Never; } bb0: { diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff index 5aeb55a5a6a53..ff5545b02dca9 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff @@ -6,7 +6,8 @@ let _1: Never; let mut _2: (); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const ZeroSized: Never; } bb0: { diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff index a702079323789..ec55398e331c5 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.32bit.diff @@ -6,7 +6,8 @@ let _1: &mut Never; let mut _2: &mut Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const {0x1 as &mut Never}; } bb0: { diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff index a702079323789..ec55398e331c5 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.GVN.64bit.diff @@ -6,7 +6,8 @@ let _1: &mut Never; let mut _2: &mut Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const {0x1 as &mut Never}; } bb0: { diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff index d44b087203569..12846d892b260 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.32bit.diff @@ -5,7 +5,8 @@ let mut _0: !; let _1: &Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const {0x1 as &Never}; } bb0: { diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff index d44b087203569..12846d892b260 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.GVN.64bit.diff @@ -5,7 +5,8 @@ let mut _0: !; let _1: &Never; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const {0x1 as &Never}; } bb0: { diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff index 01d86ce8717d1..015b2a47879fc 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff @@ -7,7 +7,8 @@ let _2: (); let mut _3: (u32, u32); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const (1_u32, 2_u32); } bb0: { diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff index bd7d494212ce6..c91329c138062 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff @@ -7,7 +7,8 @@ let _2: (); let mut _3: (u32, u32); scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const (1_u32, 2_u32); } bb0: { diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff index 2c89670dcf7d7..e59dc42f1b8e2 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 @@ -16,12 +16,13 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _6: std::num::NonZero; + let _6: std::ptr::Alignment; + let mut _7: std::num::NonZero; scope 6 { scope 8 (inlined std::ptr::Alignment::as_nonzero) { } scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - let _7: *const [bool; 0]; + let _8: *const [bool; 0]; scope 10 { } scope 11 (inlined NonZero::::get) { @@ -45,10 +46,13 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); - _6 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + _6 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); StorageLive(_7); - _7 = const {0x1 as *const [bool; 0]}; + _7 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + StorageLive(_8); + _8 = const {0x1 as *const [bool; 0]}; _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageDead(_8); StorageDead(_7); StorageDead(_6); _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; 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 8fecfe224cc69..cfa9b622b70bd 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 @@ -16,12 +16,13 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _6: std::num::NonZero; + let _6: std::ptr::Alignment; + let mut _7: std::num::NonZero; scope 6 { scope 8 (inlined std::ptr::Alignment::as_nonzero) { } scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - let _7: *const [bool; 0]; + let _8: *const [bool; 0]; scope 10 { } scope 11 (inlined NonZero::::get) { @@ -45,10 +46,13 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); - _6 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + _6 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); StorageLive(_7); - _7 = const {0x1 as *const [bool; 0]}; + _7 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + StorageLive(_8); + _8 = const {0x1 as *const [bool; 0]}; _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageDead(_8); StorageDead(_7); StorageDead(_6); _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; 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 976ea252c2f89..db36b4737a760 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 @@ -16,12 +16,13 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _6: std::num::NonZero; + let _6: std::ptr::Alignment; + let mut _7: std::num::NonZero; scope 6 { scope 8 (inlined std::ptr::Alignment::as_nonzero) { } scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - let _7: *const [bool; 0]; + let _8: *const [bool; 0]; scope 10 { } scope 11 (inlined NonZero::::get) { @@ -45,10 +46,13 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); - _6 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + _6 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); StorageLive(_7); - _7 = const {0x1 as *const [bool; 0]}; + _7 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + StorageLive(_8); + _8 = const {0x1 as *const [bool; 0]}; _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageDead(_8); StorageDead(_7); StorageDead(_6); _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; 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 6c59f5e3e2e86..c4ce4d7b85824 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 @@ -16,12 +16,13 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _6: std::num::NonZero; + let _6: std::ptr::Alignment; + let mut _7: std::num::NonZero; scope 6 { scope 8 (inlined std::ptr::Alignment::as_nonzero) { } scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - let _7: *const [bool; 0]; + let _8: *const [bool; 0]; scope 10 { } scope 11 (inlined NonZero::::get) { @@ -45,10 +46,13 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); - _6 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + _6 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); StorageLive(_7); - _7 = const {0x1 as *const [bool; 0]}; + _7 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + StorageLive(_8); + _8 = const {0x1 as *const [bool; 0]}; _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageDead(_8); StorageDead(_7); StorageDead(_6); _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff index 1f9cf6d6aca83..9dc32a4e72ca6 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff @@ -16,12 +16,13 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _6: std::num::NonZero; + let _6: std::ptr::Alignment; + let mut _7: std::num::NonZero; scope 6 { scope 8 (inlined std::ptr::Alignment::as_nonzero) { } scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - let _7: *const [bool; 0]; + let _8: *const [bool; 0]; scope 10 { } scope 11 (inlined NonZero::::get) { @@ -45,13 +46,17 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); -- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero (Transmute); -+ _6 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); +- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}; ++ _6 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); StorageLive(_7); -- _7 = copy _6 as *const [bool; 0] (Transmute); -- _5 = NonNull::<[bool; 0]> { pointer: copy _7 }; -+ _7 = const {0x1 as *const [bool; 0]}; +- _7 = copy _6 as std::num::NonZero (Transmute); ++ _7 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + StorageLive(_8); +- _8 = copy _7 as *const [bool; 0] (Transmute); +- _5 = NonNull::<[bool; 0]> { pointer: copy _8 }; ++ _8 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageDead(_8); StorageDead(_7); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff index a8760285fac11..fc03e58430e78 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff @@ -16,12 +16,13 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _6: std::num::NonZero; + let _6: std::ptr::Alignment; + let mut _7: std::num::NonZero; scope 6 { scope 8 (inlined std::ptr::Alignment::as_nonzero) { } scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - let _7: *const [bool; 0]; + let _8: *const [bool; 0]; scope 10 { } scope 11 (inlined NonZero::::get) { @@ -45,13 +46,17 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); -- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero (Transmute); -+ _6 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); +- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}; ++ _6 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); StorageLive(_7); -- _7 = copy _6 as *const [bool; 0] (Transmute); -- _5 = NonNull::<[bool; 0]> { pointer: copy _7 }; -+ _7 = const {0x1 as *const [bool; 0]}; +- _7 = copy _6 as std::num::NonZero (Transmute); ++ _7 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + StorageLive(_8); +- _8 = copy _7 as *const [bool; 0] (Transmute); +- _5 = NonNull::<[bool; 0]> { pointer: copy _8 }; ++ _8 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageDead(_8); StorageDead(_7); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff index c398ae70a1a3e..91191289e4346 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff @@ -16,12 +16,13 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _6: std::num::NonZero; + let _6: std::ptr::Alignment; + let mut _7: std::num::NonZero; scope 6 { scope 8 (inlined std::ptr::Alignment::as_nonzero) { } scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - let _7: *const [bool; 0]; + let _8: *const [bool; 0]; scope 10 { } scope 11 (inlined NonZero::::get) { @@ -45,13 +46,17 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); -- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero (Transmute); -+ _6 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); +- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}; ++ _6 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); StorageLive(_7); -- _7 = copy _6 as *const [bool; 0] (Transmute); -- _5 = NonNull::<[bool; 0]> { pointer: copy _7 }; -+ _7 = const {0x1 as *const [bool; 0]}; +- _7 = copy _6 as std::num::NonZero (Transmute); ++ _7 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + StorageLive(_8); +- _8 = copy _7 as *const [bool; 0] (Transmute); +- _5 = NonNull::<[bool; 0]> { pointer: copy _8 }; ++ _8 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageDead(_8); StorageDead(_7); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff index 02934c02587d2..5612d560524c1 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff @@ -16,12 +16,13 @@ scope 4 (inlined Unique::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - let mut _6: std::num::NonZero; + let _6: std::ptr::Alignment; + let mut _7: std::num::NonZero; scope 6 { scope 8 (inlined std::ptr::Alignment::as_nonzero) { } scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - let _7: *const [bool; 0]; + let _8: *const [bool; 0]; scope 10 { } scope 11 (inlined NonZero::::get) { @@ -45,13 +46,17 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); -- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero (Transmute); -+ _6 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); +- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}; ++ _6 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); StorageLive(_7); -- _7 = copy _6 as *const [bool; 0] (Transmute); -- _5 = NonNull::<[bool; 0]> { pointer: copy _7 }; -+ _7 = const {0x1 as *const [bool; 0]}; +- _7 = copy _6 as std::num::NonZero (Transmute); ++ _7 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); + StorageLive(_8); +- _8 = copy _7 as *const [bool; 0] (Transmute); +- _5 = NonNull::<[bool; 0]> { pointer: copy _8 }; ++ _8 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; + StorageDead(_8); StorageDead(_7); StorageDead(_6); - _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff index f203b80e4776c..031a1c8f76430 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff @@ -10,7 +10,7 @@ let mut _8: *const [()]; let mut _9: std::boxed::Box<()>; let mut _10: *const (); - let mut _23: usize; + let mut _24: usize; scope 1 { debug vp_ctx => _1; let _4: *const (); @@ -43,11 +43,12 @@ let mut _18: !; scope 7 { let _17: std::ptr::NonNull<[u8]>; + let mut _19: &std::alloc::Global; scope 8 { scope 11 (inlined NonNull::<[u8]>::as_mut_ptr) { scope 12 (inlined NonNull::<[u8]>::as_non_null_ptr) { scope 13 (inlined NonNull::<[u8]>::cast::) { - let mut _22: *mut [u8]; + let mut _23: *mut [u8]; scope 14 (inlined NonNull::<[u8]>::as_ptr) { } } @@ -60,9 +61,9 @@ } } scope 9 (inlined #[track_caller] Layout::from_size_align_unchecked) { - let mut _19: bool; - let _20: (); - let mut _21: std::ptr::Alignment; + let mut _20: bool; + let _21: (); + let mut _22: std::ptr::Alignment; } } } @@ -82,8 +83,9 @@ StorageLive(_16); StorageLive(_17); StorageLive(_19); - _19 = const false; -- switchInt(move _19) -> [0: bb6, otherwise: bb5]; + StorageLive(_20); + _20 = const false; +- switchInt(move _20) -> [0: bb6, otherwise: bb5]; + switchInt(const false) -> [0: bb6, otherwise: bb5]; } @@ -104,11 +106,12 @@ bb4: { _17 = copy ((_15 as Ok).0: std::ptr::NonNull<[u8]>); - StorageLive(_22); - _22 = copy _17 as *mut [u8] (Transmute); - _13 = copy _22 as *mut u8 (PtrToPtr); - StorageDead(_22); + StorageLive(_23); + _23 = copy _17 as *mut [u8] (Transmute); + _13 = copy _23 as *mut u8 (PtrToPtr); + StorageDead(_23); StorageDead(_15); + StorageDead(_19); StorageDead(_17); StorageDead(_16); StorageDead(_14); @@ -129,11 +132,11 @@ StorageLive(_6); - _6 = copy _4; + _6 = copy _10; - StorageLive(_23); - _23 = const 1_usize; -- _5 = *const [()] from (copy _6, copy _23); + StorageLive(_24); + _24 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _24); + _5 = *const [()] from (copy _10, const 1_usize); - StorageDead(_23); + StorageDead(_24); StorageDead(_6); StorageLive(_7); StorageLive(_8); @@ -149,21 +152,22 @@ } bb5: { -- _20 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable]; -+ _20 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable]; +- _21 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable]; ++ _21 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable]; } bb6: { - StorageDead(_19); - StorageLive(_21); -- _21 = copy _12 as std::ptr::Alignment (Transmute); -- _14 = Layout { size: copy _11, align: move _21 }; -+ _21 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); + StorageDead(_20); + StorageLive(_22); +- _22 = copy _12 as std::ptr::Alignment (Transmute); +- _14 = Layout { size: copy _11, align: move _22 }; ++ _22 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); + _14 = const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}; - StorageDead(_21); + StorageDead(_22); StorageLive(_15); -- _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], copy _14, const false) -> [return: bb7, unwind unreachable]; -+ _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable]; + _19 = const alloc::alloc::exchange_malloc::promoted[0]; +- _15 = std::alloc::Global::alloc_impl(move _19, copy _14, const false) -> [return: bb7, unwind unreachable]; ++ _15 = std::alloc::Global::alloc_impl(move _19, const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable]; } bb7: { diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff index f072eb6ef8bf6..1d53df73f5bfb 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff @@ -10,7 +10,7 @@ let mut _8: *const [()]; let mut _9: std::boxed::Box<()>; let mut _10: *const (); - let mut _23: usize; + let mut _24: usize; scope 1 { debug vp_ctx => _1; let _4: *const (); @@ -43,11 +43,12 @@ let mut _18: !; scope 7 { let _17: std::ptr::NonNull<[u8]>; + let mut _19: &std::alloc::Global; scope 8 { scope 11 (inlined NonNull::<[u8]>::as_mut_ptr) { scope 12 (inlined NonNull::<[u8]>::as_non_null_ptr) { scope 13 (inlined NonNull::<[u8]>::cast::) { - let mut _22: *mut [u8]; + let mut _23: *mut [u8]; scope 14 (inlined NonNull::<[u8]>::as_ptr) { } } @@ -60,9 +61,9 @@ } } scope 9 (inlined #[track_caller] Layout::from_size_align_unchecked) { - let mut _19: bool; - let _20: (); - let mut _21: std::ptr::Alignment; + let mut _20: bool; + let _21: (); + let mut _22: std::ptr::Alignment; } } } @@ -82,8 +83,9 @@ StorageLive(_16); StorageLive(_17); StorageLive(_19); - _19 = const false; -- switchInt(move _19) -> [0: bb6, otherwise: bb5]; + StorageLive(_20); + _20 = const false; +- switchInt(move _20) -> [0: bb6, otherwise: bb5]; + switchInt(const false) -> [0: bb6, otherwise: bb5]; } @@ -104,11 +106,12 @@ bb4: { _17 = copy ((_15 as Ok).0: std::ptr::NonNull<[u8]>); - StorageLive(_22); - _22 = copy _17 as *mut [u8] (Transmute); - _13 = copy _22 as *mut u8 (PtrToPtr); - StorageDead(_22); + StorageLive(_23); + _23 = copy _17 as *mut [u8] (Transmute); + _13 = copy _23 as *mut u8 (PtrToPtr); + StorageDead(_23); StorageDead(_15); + StorageDead(_19); StorageDead(_17); StorageDead(_16); StorageDead(_14); @@ -129,11 +132,11 @@ StorageLive(_6); - _6 = copy _4; + _6 = copy _10; - StorageLive(_23); - _23 = const 1_usize; -- _5 = *const [()] from (copy _6, copy _23); + StorageLive(_24); + _24 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _24); + _5 = *const [()] from (copy _10, const 1_usize); - StorageDead(_23); + StorageDead(_24); StorageDead(_6); StorageLive(_7); StorageLive(_8); @@ -149,21 +152,22 @@ } bb5: { -- _20 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable]; -+ _20 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable]; +- _21 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable]; ++ _21 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable]; } bb6: { - StorageDead(_19); - StorageLive(_21); -- _21 = copy _12 as std::ptr::Alignment (Transmute); -- _14 = Layout { size: copy _11, align: move _21 }; -+ _21 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); + StorageDead(_20); + StorageLive(_22); +- _22 = copy _12 as std::ptr::Alignment (Transmute); +- _14 = Layout { size: copy _11, align: move _22 }; ++ _22 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); + _14 = const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}; - StorageDead(_21); + StorageDead(_22); StorageLive(_15); -- _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], copy _14, const false) -> [return: bb7, unwind unreachable]; -+ _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable]; + _19 = const alloc::alloc::exchange_malloc::promoted[0]; +- _15 = std::alloc::Global::alloc_impl(move _19, copy _14, const false) -> [return: bb7, unwind unreachable]; ++ _15 = std::alloc::Global::alloc_impl(move _19, const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable]; } bb7: { diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff index 6baa902b6f4bd..40630e7ad9712 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff @@ -47,7 +47,7 @@ StorageLive(_20); StorageLive(_21); _21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32); - _20 = BitAnd(move _21, const core::fmt::flags::SIGN_PLUS_FLAG); + _20 = BitAnd(move _21, const 2097152_u32); StorageDead(_21); _4 = Ne(move _20, const 0_u32); StorageDead(_20); @@ -72,7 +72,7 @@ StorageLive(_22); StorageLive(_23); _23 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32); - _22 = BitAnd(move _23, const core::fmt::flags::PRECISION_FLAG); + _22 = BitAnd(move _23, const 268435456_u32); StorageDead(_23); switchInt(move _22) -> [0: bb10, otherwise: bb11]; } diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff index 36540e038654f..29a5b06ae7ec8 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff @@ -47,7 +47,7 @@ StorageLive(_20); StorageLive(_21); _21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32); - _20 = BitAnd(move _21, const core::fmt::flags::SIGN_PLUS_FLAG); + _20 = BitAnd(move _21, const 2097152_u32); StorageDead(_21); _4 = Ne(move _20, const 0_u32); StorageDead(_20); @@ -72,7 +72,7 @@ StorageLive(_22); StorageLive(_23); _23 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32); - _22 = BitAnd(move _23, const core::fmt::flags::PRECISION_FLAG); + _22 = BitAnd(move _23, const 268435456_u32); StorageDead(_23); switchInt(move _22) -> [0: bb10, otherwise: bb11]; } diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff index 41c350f3eaeb5..56e08fcce8082 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-abort.diff @@ -47,7 +47,7 @@ StorageLive(_20); StorageLive(_21); _21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32); - _20 = BitAnd(move _21, const core::fmt::flags::SIGN_PLUS_FLAG); + _20 = BitAnd(move _21, const 2097152_u32); StorageDead(_21); _4 = Ne(move _20, const 0_u32); StorageDead(_20); @@ -72,7 +72,7 @@ StorageLive(_22); StorageLive(_23); _23 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32); - _22 = BitAnd(move _23, const core::fmt::flags::PRECISION_FLAG); + _22 = BitAnd(move _23, const 268435456_u32); StorageDead(_23); switchInt(move _22) -> [0: bb10, otherwise: bb11]; } diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff index b839bf81eaf45..dd4c5cf5d65d6 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.64bit.panic-unwind.diff @@ -47,7 +47,7 @@ StorageLive(_20); StorageLive(_21); _21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32); - _20 = BitAnd(move _21, const core::fmt::flags::SIGN_PLUS_FLAG); + _20 = BitAnd(move _21, const 2097152_u32); StorageDead(_21); _4 = Ne(move _20, const 0_u32); StorageDead(_20); @@ -72,7 +72,7 @@ StorageLive(_22); StorageLive(_23); _23 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32); - _22 = BitAnd(move _23, const core::fmt::flags::PRECISION_FLAG); + _22 = BitAnd(move _23, const 268435456_u32); StorageDead(_23); switchInt(move _22) -> [0: bb10, otherwise: bb11]; } diff --git a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff index 1d523d22ca646..a79761a828b78 100644 --- a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff @@ -92,13 +92,16 @@ let _89: (); let mut _90: f64; scope 1 { - debug i => _1; +- debug i => _1; ++ debug i => const 1_i64; let _2: u64; scope 2 { - debug u => _2; +- debug u => _2; ++ debug u => const 1_u64; let _3: f64; scope 3 { - debug f => _3; +- debug f => _3; ++ debug f => const 1f64; } } } diff --git a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff index 3541c10da6437..62f3025268bfc 100644 --- a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff @@ -92,13 +92,16 @@ let _89: (); let mut _90: f64; scope 1 { - debug i => _1; +- debug i => _1; ++ debug i => const 1_i64; let _2: u64; scope 2 { - debug u => _2; +- debug u => _2; ++ debug u => const 1_u64; let _3: f64; scope 3 { - debug f => _3; +- debug f => _3; ++ debug f => const 1f64; } } } diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff index 183b4d2599f53..d9868b1408d8e 100644 --- a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff @@ -17,7 +17,8 @@ let mut _13: bool; let mut _14: T; scope 1 { - debug a => _2; +- debug a => _2; ++ debug a => const usize::MAX; let _3: T; scope 2 { debug b => _3; diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff index 03e8aa3bd9b98..2731fd760da5d 100644 --- a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff @@ -17,7 +17,8 @@ let mut _13: bool; let mut _14: T; scope 1 { - debug a => _2; +- debug a => _2; ++ debug a => const usize::MAX; let _3: T; scope 2 { debug b => _3; diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff index f3f631956374d..de43f5ea7ccd5 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff @@ -21,7 +21,8 @@ debug g => _4; let _7: {closure@$DIR/gvn.rs:617:19: 617:21}; scope 3 { - debug closure => _7; +- debug closure => _7; ++ debug closure => const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21}; let _8: fn(); scope 4 { debug cf => _8; diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff index 029e736a97952..f0826cea45165 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff @@ -21,7 +21,8 @@ debug g => _4; let _7: {closure@$DIR/gvn.rs:617:19: 617:21}; scope 3 { - debug closure => _7; +- debug closure => _7; ++ debug closure => const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21}; let _8: fn(); scope 4 { debug cf => _8; diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff index ef2eb1a66779d..39aa1672fd30f 100644 --- a/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff @@ -15,7 +15,8 @@ let mut _11: i32; let mut _12: i32; scope 1 { - debug val => _1; +- debug val => _1; ++ debug val => const 5_i32; let _2: [i32; 10]; scope 2 { debug array => _2; diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff index ef2eb1a66779d..39aa1672fd30f 100644 --- a/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff @@ -15,7 +15,8 @@ let mut _11: i32; let mut _12: i32; scope 1 { - debug val => _1; +- debug val => _1; ++ debug val => const 5_i32; let _2: [i32; 10]; scope 2 { debug array => _2; diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index 3c3241fefe22e..604aeb94e0dd3 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -640,11 +640,10 @@ fn indirect_static() { /// Verify that having constant index `u64::MAX` does not yield to an overflow in rustc. fn constant_index_overflow(x: &[T]) { // CHECK-LABEL: fn constant_index_overflow( - // CHECK: debug a => [[a:_.*]]; + // CHECK: debug a => const usize::MAX; // CHECK: debug b => [[b:_.*]]; - // CHECK: [[a]] = const usize::MAX; // CHECK-NOT: = (*_1)[{{.*}} of 0]; - // CHECK: [[b]] = copy (*_1)[[[a]]]; + // CHECK: [[b]] = copy (*_1)[[[a:_.*]]]; // CHECK-NOT: = (*_1)[{{.*}} of 0]; // CHECK: [[b]] = copy (*_1)[0 of 1]; // CHECK-NOT: = (*_1)[{{.*}} of 0]; @@ -709,8 +708,8 @@ fn wide_ptr_same_provenance() { /// Check that we do simplify when there is no provenance, and do not ICE. fn wide_ptr_integer() { // CHECK-LABEL: fn wide_ptr_integer( - // CHECK: debug a => [[a:_.*]]; - // CHECK: debug b => [[b:_.*]]; + // CHECK: debug a => const Indirect + // CHECK: debug b => const Indirect let a: *const [u8] = unsafe { transmute((1usize, 1usize)) }; let b: *const [u8] = unsafe { transmute((1usize, 2usize)) }; diff --git a/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff b/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff index 1a6204e4ac8ae..e473be14e6171 100644 --- a/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff @@ -12,7 +12,8 @@ debug ptr => _2; let _4: usize; scope 2 { - debug len => _4; +- debug len => _4; ++ debug len => const 123_usize; } } diff --git a/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff index 62d57b0fe2831..e046b18edf99d 100644 --- a/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff @@ -12,7 +12,8 @@ debug ptr => _2; let _4: usize; scope 2 { - debug len => _4; +- debug len => _4; ++ debug len => const 123_usize; } } diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff index 091c3bd5c7b2a..5994e47dcd980 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff @@ -50,10 +50,12 @@ let _53: &*const u8; let mut _54: std::option::Option>; scope 1 { - debug s => _1; +- debug s => _1; ++ debug s => const "my favourite slice"; let _4: &str; scope 2 { - debug t => _4; +- debug t => _4; ++ debug t => const "my favourite slice"; let _15: &*const u8; let _16: &*const u8; let _29: &[u8]; @@ -62,7 +64,8 @@ debug right_val => _16; let _21: core::panicking::AssertKind; scope 4 { - debug kind => _21; +- debug kind => _21; ++ debug kind => const core::panicking::AssertKind::Eq; } } scope 5 { @@ -74,7 +77,8 @@ debug right_val => _42; let _47: core::panicking::AssertKind; scope 7 { - debug kind => _47; +- debug kind => _47; ++ debug kind => const core::panicking::AssertKind::Eq; } } } diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff index 9768956c9c870..5c6affb0797c3 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff @@ -50,10 +50,12 @@ let _53: &*const u8; let mut _54: std::option::Option>; scope 1 { - debug s => _1; +- debug s => _1; ++ debug s => const "my favourite slice"; let _4: &str; scope 2 { - debug t => _4; +- debug t => _4; ++ debug t => const "my favourite slice"; let _15: &*const u8; let _16: &*const u8; let _29: &[u8]; @@ -62,7 +64,8 @@ debug right_val => _16; let _21: core::panicking::AssertKind; scope 4 { - debug kind => _21; +- debug kind => _21; ++ debug kind => const core::panicking::AssertKind::Eq; } } scope 5 { @@ -74,7 +77,8 @@ debug right_val => _42; let _47: core::panicking::AssertKind; scope 7 { - debug kind => _47; +- debug kind => _47; ++ debug kind => const core::panicking::AssertKind::Eq; } } } diff --git a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff index bb938f3ba6a9a..9aea74926e994 100644 --- a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff @@ -31,10 +31,12 @@ let mut _27: *const [u8]; let mut _28: *const [u8]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; let _3: *const [u8]; scope 2 { - debug b => _3; +- debug b => _3; ++ debug b => const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; } } diff --git a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff index 81432d687eb32..0ebff8eca55df 100644 --- a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff @@ -31,10 +31,12 @@ let mut _27: *const [u8]; let mut _28: *const [u8]; scope 1 { - debug a => _1; +- debug a => _1; ++ debug a => const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; let _3: *const [u8]; scope 2 { - debug b => _3; +- debug b => _3; ++ debug b => const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; } } diff --git a/tests/mir-opt/gvn_const_eval_polymorphic.no_optimize.GVN.diff b/tests/mir-opt/gvn_const_eval_polymorphic.no_optimize.GVN.diff index a91561ba304b8..92158682c9993 100644 --- a/tests/mir-opt/gvn_const_eval_polymorphic.no_optimize.GVN.diff +++ b/tests/mir-opt/gvn_const_eval_polymorphic.no_optimize.GVN.diff @@ -5,7 +5,8 @@ let mut _0: bool; bb0: { - _0 = Eq(const no_optimize::::{constant#0}, const no_optimize::::{constant#1}); +- _0 = Eq(const no_optimize::::{constant#0}, const no_optimize::::{constant#1}); ++ _0 = Eq(const no_optimize::::{constant#0}, const true); return; } } diff --git a/tests/mir-opt/gvn_const_eval_polymorphic.rs b/tests/mir-opt/gvn_const_eval_polymorphic.rs index 7320ad947ff2e..722720b2a6f07 100644 --- a/tests/mir-opt/gvn_const_eval_polymorphic.rs +++ b/tests/mir-opt/gvn_const_eval_polymorphic.rs @@ -51,7 +51,7 @@ fn optimize_false() -> bool { // EMIT_MIR gvn_const_eval_polymorphic.no_optimize.GVN.diff fn no_optimize() -> bool { // CHECK-LABEL: fn no_optimize( - // CHECK: _0 = Eq(const no_optimize::::{constant#0}, const no_optimize::::{constant#1}); + // CHECK: _0 = Eq(const no_optimize::::{constant#0}, const true); // CHECK-NEXT: return; (const { type_name_contains_i32(&generic::) }) == const { true } } diff --git a/tests/mir-opt/gvn_on_unsafe_binder.propagate.GVN.diff b/tests/mir-opt/gvn_on_unsafe_binder.propagate.GVN.diff index e28d04f1d5885..7d925eea2a96c 100644 --- a/tests/mir-opt/gvn_on_unsafe_binder.propagate.GVN.diff +++ b/tests/mir-opt/gvn_on_unsafe_binder.propagate.GVN.diff @@ -6,10 +6,12 @@ let _1: i32; let mut _3: i32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_i32; let _2: unsafe<> i32; scope 2 { - debug binder => _2; +- debug binder => _2; ++ debug binder => const {transmute(0x00000001): unsafe<> i32}; } } diff --git a/tests/mir-opt/gvn_on_unsafe_binder.test.GVN.diff b/tests/mir-opt/gvn_on_unsafe_binder.test.GVN.diff index 33814fb34f3d2..6576d5e566a52 100644 --- a/tests/mir-opt/gvn_on_unsafe_binder.test.GVN.diff +++ b/tests/mir-opt/gvn_on_unsafe_binder.test.GVN.diff @@ -6,7 +6,8 @@ let _1: i32; let mut _3: &i32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 1_i32; let _2: unsafe<'a> &'a i32; scope 2 { debug binder => _2; diff --git a/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff b/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff index f56af33ea603f..b31d58614372c 100644 --- a/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff +++ b/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff @@ -7,7 +7,8 @@ let mut _2: *mut u8; scope 1 (inlined dangling_mut::) { scope 2 (inlined NonNull::::dangling) { - let mut _3: std::num::NonZero; + let _3: std::ptr::Alignment; + let mut _4: std::num::NonZero; scope 3 { scope 5 (inlined std::ptr::Alignment::as_nonzero) { } @@ -29,9 +30,9 @@ } } scope 12 (inlined Foo::::cmp_ptr) { - let mut _4: *const u8; - let mut _5: *mut u8; - let mut _6: *const u8; + let mut _5: *const u8; + let mut _6: *mut u8; + let mut _7: *const u8; scope 13 (inlined std::ptr::eq::) { } } @@ -39,26 +40,30 @@ bb0: { StorageLive(_1); StorageLive(_2); + StorageLive(_4); StorageLive(_3); -- _3 = const std::ptr::Alignment::of::::{constant#0} as std::num::NonZero (Transmute); -- _2 = copy _3 as *mut u8 (Transmute); -+ _3 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); -+ _2 = const {0x1 as *mut u8}; +- _3 = const std::ptr::Alignment::of::::{constant#0}; +- _4 = copy _3 as std::num::NonZero (Transmute); ++ _3 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); ++ _4 = const NonZero::(core::num::niche_types::NonZeroUsizeInner(1_usize)); StorageDead(_3); - StorageLive(_4); +- _2 = copy _4 as *mut u8 (Transmute); ++ _2 = const {0x1 as *mut u8}; + StorageDead(_4); StorageLive(_5); -- _5 = copy _2; -- _4 = copy _2 as *const u8 (PtrToPtr); -+ _5 = const {0x1 as *mut u8}; -+ _4 = const {0x1 as *const u8}; - StorageDead(_5); StorageLive(_6); -- _6 = const Foo::::SENTINEL as *const u8 (PtrToPtr); -- _1 = Eq(copy _4, copy _6); -+ _6 = const {0x1 as *const u8}; -+ _1 = const true; +- _6 = copy _2; +- _5 = copy _2 as *const u8 (PtrToPtr); ++ _6 = const {0x1 as *mut u8}; ++ _5 = const {0x1 as *const u8}; StorageDead(_6); - StorageDead(_4); + StorageLive(_7); +- _7 = const Foo::::SENTINEL as *const u8 (PtrToPtr); +- _1 = Eq(copy _5, copy _7); ++ _7 = const {0x1 as *const u8}; ++ _1 = const true; + StorageDead(_7); + StorageDead(_5); StorageDead(_2); StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff index a3e4796d088e4..d377f35ee1c50 100644 --- a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff @@ -9,7 +9,8 @@ let _4: U; let mut _5: &U; scope 1 { - debug i => _1; +- debug i => _1; ++ debug i => const 0_u32; } bb0: { diff --git a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff index a3e4796d088e4..d377f35ee1c50 100644 --- a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff @@ -9,7 +9,8 @@ let _4: U; let mut _5: &U; scope 1 { - debug i => _1; +- debug i => _1; ++ debug i => const 0_u32; } bb0: { diff --git a/tests/mir-opt/optimize_none.rs b/tests/mir-opt/optimize_none.rs index a5b541bd2b628..030f74e5ec243 100644 --- a/tests/mir-opt/optimize_none.rs +++ b/tests/mir-opt/optimize_none.rs @@ -15,7 +15,8 @@ pub fn add_noopt() -> i32 { #[optimize(none)] pub fn const_branch() -> i32 { // CHECK-LABEL: fn const_branch( - // CHECK: switchInt(const true) -> [0: [[FALSE:bb[0-9]+]], otherwise: [[TRUE:bb[0-9]+]]]; + // CHECK: _1 = const true; + // CHECK: switchInt(move _1) -> [0: [[FALSE:bb[0-9]+]], otherwise: [[TRUE:bb[0-9]+]]]; // CHECK-NEXT: } // CHECK: [[FALSE]]: { // CHECK-NEXT: _0 = const 0 diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-abort.mir index 18eeb8e4d3b61..c97c9b45d6ad5 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-abort.mir @@ -17,7 +17,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option { bb0: { StorageLive(_3); - _3 = Lt(copy _2, const core::num::::BITS); + _3 = Lt(copy _2, const 32_u32); switchInt(move _3) -> [0: bb1, otherwise: bb2]; } diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir index 18eeb8e4d3b61..c97c9b45d6ad5 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir @@ -17,7 +17,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option { bb0: { StorageLive(_3); - _3 = Lt(copy _2, const core::num::::BITS); + _3 = Lt(copy _2, const 32_u32); switchInt(move _3) -> [0: bb1, otherwise: bb2]; } diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir index 83478e60b5d4e..7b681946bee1e 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir @@ -72,7 +72,7 @@ fn step_forward(_1: u16, _2: usize) -> u16 { } bb6: { - assert(!const true, "attempt to compute `{} + {}`, which would overflow", const core::num::::MAX, const 1_u16) -> [success: bb7, unwind unreachable]; + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u16::MAX, const 1_u16) -> [success: bb7, unwind unreachable]; } bb7: { diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir index ac7a6e0445191..a0137b23ec4f4 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir @@ -72,7 +72,7 @@ fn step_forward(_1: u16, _2: usize) -> u16 { } bb6: { - assert(!const true, "attempt to compute `{} + {}`, which would overflow", const core::num::::MAX, const 1_u16) -> [success: bb7, unwind continue]; + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u16::MAX, const 1_u16) -> [success: bb7, unwind continue]; } bb7: { 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 3f854b6cbcfbd..35315b6881e78 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 @@ -12,7 +12,8 @@ let mut _7: &std::alloc::Global; let mut _8: std::alloc::Layout; scope 1 { - debug layout => _1; +- debug layout => _1; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}; let mut _9: &std::alloc::Global; scope 2 { debug ptr => _3; 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 15a9d9e39c491..1bd19409a2bfd 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 @@ -12,7 +12,8 @@ let mut _7: &std::alloc::Global; let mut _8: std::alloc::Layout; scope 1 { - debug layout => _1; +- debug layout => _1; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}; let mut _9: &std::alloc::Global; scope 2 { debug ptr => _3; 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 1dbe9394e7094..48f227e5c3318 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 @@ -12,7 +12,8 @@ let mut _7: &std::alloc::Global; let mut _8: std::alloc::Layout; scope 1 { - debug layout => _1; +- debug layout => _1; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}; let mut _9: &std::alloc::Global; scope 2 { debug ptr => _3; 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 df008ececae30..06291947a453c 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 @@ -12,7 +12,8 @@ let mut _7: &std::alloc::Global; let mut _8: std::alloc::Layout; scope 1 { - debug layout => _1; +- debug layout => _1; ++ debug layout => const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}; let mut _9: &std::alloc::Global; scope 2 { debug ptr => _3; diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff index 5b39e45806e33..efaffb247f6d5 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff @@ -10,13 +10,16 @@ let mut _6: bool; let mut _8: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_i32; let _3: i32; scope 2 { - debug y => _3; +- debug y => _3; ++ debug y => const 3_i32; let _7: u32; scope 3 { - debug z => _7; +- debug z => _7; ++ debug z => const 42_u32; } } } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff index ea2742a6471a1..5b4e7aeafa921 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff @@ -10,13 +10,16 @@ let mut _6: bool; let mut _8: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_i32; let _3: i32; scope 2 { - debug y => _3; +- debug y => _3; ++ debug y => const 3_i32; let _7: u32; scope 3 { - debug z => _7; +- debug z => _7; ++ debug z => const 42_u32; } } } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff index 5b39e45806e33..efaffb247f6d5 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff @@ -10,13 +10,16 @@ let mut _6: bool; let mut _8: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_i32; let _3: i32; scope 2 { - debug y => _3; +- debug y => _3; ++ debug y => const 3_i32; let _7: u32; scope 3 { - debug z => _7; +- debug z => _7; ++ debug z => const 42_u32; } } } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff index ea2742a6471a1..5b4e7aeafa921 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff @@ -10,13 +10,16 @@ let mut _6: bool; let mut _8: u32; scope 1 { - debug x => _1; +- debug x => _1; ++ debug x => const 4_i32; let _3: i32; scope 2 { - debug y => _3; +- debug y => _3; ++ debug y => const 3_i32; let _7: u32; scope 3 { - debug z => _7; +- debug z => _7; ++ debug z => const 42_u32; } } } diff --git a/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff b/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff index 9e798cbcac0c1..2f5ba3d616c0b 100644 --- a/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff +++ b/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff @@ -6,7 +6,8 @@ let mut _1: bool; let _2: bool; scope 1 { - debug x => _2; +- debug x => _2; ++ debug x => const false; } bb0: { diff --git a/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff b/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff index e243ff45ab0b2..fc4a64d921786 100644 --- a/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff @@ -6,7 +6,8 @@ let mut _1: bool; let _2: bool; scope 1 { - debug x => _2; +- debug x => _2; ++ debug x => const false; } bb0: { diff --git a/tests/mir-opt/single_use_consts.assign_const_to_return.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.assign_const_to_return.GVN.panic-abort.diff similarity index 57% rename from tests/mir-opt/single_use_consts.assign_const_to_return.SingleUseConsts.panic-abort.diff rename to tests/mir-opt/single_use_consts.assign_const_to_return.GVN.panic-abort.diff index 8818c891e94b1..c3b880713b46a 100644 --- a/tests/mir-opt/single_use_consts.assign_const_to_return.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.assign_const_to_return.GVN.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `assign_const_to_return` before SingleUseConsts -+ // MIR for `assign_const_to_return` after SingleUseConsts +- // MIR for `assign_const_to_return` before GVN ++ // MIR for `assign_const_to_return` after GVN fn assign_const_to_return() -> bool { let mut _0: bool; diff --git a/tests/mir-opt/single_use_consts.assign_const_to_return.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.assign_const_to_return.GVN.panic-unwind.diff similarity index 57% rename from tests/mir-opt/single_use_consts.assign_const_to_return.SingleUseConsts.panic-unwind.diff rename to tests/mir-opt/single_use_consts.assign_const_to_return.GVN.panic-unwind.diff index 8818c891e94b1..c3b880713b46a 100644 --- a/tests/mir-opt/single_use_consts.assign_const_to_return.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.assign_const_to_return.GVN.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `assign_const_to_return` before SingleUseConsts -+ // MIR for `assign_const_to_return` after SingleUseConsts +- // MIR for `assign_const_to_return` before GVN ++ // MIR for `assign_const_to_return` after GVN fn assign_const_to_return() -> bool { let mut _0: bool; diff --git a/tests/mir-opt/single_use_consts.if_const.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.if_const.GVN.panic-abort.diff similarity index 75% rename from tests/mir-opt/single_use_consts.if_const.SingleUseConsts.panic-abort.diff rename to tests/mir-opt/single_use_consts.if_const.GVN.panic-abort.diff index 468076e5ee3ce..06fb7bee321a9 100644 --- a/tests/mir-opt/single_use_consts.if_const.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.if_const.GVN.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `if_const` before SingleUseConsts -+ // MIR for `if_const` after SingleUseConsts +- // MIR for `if_const` before GVN ++ // MIR for `if_const` after GVN fn if_const() -> i32 { let mut _0: i32; @@ -7,9 +7,8 @@ bb0: { StorageLive(_1); -- _1 = const ::ASSOC_BOOL; + _1 = const ::ASSOC_BOOL; - switchInt(move _1) -> [0: bb2, otherwise: bb1]; -+ nop; + switchInt(const ::ASSOC_BOOL) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/single_use_consts.if_const.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.if_const.GVN.panic-unwind.diff similarity index 75% rename from tests/mir-opt/single_use_consts.if_const.SingleUseConsts.panic-unwind.diff rename to tests/mir-opt/single_use_consts.if_const.GVN.panic-unwind.diff index 468076e5ee3ce..06fb7bee321a9 100644 --- a/tests/mir-opt/single_use_consts.if_const.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.if_const.GVN.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `if_const` before SingleUseConsts -+ // MIR for `if_const` after SingleUseConsts +- // MIR for `if_const` before GVN ++ // MIR for `if_const` after GVN fn if_const() -> i32 { let mut _0: i32; @@ -7,9 +7,8 @@ bb0: { StorageLive(_1); -- _1 = const ::ASSOC_BOOL; + _1 = const ::ASSOC_BOOL; - switchInt(move _1) -> [0: bb2, otherwise: bb1]; -+ nop; + switchInt(const ::ASSOC_BOOL) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.if_const_debug.GVN.panic-abort.diff similarity index 68% rename from tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-abort.diff rename to tests/mir-opt/single_use_consts.if_const_debug.GVN.panic-abort.diff index 0269c2cba202d..931edfdc683bf 100644 --- a/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.if_const_debug.GVN.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `if_const_debug` before SingleUseConsts -+ // MIR for `if_const_debug` after SingleUseConsts +- // MIR for `if_const_debug` before GVN ++ // MIR for `if_const_debug` after GVN fn if_const_debug() -> i32 { let mut _0: i32; @@ -12,9 +12,9 @@ } bb0: { - StorageLive(_1); -- _1 = const ::ASSOC_BOOL; +- StorageLive(_1); + nop; + _1 = const ::ASSOC_BOOL; StorageLive(_2); _2 = do_whatever() -> [return: bb1, unwind unreachable]; } @@ -23,8 +23,9 @@ StorageDead(_2); StorageLive(_3); - _3 = copy _1; +- switchInt(move _3) -> [0: bb3, otherwise: bb2]; + _3 = const ::ASSOC_BOOL; - switchInt(move _3) -> [0: bb3, otherwise: bb2]; ++ switchInt(const ::ASSOC_BOOL) -> [0: bb3, otherwise: bb2]; } bb2: { @@ -39,7 +40,8 @@ bb4: { StorageDead(_3); - StorageDead(_1); +- StorageDead(_1); ++ nop; return; } } diff --git a/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.if_const_debug.GVN.panic-unwind.diff similarity index 68% rename from tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-unwind.diff rename to tests/mir-opt/single_use_consts.if_const_debug.GVN.panic-unwind.diff index 1285b8b33ba2d..8105a484abe55 100644 --- a/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.if_const_debug.GVN.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `if_const_debug` before SingleUseConsts -+ // MIR for `if_const_debug` after SingleUseConsts +- // MIR for `if_const_debug` before GVN ++ // MIR for `if_const_debug` after GVN fn if_const_debug() -> i32 { let mut _0: i32; @@ -12,9 +12,9 @@ } bb0: { - StorageLive(_1); -- _1 = const ::ASSOC_BOOL; +- StorageLive(_1); + nop; + _1 = const ::ASSOC_BOOL; StorageLive(_2); _2 = do_whatever() -> [return: bb1, unwind continue]; } @@ -23,8 +23,9 @@ StorageDead(_2); StorageLive(_3); - _3 = copy _1; +- switchInt(move _3) -> [0: bb3, otherwise: bb2]; + _3 = const ::ASSOC_BOOL; - switchInt(move _3) -> [0: bb3, otherwise: bb2]; ++ switchInt(const ::ASSOC_BOOL) -> [0: bb3, otherwise: bb2]; } bb2: { @@ -39,7 +40,8 @@ bb4: { StorageDead(_3); - StorageDead(_1); +- StorageDead(_1); ++ nop; return; } } diff --git a/tests/mir-opt/single_use_consts.keep_parameter.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.keep_parameter.GVN.panic-abort.diff similarity index 66% rename from tests/mir-opt/single_use_consts.keep_parameter.SingleUseConsts.panic-abort.diff rename to tests/mir-opt/single_use_consts.keep_parameter.GVN.panic-abort.diff index f7d823af9e3d7..5eb75bc5d0267 100644 --- a/tests/mir-opt/single_use_consts.keep_parameter.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.keep_parameter.GVN.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `keep_parameter` before SingleUseConsts -+ // MIR for `keep_parameter` after SingleUseConsts +- // MIR for `keep_parameter` before GVN ++ // MIR for `keep_parameter` after GVN fn keep_parameter(_1: i32) -> () { debug other => _1; diff --git a/tests/mir-opt/single_use_consts.keep_parameter.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.keep_parameter.GVN.panic-unwind.diff similarity index 66% rename from tests/mir-opt/single_use_consts.keep_parameter.SingleUseConsts.panic-unwind.diff rename to tests/mir-opt/single_use_consts.keep_parameter.GVN.panic-unwind.diff index f7d823af9e3d7..5eb75bc5d0267 100644 --- a/tests/mir-opt/single_use_consts.keep_parameter.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.keep_parameter.GVN.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `keep_parameter` before SingleUseConsts -+ // MIR for `keep_parameter` after SingleUseConsts +- // MIR for `keep_parameter` before GVN ++ // MIR for `keep_parameter` after GVN fn keep_parameter(_1: i32) -> () { debug other => _1; diff --git a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.match_const.GVN.panic-abort.diff similarity index 84% rename from tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff rename to tests/mir-opt/single_use_consts.match_const.GVN.panic-abort.diff index 1ba5e47b81b65..22d574eb23e99 100644 --- a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.match_const.GVN.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `match_const` before SingleUseConsts -+ // MIR for `match_const` after SingleUseConsts +- // MIR for `match_const` before GVN ++ // MIR for `match_const` after GVN fn match_const() -> &str { let mut _0: &str; @@ -7,9 +7,8 @@ bb0: { StorageLive(_1); -- _1 = const ::ASSOC_INT; + _1 = const ::ASSOC_INT; - switchInt(copy _1) -> [7: bb3, 42: bb2, otherwise: bb1]; -+ nop; + switchInt(const ::ASSOC_INT) -> [7: bb3, 42: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.match_const.GVN.panic-unwind.diff similarity index 84% rename from tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff rename to tests/mir-opt/single_use_consts.match_const.GVN.panic-unwind.diff index 1ba5e47b81b65..22d574eb23e99 100644 --- a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.match_const.GVN.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `match_const` before SingleUseConsts -+ // MIR for `match_const` after SingleUseConsts +- // MIR for `match_const` before GVN ++ // MIR for `match_const` after GVN fn match_const() -> &str { let mut _0: &str; @@ -7,9 +7,8 @@ bb0: { StorageLive(_1); -- _1 = const ::ASSOC_INT; + _1 = const ::ASSOC_INT; - switchInt(copy _1) -> [7: bb3, 42: bb2, otherwise: bb1]; -+ nop; + switchInt(const ::ASSOC_INT) -> [7: bb3, 42: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.match_const_debug.GVN.panic-abort.diff similarity index 87% rename from tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff rename to tests/mir-opt/single_use_consts.match_const_debug.GVN.panic-abort.diff index e0fabe5a90e47..10c7f8fd7f38e 100644 --- a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.match_const_debug.GVN.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `match_const_debug` before SingleUseConsts -+ // MIR for `match_const_debug` after SingleUseConsts +- // MIR for `match_const_debug` before GVN ++ // MIR for `match_const_debug` after GVN fn match_const_debug() -> &str { let mut _0: &str; @@ -12,8 +12,7 @@ bb0: { StorageLive(_1); -- _1 = const ::ASSOC_INT; -+ nop; + _1 = const ::ASSOC_INT; StorageLive(_2); _2 = do_whatever() -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.match_const_debug.GVN.panic-unwind.diff similarity index 87% rename from tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff rename to tests/mir-opt/single_use_consts.match_const_debug.GVN.panic-unwind.diff index 26799ae662938..b6936d5fe4e52 100644 --- a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.match_const_debug.GVN.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `match_const_debug` before SingleUseConsts -+ // MIR for `match_const_debug` after SingleUseConsts +- // MIR for `match_const_debug` before GVN ++ // MIR for `match_const_debug` after GVN fn match_const_debug() -> &str { let mut _0: &str; @@ -12,8 +12,7 @@ bb0: { StorageLive(_1); -- _1 = const ::ASSOC_INT; -+ nop; + _1 = const ::ASSOC_INT; StorageLive(_2); _2 = do_whatever() -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/single_use_consts.never_used_debug.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.never_used_debug.GVN.panic-abort.diff similarity index 64% rename from tests/mir-opt/single_use_consts.never_used_debug.SingleUseConsts.panic-abort.diff rename to tests/mir-opt/single_use_consts.never_used_debug.GVN.panic-abort.diff index 8ef94a790a343..f5f877414cb49 100644 --- a/tests/mir-opt/single_use_consts.never_used_debug.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.never_used_debug.GVN.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `never_used_debug` before SingleUseConsts -+ // MIR for `never_used_debug` after SingleUseConsts +- // MIR for `never_used_debug` before GVN ++ // MIR for `never_used_debug` after GVN fn never_used_debug() -> () { let mut _0: (); @@ -11,8 +11,7 @@ bb0: { StorageLive(_1); -- _1 = const ::ASSOC_INT; -+ nop; + _1 = const ::ASSOC_INT; _0 = const (); StorageDead(_1); return; diff --git a/tests/mir-opt/single_use_consts.never_used_debug.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.never_used_debug.GVN.panic-unwind.diff similarity index 64% rename from tests/mir-opt/single_use_consts.never_used_debug.SingleUseConsts.panic-unwind.diff rename to tests/mir-opt/single_use_consts.never_used_debug.GVN.panic-unwind.diff index 8ef94a790a343..f5f877414cb49 100644 --- a/tests/mir-opt/single_use_consts.never_used_debug.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.never_used_debug.GVN.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `never_used_debug` before SingleUseConsts -+ // MIR for `never_used_debug` after SingleUseConsts +- // MIR for `never_used_debug` before GVN ++ // MIR for `never_used_debug` after GVN fn never_used_debug() -> () { let mut _0: (); @@ -11,8 +11,7 @@ bb0: { StorageLive(_1); -- _1 = const ::ASSOC_INT; -+ nop; + _1 = const ::ASSOC_INT; _0 = const (); StorageDead(_1); return; diff --git a/tests/mir-opt/single_use_consts.rs b/tests/mir-opt/single_use_consts.rs index ecb602c647a50..a4bf9a721d2f5 100644 --- a/tests/mir-opt/single_use_consts.rs +++ b/tests/mir-opt/single_use_consts.rs @@ -1,4 +1,4 @@ -//@ test-mir-pass: SingleUseConsts +//@ test-mir-pass: GVN //@ compile-flags: -C debuginfo=full // EMIT_MIR_FOR_EACH_PANIC_STRATEGY @@ -7,14 +7,14 @@ trait MyTrait { const ASSOC_INT: i32; } -// EMIT_MIR single_use_consts.if_const.SingleUseConsts.diff +// EMIT_MIR single_use_consts.if_const.GVN.diff fn if_const() -> i32 { // CHECK-LABEL: fn if_const( // CHECK: switchInt(const ::ASSOC_BOOL) if T::ASSOC_BOOL { 7 } else { 42 } } -// EMIT_MIR single_use_consts.match_const.SingleUseConsts.diff +// EMIT_MIR single_use_consts.match_const.GVN.diff fn match_const() -> &'static str { // CHECK-LABEL: fn match_const( // CHECK: switchInt(const ::ASSOC_INT) @@ -25,22 +25,20 @@ fn match_const() -> &'static str { } } -// EMIT_MIR single_use_consts.if_const_debug.SingleUseConsts.diff +// EMIT_MIR single_use_consts.if_const_debug.GVN.diff fn if_const_debug() -> i32 { // CHECK-LABEL: fn if_const_debug( - // CHECK: my_bool => const ::ASSOC_BOOL; - // FIXME: `if` forces a temporary (unlike `match`), so the const isn't direct - // CHECK: _3 = const ::ASSOC_BOOL; - // CHECK: switchInt(move _3) + // CHECK: debug my_bool => const ::ASSOC_BOOL; + // CHECK: switchInt(const ::ASSOC_BOOL) let my_bool = T::ASSOC_BOOL; do_whatever(); if my_bool { 7 } else { 42 } } -// EMIT_MIR single_use_consts.match_const_debug.SingleUseConsts.diff +// EMIT_MIR single_use_consts.match_const_debug.GVN.diff fn match_const_debug() -> &'static str { // CHECK-LABEL: fn match_const_debug( - // CHECK: my_int => const ::ASSOC_INT; + // CHECK: debug my_int => const ::ASSOC_INT; // CHECK: switchInt(const ::ASSOC_INT) let my_int = T::ASSOC_INT; do_whatever(); @@ -51,25 +49,22 @@ fn match_const_debug() -> &'static str { } } -// EMIT_MIR single_use_consts.never_used_debug.SingleUseConsts.diff +// EMIT_MIR single_use_consts.never_used_debug.GVN.diff #[allow(unused_variables)] fn never_used_debug() { // CHECK-LABEL: fn never_used_debug( - // CHECK: my_int => const ::ASSOC_INT; - // CHECK-NOT: ASSOC_INT - // CHECK: nop - // CHECK-NOT: ASSOC_INT + // CHECK: debug my_int => const ::ASSOC_INT; let my_int = T::ASSOC_INT; } -// EMIT_MIR single_use_consts.assign_const_to_return.SingleUseConsts.diff +// EMIT_MIR single_use_consts.assign_const_to_return.GVN.diff fn assign_const_to_return() -> bool { // CHECK-LABEL: fn assign_const_to_return( // CHECK: _0 = const ::ASSOC_BOOL; T::ASSOC_BOOL } -// EMIT_MIR single_use_consts.keep_parameter.SingleUseConsts.diff +// EMIT_MIR single_use_consts.keep_parameter.GVN.diff fn keep_parameter(mut other: i32) { // CHECK-LABEL: fn keep_parameter( // CHECK: _1 = const ::ASSOC_INT;