diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index 635ed6c8e88b1..aa2e36288d991 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -196,8 +196,7 @@ pub(crate) fn codegen_const_value<'tcx>( .offset_i64(fx, i64::try_from(offset.bytes()).unwrap()), layout, ), - ConstValue::Slice { data, meta } => { - let alloc_id = fx.tcx.reserve_and_set_memory_alloc(data); + ConstValue::Slice { alloc_id, meta, phantom: _ } => { let ptr = pointer_for_allocation(fx, alloc_id).get_addr(fx); let len = fx.bcx.ins().iconst(fx.pointer_type, meta as i64); CValue::by_val_pair(ptr, len, layout) diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 932926976b58d..adca3c993ee20 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -100,14 +100,11 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { OperandValue::Immediate(llval) } ConstValue::ZeroSized => return OperandRef::zero_sized(layout), - ConstValue::Slice { data, meta } => { + ConstValue::Slice { alloc_id, meta, phantom: _ } => { let Abi::ScalarPair(a_scalar, _) = layout.abi else { bug!("from_const: invalid ScalarPair layout: {:#?}", layout); }; - let a = Scalar::from_pointer( - Pointer::new(bx.tcx().reserve_and_set_memory_alloc(data).into(), Size::ZERO), - &bx.tcx(), - ); + let a = Scalar::from_pointer(Pointer::new(alloc_id.into(), Size::ZERO), &bx.tcx()); let a_llval = bx.scalar_to_backend( a, a_scalar, diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 4283ebc99d264..dbad317182a7b 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -210,10 +210,9 @@ pub(super) fn op_to_const<'tcx>( // We know `offset` is relative to the allocation, so we can use `into_parts`. let (prov, offset) = a.to_pointer(ecx).expect(msg).into_parts(); let alloc_id = prov.expect(msg).alloc_id(); - let data = ecx.tcx.global_alloc(alloc_id).unwrap_memory(); assert!(offset == abi::Size::ZERO, "{}", msg); let meta = b.to_target_usize(ecx).expect(msg); - ConstValue::Slice { data, meta } + ConstValue::Slice { alloc_id, meta, phantom: std::marker::PhantomData } } Immediate::Uninit => bug!("`Uninit` is not a valid value for {}", op.layout.ty), }, diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index a8478f721c71b..75af61be7d687 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -10,9 +10,7 @@ use rustc_middle::ty::{Ty, TyCtxt}; use rustc_middle::{ mir::{ self, - interpret::{ - Allocation, ConstAllocation, GlobalId, InterpResult, PointerArithmetic, Scalar, - }, + interpret::{AllocId, GlobalId, InterpResult, PointerArithmetic, Scalar}, BinOp, ConstValue, NonDivergingIntrinsic, }, ty::layout::TyAndLayout, @@ -28,10 +26,11 @@ use super::{ use crate::fluent_generated as fluent; /// Directly returns an `Allocation` containing an absolute path representation of the given type. -pub(crate) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ConstAllocation<'tcx> { +pub(crate) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> (AllocId, u64) { let path = crate::util::type_name(tcx, ty); - let alloc = Allocation::from_bytes_byte_aligned_immutable(path.into_bytes()); - tcx.mk_const_alloc(alloc) + let bytes = path.into_bytes(); + let len = bytes.len().try_into().unwrap(); + (tcx.allocate_bytes(bytes), len) } /// The logic for all nullary intrinsics is implemented here. These intrinsics don't get evaluated @@ -47,8 +46,8 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>( Ok(match name { sym::type_name => { ensure_monomorphic_enough(tcx, tp_ty)?; - let alloc = alloc_type_name(tcx, tp_ty); - ConstValue::Slice { data: alloc, meta: alloc.inner().size().bytes() } + let (alloc_id, len) = alloc_type_name(tcx, tp_ty); + ConstValue::Slice { alloc_id, meta: len, phantom: std::marker::PhantomData } } sym::needs_drop => { ensure_monomorphic_enough(tcx, tp_ty)?; diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index 842fb6d204c29..cdb6f79b4cdd6 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -780,9 +780,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } mir::ConstValue::Scalar(x) => adjust_scalar(x)?.into(), mir::ConstValue::ZeroSized => Immediate::Uninit, - mir::ConstValue::Slice { data, meta } => { + mir::ConstValue::Slice { alloc_id, meta, phantom: _ } => { // This is const data, no mutation allowed. - let alloc_id = self.tcx.reserve_and_set_memory_alloc(data); let ptr = Pointer::new(CtfeProvenance::from(alloc_id).as_immutable(), Size::ZERO); Immediate::new_slice(self.global_base_pointer(ptr)?.into(), meta, self) } diff --git a/compiler/rustc_middle/src/mir/consts.rs b/compiler/rustc_middle/src/mir/consts.rs index 155af06201273..56f4acdb150e8 100644 --- a/compiler/rustc_middle/src/mir/consts.rs +++ b/compiler/rustc_middle/src/mir/consts.rs @@ -5,7 +5,7 @@ use rustc_session::{config::RemapPathScopeComponents, RemapFileNameExt}; use rustc_span::{Span, DUMMY_SP}; use rustc_target::abi::{HasDataLayout, Size}; -use crate::mir::interpret::{alloc_range, AllocId, ConstAllocation, ErrorHandled, Scalar}; +use crate::mir::interpret::{alloc_range, AllocId, ErrorHandled, Scalar}; use crate::mir::{pretty_print_const_value, Promoted}; use crate::ty::print::with_no_trimmed_paths; use crate::ty::GenericArgsRef; @@ -28,8 +28,8 @@ pub struct ConstAlloc<'tcx> { /// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for /// array length computations, enum discriminants and the pattern matching logic. -#[derive(Copy, Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash)] -#[derive(HashStable, Lift)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Lift, Hash)] +#[derive(HashStable)] pub enum ConstValue<'tcx> { /// Used for types with `layout::abi::Scalar` ABI. /// @@ -48,10 +48,11 @@ pub enum ConstValue<'tcx> { Slice { /// The allocation storing the slice contents. /// This always points to the beginning of the allocation. - data: ConstAllocation<'tcx>, + alloc_id: AllocId, /// The metadata field of the reference. /// This is a "target usize", so we use `u64` as in the interpreter. meta: u64, + phantom: std::marker::PhantomData<&'tcx ()>, }, /// A value not representable by the other variants; needs to be stored in-memory. @@ -73,7 +74,7 @@ pub enum ConstValue<'tcx> { #[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_pointer_width = "64"))] static_assert_size!(ConstValue<'_>, 24); -impl<'tcx> ConstValue<'tcx> { +impl ConstValue<'_> { #[inline] pub fn try_to_scalar(&self) -> Option { match *self { @@ -94,11 +95,11 @@ impl<'tcx> ConstValue<'tcx> { self.try_to_scalar_int()?.try_into().ok() } - pub fn try_to_target_usize(&self, tcx: TyCtxt<'tcx>) -> Option { + pub fn try_to_target_usize(&self, tcx: TyCtxt<'_>) -> Option { self.try_to_scalar_int()?.try_to_target_usize(tcx).ok() } - pub fn try_to_bits_for_ty( + pub fn try_to_bits_for_ty<'tcx>( &self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -125,12 +126,15 @@ impl<'tcx> ConstValue<'tcx> { } /// Must only be called on constants of type `&str` or `&[u8]`! - pub fn try_get_slice_bytes_for_diagnostics(&self, tcx: TyCtxt<'tcx>) -> Option<&'tcx [u8]> { - let (data, start, end) = match self { + pub fn try_get_slice_bytes_for_diagnostics<'tcx>( + &self, + tcx: TyCtxt<'tcx>, + ) -> Option<&'tcx [u8]> { + let (alloc_id, start, len) = match self { ConstValue::Scalar(_) | ConstValue::ZeroSized => { bug!("`try_get_slice_bytes` on non-slice constant") } - &ConstValue::Slice { data, meta } => (data, 0, meta), + &ConstValue::Slice { alloc_id, meta, phantom: _ } => (alloc_id, 0, meta), &ConstValue::Indirect { alloc_id, offset } => { // The reference itself is stored behind an indirection. // Load the reference, and then load the actual slice contents. @@ -162,26 +166,29 @@ impl<'tcx> ConstValue<'tcx> { } // Non-empty slice, must have memory. We know this is a relative pointer. let (inner_prov, offset) = ptr.into_parts(); - let data = tcx.global_alloc(inner_prov?.alloc_id()).unwrap_memory(); - (data, offset.bytes(), offset.bytes() + len) + (inner_prov?.alloc_id(), offset.bytes(), offset.bytes() + len) } }; + let data = tcx.global_alloc(alloc_id).unwrap_memory(); + // This is for diagnostics only, so we are okay to use `inspect_with_uninit_and_ptr_outside_interpreter`. let start = start.try_into().unwrap(); - let end = end.try_into().unwrap(); + let end = start + usize::try_from(len).unwrap(); Some(data.inner().inspect_with_uninit_and_ptr_outside_interpreter(start..end)) } /// Check if a constant may contain provenance information. This is used by MIR opts. /// Can return `true` even if there is no provenance. - pub fn may_have_provenance(&self, tcx: TyCtxt<'tcx>, size: Size) -> bool { + pub fn may_have_provenance(&self, tcx: TyCtxt<'_>, size: Size) -> bool { match *self { ConstValue::ZeroSized | ConstValue::Scalar(Scalar::Int(_)) => return false, ConstValue::Scalar(Scalar::Ptr(..)) => return true, // It's hard to find out the part of the allocation we point to; // just conservatively check everything. - ConstValue::Slice { data, meta: _ } => !data.inner().provenance().ptrs().is_empty(), + ConstValue::Slice { alloc_id, meta: _, phantom: _ } => { + !tcx.global_alloc(alloc_id).unwrap_memory().inner().provenance().ptrs().is_empty() + } ConstValue::Indirect { alloc_id, offset } => !tcx .global_alloc(alloc_id) .unwrap_memory() @@ -424,9 +431,8 @@ impl<'tcx> Const<'tcx> { /// taking into account even pointer identity tests. pub fn is_deterministic(&self) -> bool { // Some constants may generate fresh allocations for pointers they contain, - // so using the same constant twice can yield two different results: - // - valtrees purposefully generate new allocations - // - ConstValue::Slice also generate new allocations + // so using the same constant twice can yield two different results. + // Notably, valtrees purposefully generate new allocations. match self { Const::Ty(c) => match c.kind() { ty::ConstKind::Param(..) => true, @@ -444,11 +450,11 @@ impl<'tcx> Const<'tcx> { | ty::ConstKind::Placeholder(..) => bug!(), }, Const::Unevaluated(..) => false, - // If the same slice appears twice in the MIR, we cannot guarantee that we will - // give the same `AllocId` to the data. - Const::Val(ConstValue::Slice { .. }, _) => false, Const::Val( - ConstValue::ZeroSized | ConstValue::Scalar(_) | ConstValue::Indirect { .. }, + ConstValue::Slice { .. } + | ConstValue::ZeroSized + | ConstValue::Scalar(_) + | ConstValue::Indirect { .. }, _, ) => true, } diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 41df2e3b5875a..f88fa358032a4 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -1360,11 +1360,7 @@ pub fn write_allocations<'tcx>( } ConstValue::Scalar(interpret::Scalar::Int { .. }) => Either::Right(std::iter::empty()), ConstValue::ZeroSized => Either::Right(std::iter::empty()), - ConstValue::Slice { .. } => { - // `u8`/`str` slices, shouldn't contain pointers that we want to print. - Either::Right(std::iter::empty()) - } - ConstValue::Indirect { alloc_id, .. } => { + ConstValue::Slice { alloc_id, .. } | ConstValue::Indirect { alloc_id, .. } => { // FIXME: we don't actually want to print all of these, since some are printed nicely directly as values inline in MIR. // Really we'd want `pretty_print_const_value` to decide which allocations to print, instead of having a separate visitor. Either::Left(std::iter::once(alloc_id)) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 1db9bce73a6a8..7a8259e0b920a 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -72,7 +72,7 @@ use rustc_type_ir::TyKind::*; use rustc_type_ir::WithCachedTypeInfo; use rustc_type_ir::{CollectAndApply, Interner, TypeFlags}; -use std::borrow::Borrow; +use std::borrow::{Borrow, Cow}; use std::cmp::Ordering; use std::fmt; use std::hash::{Hash, Hasher}; @@ -866,7 +866,7 @@ impl<'tcx> TyCtxt<'tcx> { } /// Allocates a read-only byte or string literal for `mir::interpret`. - pub fn allocate_bytes(self, bytes: &[u8]) -> interpret::AllocId { + pub fn allocate_bytes<'a>(self, bytes: impl Into>) -> interpret::AllocId { // Create an allocation that just contains these bytes. let alloc = interpret::Allocation::from_bytes_byte_aligned_immutable(bytes); let alloc = self.mk_const_alloc(alloc); diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 8231c0214cb71..2141e58bea7e0 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -16,6 +16,7 @@ use rustc_target::abi::TyAndLayout; use rustc_type_ir::{ConstKind, DebugWithInfcx, InferCtxtLike, WithInfcx}; use std::fmt::{self, Debug}; +use std::marker::PhantomData; use super::print::PrettyPrinter; use super::{GenericArg, GenericArgKind, Region}; @@ -459,6 +460,13 @@ TrivialTypeTraversalAndLiftImpls! { /////////////////////////////////////////////////////////////////////////// // Lift implementations +impl<'tcx> Lift<'tcx> for PhantomData<&()> { + type Lifted = PhantomData<&'tcx ()>; + fn lift_to_tcx(self, _: TyCtxt<'tcx>) -> Option { + Some(PhantomData) + } +} + impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { type Lifted = Option; fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option { diff --git a/compiler/rustc_mir_build/src/build/expr/as_constant.rs b/compiler/rustc_mir_build/src/build/expr/as_constant.rs index a557f61b016bc..61928e0c31a9f 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_constant.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_constant.rs @@ -3,13 +3,14 @@ use crate::build::{parse_float_into_constval, Builder}; use rustc_ast as ast; use rustc_middle::mir; -use rustc_middle::mir::interpret::{Allocation, LitToConstError, LitToConstInput, Scalar}; +use rustc_middle::mir::interpret::{LitToConstError, LitToConstInput, Scalar}; use rustc_middle::mir::*; use rustc_middle::thir::*; use rustc_middle::ty::{ self, CanonicalUserType, CanonicalUserTypeAnnotation, TyCtxt, UserTypeAnnotationIndex, }; use rustc_target::abi::Size; +use std::marker::PhantomData; impl<'a, 'tcx> Builder<'a, 'tcx> { /// Compile `expr`, yielding a compile-time constant. Assumes that @@ -124,27 +125,39 @@ fn lit_to_mir_constant<'tcx>( let value = match (lit, &ty.kind()) { (ast::LitKind::Str(s, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_str() => { - let s = s.as_str(); - let allocation = Allocation::from_bytes_byte_aligned_immutable(s.as_bytes()); - let allocation = tcx.mk_const_alloc(allocation); - ConstValue::Slice { data: allocation, meta: allocation.inner().size().bytes() } + let s = s.as_str().as_bytes(); + let len = s.len(); + let allocation = tcx.allocate_bytes(s); + ConstValue::Slice { + alloc_id: allocation, + meta: len.try_into().unwrap(), + phantom: PhantomData, + } } (ast::LitKind::ByteStr(data, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Slice(_)) => { - let allocation = Allocation::from_bytes_byte_aligned_immutable(data as &[u8]); - let allocation = tcx.mk_const_alloc(allocation); - ConstValue::Slice { data: allocation, meta: allocation.inner().size().bytes() } + let len = data.len(); + let allocation = tcx.allocate_bytes(&**data); + ConstValue::Slice { + alloc_id: allocation, + meta: len.try_into().unwrap(), + phantom: PhantomData, + } } (ast::LitKind::ByteStr(data, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_array() => { - let id = tcx.allocate_bytes(data); + let id = tcx.allocate_bytes(&**data); ConstValue::Scalar(Scalar::from_pointer(id.into(), &tcx)) } (ast::LitKind::CStr(data, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Adt(def, _) if Some(def.did()) == tcx.lang_items().c_str()) => { - let allocation = Allocation::from_bytes_byte_aligned_immutable(data as &[u8]); - let allocation = tcx.mk_const_alloc(allocation); - ConstValue::Slice { data: allocation, meta: allocation.inner().size().bytes() } + let len = data.len(); + let allocation = tcx.allocate_bytes(&**data); + ConstValue::Slice { + alloc_id: allocation, + meta: len.try_into().unwrap(), + phantom: PhantomData, + } } (ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => { ConstValue::Scalar(Scalar::from_uint(*n, Size::from_bytes(1))) diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 0c35f9838ed3f..4ee9b415c070b 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -1496,10 +1496,8 @@ fn collect_const_value<'tcx>( collect_alloc(tcx, ptr.provenance.alloc_id(), output) } mir::ConstValue::Indirect { alloc_id, .. } => collect_alloc(tcx, alloc_id, output), - mir::ConstValue::Slice { data, meta: _ } => { - for &prov in data.inner().provenance().ptrs().values() { - collect_alloc(tcx, prov.alloc_id(), output); - } + mir::ConstValue::Slice { alloc_id, meta: _, phantom: _ } => { + collect_alloc(tcx, alloc_id, output); } _ => {} } diff --git a/compiler/rustc_smir/src/rustc_smir/alloc.rs b/compiler/rustc_smir/src/rustc_smir/alloc.rs index 5d02e3d6e9213..5a8ae0647ffc8 100644 --- a/compiler/rustc_smir/src/rustc_smir/alloc.rs +++ b/compiler/rustc_smir/src/rustc_smir/alloc.rs @@ -59,8 +59,7 @@ pub fn try_new_allocation<'tcx>( .align; new_empty_allocation(align.abi) } - ConstValue::Slice { data, meta } => { - let alloc_id = tables.tcx.reserve_and_set_memory_alloc(data); + ConstValue::Slice { alloc_id, meta, phantom: _ } => { let ptr = Pointer::new(alloc_id.into(), rustc_target::abi::Size::ZERO); let scalar_ptr = rustc_middle::mir::interpret::Scalar::from_pointer(ptr, &tables.tcx); let scalar_meta = diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index 19a777cb03bc7..980da368d2f7b 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -80,3 +80,7 @@ fn main() -> () { resume; } } + +ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic +} diff --git a/tests/mir-opt/building/match/sort_candidates.rs b/tests/mir-opt/building/match/sort_candidates.rs index a2583ff828484..1dd5be0cfe5af 100644 --- a/tests/mir-opt/building/match/sort_candidates.rs +++ b/tests/mir-opt/building/match/sort_candidates.rs @@ -7,8 +7,8 @@ fn constant_eq(s: &str, b: bool) -> u32 { // CHECK-LABEL: fn constant_eq( // CHECK: bb0: { - // CHECK: [[a:_.*]] = const "a"; - // CHECK-NOT: {{_.*}} = const "a"; + // CHECK: const "a" + // CHECK-NOT: const "a" match (s, b) { ("a", _) if true => 1, ("b", true) => 2, diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir b/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir index 683f63065f76b..740861f0937ef 100644 --- a/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir +++ b/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir @@ -198,3 +198,7 @@ static XXX: &Foo = { return; } } + +ALLOC0 (size: 2, align: 1) { + 68 69 │ hi +} diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff index c1529dbee13cb..270df07162352 100644 --- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff +++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff @@ -113,3 +113,7 @@ 01 00 63 00 │ ..c. } + ALLOC2 (size: 13, align: 1) { + 68 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 │ hello, world! + } + diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff index 886f9a68dd9d1..442997f6cd493 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff @@ -23,3 +23,7 @@ } } + ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic + } + diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff index cc53b213397d8..8254b0f3b0a67 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff @@ -23,3 +23,7 @@ } } + ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic + } + diff --git a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination-initial.diff b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination-initial.diff index 5a55028587124..8e224e0533a51 100644 --- a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination-initial.diff +++ b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination-initial.diff @@ -17,3 +17,11 @@ } } + ALLOC0 (size: 5, align: 1) { + 57 6f 72 6c 64 │ World + } + + ALLOC1 (size: 5, align: 1) { + 48 65 6c 6c 6f │ Hello + } + diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff index 7ae1fae68e887..4d76756f6f999 100644 --- a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff @@ -16,15 +16,19 @@ bb0: { _7 = (const "a",); - _1 = (_7.0: &str) as u128 (Transmute); - _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind unreachable]; +- _1 = (_7.0: &str) as u128 (Transmute); +- _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind unreachable]; ++ _1 = const "a" as u128 (Transmute); ++ _5 = identity::<&str>(const "a") -> [return: bb1, unwind unreachable]; } bb1: { _3 = _5 as u128 (Transmute); _8 = const "a"; - _2 = _8 as u128 (Transmute); - _6 = identity::<&str>(_8) -> [return: bb2, unwind unreachable]; +- _2 = _8 as u128 (Transmute); +- _6 = identity::<&str>(_8) -> [return: bb2, unwind unreachable]; ++ _2 = const "a" as u128 (Transmute); ++ _6 = identity::<&str>(const "a") -> [return: bb2, unwind unreachable]; } bb2: { @@ -36,3 +40,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 61 │ a + } + + ALLOC1 (size: 1, align: 1) { + 61 │ a + } + diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff index 8c96edaa280ea..06f72b1e5fdfd 100644 --- a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff @@ -16,15 +16,19 @@ bb0: { _7 = (const "a",); - _1 = (_7.0: &str) as u128 (Transmute); - _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind continue]; +- _1 = (_7.0: &str) as u128 (Transmute); +- _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind continue]; ++ _1 = const "a" as u128 (Transmute); ++ _5 = identity::<&str>(const "a") -> [return: bb1, unwind continue]; } bb1: { _3 = _5 as u128 (Transmute); _8 = const "a"; - _2 = _8 as u128 (Transmute); - _6 = identity::<&str>(_8) -> [return: bb2, unwind continue]; +- _2 = _8 as u128 (Transmute); +- _6 = identity::<&str>(_8) -> [return: bb2, unwind continue]; ++ _2 = const "a" as u128 (Transmute); ++ _6 = identity::<&str>(const "a") -> [return: bb2, unwind continue]; } bb2: { @@ -36,3 +40,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 61 │ a + } + + ALLOC1 (size: 1, align: 1) { + 61 │ a + } + diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff index 02bf95840dafb..f4b4d0df68d81 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff @@ -8,10 +8,10 @@ let mut _3: fn(u8) -> u8; let _5: (); let mut _6: fn(u8) -> u8; - let mut _9: {closure@$DIR/gvn.rs:610:19: 610:21}; + let mut _9: {closure@$DIR/gvn.rs:608:19: 608:21}; let _10: (); let mut _11: fn(); - let mut _13: {closure@$DIR/gvn.rs:610:19: 610:21}; + let mut _13: {closure@$DIR/gvn.rs:608:19: 608:21}; let _14: (); let mut _15: fn(); scope 1 { @@ -19,7 +19,7 @@ let _4: fn(u8) -> u8; scope 2 { debug g => _4; - let _7: {closure@$DIR/gvn.rs:610:19: 610:21}; + let _7: {closure@$DIR/gvn.rs:608:19: 608:21}; scope 3 { debug closure => _7; let _8: fn(); @@ -62,16 +62,16 @@ StorageDead(_6); StorageDead(_5); - StorageLive(_7); -- _7 = {closure@$DIR/gvn.rs:610:19: 610:21}; +- _7 = {closure@$DIR/gvn.rs:608:19: 608:21}; - StorageLive(_8); + nop; -+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21}; ++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21}; + nop; StorageLive(_9); - _9 = _7; - _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Normal))); -+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21}; -+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21} as fn() (PointerCoercion(ClosureFnPointer(Normal))); ++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21}; ++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21} as fn() (PointerCoercion(ClosureFnPointer(Normal))); StorageDead(_9); StorageLive(_10); StorageLive(_11); @@ -88,8 +88,8 @@ StorageLive(_13); - _13 = _7; - _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Normal))); -+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21}; -+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21} as fn() (PointerCoercion(ClosureFnPointer(Normal))); ++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21}; ++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21} as fn() (PointerCoercion(ClosureFnPointer(Normal))); StorageDead(_13); StorageLive(_14); StorageLive(_15); diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff index c5dcc8a8ec9d8..58592d268cfe3 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff @@ -8,10 +8,10 @@ let mut _3: fn(u8) -> u8; let _5: (); let mut _6: fn(u8) -> u8; - let mut _9: {closure@$DIR/gvn.rs:610:19: 610:21}; + let mut _9: {closure@$DIR/gvn.rs:608:19: 608:21}; let _10: (); let mut _11: fn(); - let mut _13: {closure@$DIR/gvn.rs:610:19: 610:21}; + let mut _13: {closure@$DIR/gvn.rs:608:19: 608:21}; let _14: (); let mut _15: fn(); scope 1 { @@ -19,7 +19,7 @@ let _4: fn(u8) -> u8; scope 2 { debug g => _4; - let _7: {closure@$DIR/gvn.rs:610:19: 610:21}; + let _7: {closure@$DIR/gvn.rs:608:19: 608:21}; scope 3 { debug closure => _7; let _8: fn(); @@ -62,16 +62,16 @@ StorageDead(_6); StorageDead(_5); - StorageLive(_7); -- _7 = {closure@$DIR/gvn.rs:610:19: 610:21}; +- _7 = {closure@$DIR/gvn.rs:608:19: 608:21}; - StorageLive(_8); + nop; -+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21}; ++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21}; + nop; StorageLive(_9); - _9 = _7; - _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Normal))); -+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21}; -+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21} as fn() (PointerCoercion(ClosureFnPointer(Normal))); ++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21}; ++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21} as fn() (PointerCoercion(ClosureFnPointer(Normal))); StorageDead(_9); StorageLive(_10); StorageLive(_11); @@ -88,8 +88,8 @@ StorageLive(_13); - _13 = _7; - _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Normal))); -+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21}; -+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:610:19: 610:21} as fn() (PointerCoercion(ClosureFnPointer(Normal))); ++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21}; ++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:608:19: 608:21} as fn() (PointerCoercion(ClosureFnPointer(Normal))); StorageDead(_13); StorageLive(_14); StorageLive(_15); diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index 6f4d1e35585bc..d0c044ec57936 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -523,10 +523,10 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S) { fn slices() { // CHECK-LABEL: fn slices( // CHECK: {{_.*}} = const " - // CHECK-NOT: {{_.*}} = const " - let s = "my favourite slice"; // This is a `Const::Slice` in MIR. + // CHECK: {{_.*}} = const " + let s = "my favourite slice"; opaque(s); - let t = s; // This should be the same pointer, so cannot be a `Const::Slice`. + let t = s; // This should be the same pointer. opaque(t); assert_eq!(s.as_ptr(), t.as_ptr()); let u = unsafe { transmute::<&str, &[u8]>(s) }; @@ -546,12 +546,12 @@ fn duplicate_slice() -> (bool, bool) { let d: &str; { // CHECK: [[a:_.*]] = (const "a",); - // CHECK: [[au:_.*]] = ([[a]].0: &str) as u128 (Transmute); + // CHECK: [[au:_.*]] = const "a" as u128 (Transmute); let a = ("a",); Call(au = transmute::<_, u128>(a.0), ReturnTo(bb1), UnwindContinue()) } bb1 = { - // CHECK: [[c:_.*]] = identity::<&str>(([[a]].0: &str)) + // CHECK: [[c:_.*]] = identity::<&str>(const "a") Call(c = identity(a.0), ReturnTo(bb2), UnwindContinue()) } bb2 = { @@ -559,15 +559,13 @@ fn duplicate_slice() -> (bool, bool) { Call(cu = transmute::<_, u128>(c), ReturnTo(bb3), UnwindContinue()) } bb3 = { - // This slice is different from `a.0`. Hence `bu` is not `au`. // CHECK: [[b:_.*]] = const "a"; - // CHECK: [[bu:_.*]] = [[b]] as u128 (Transmute); + // CHECK: [[bu:_.*]] = const "a" as u128 (Transmute); let b = "a"; Call(bu = transmute::<_, u128>(b), ReturnTo(bb4), UnwindContinue()) } bb4 = { - // This returns a copy of `b`, which is not `a`. - // CHECK: [[d:_.*]] = identity::<&str>([[b]]) + // CHECK: [[d:_.*]] = identity::<&str>(const "a") Call(d = identity(b), ReturnTo(bb5), UnwindContinue()) } bb5 = { diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff index 2389d98b5b3c5..81c694e51e753 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff @@ -87,22 +87,24 @@ _1 = const "my favourite slice"; StorageLive(_2); StorageLive(_3); - _3 = _1; +- _3 = _1; - _2 = opaque::<&str>(move _3) -> [return: bb1, unwind unreachable]; -+ _2 = opaque::<&str>(_1) -> [return: bb1, unwind unreachable]; ++ _3 = const "my favourite slice"; ++ _2 = opaque::<&str>(const "my favourite slice") -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_3); StorageDead(_2); StorageLive(_4); - _4 = _1; +- _4 = _1; ++ _4 = const "my favourite slice"; StorageLive(_5); StorageLive(_6); - _6 = _4; - _5 = opaque::<&str>(move _6) -> [return: bb2, unwind unreachable]; -+ _6 = _1; -+ _5 = opaque::<&str>(_1) -> [return: bb2, unwind unreachable]; ++ _6 = const "my favourite slice"; ++ _5 = opaque::<&str>(const "my favourite slice") -> [return: bb2, unwind unreachable]; } bb2: { @@ -305,3 +307,8 @@ } } + ALLOC0 (size: 18, align: 1) { + 0x00 │ 6d 79 20 66 61 76 6f 75 72 69 74 65 20 73 6c 69 │ my favourite sli + 0x10 │ 63 65 │ ce + } + diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff index 50715d748e796..8ab6aa4b1960c 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff @@ -87,22 +87,24 @@ _1 = const "my favourite slice"; StorageLive(_2); StorageLive(_3); - _3 = _1; +- _3 = _1; - _2 = opaque::<&str>(move _3) -> [return: bb1, unwind continue]; -+ _2 = opaque::<&str>(_1) -> [return: bb1, unwind continue]; ++ _3 = const "my favourite slice"; ++ _2 = opaque::<&str>(const "my favourite slice") -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); StorageDead(_2); StorageLive(_4); - _4 = _1; +- _4 = _1; ++ _4 = const "my favourite slice"; StorageLive(_5); StorageLive(_6); - _6 = _4; - _5 = opaque::<&str>(move _6) -> [return: bb2, unwind continue]; -+ _6 = _1; -+ _5 = opaque::<&str>(_1) -> [return: bb2, unwind continue]; ++ _6 = const "my favourite slice"; ++ _5 = opaque::<&str>(const "my favourite slice") -> [return: bb2, unwind continue]; } bb2: { @@ -305,3 +307,8 @@ } } + ALLOC0 (size: 18, align: 1) { + 0x00 │ 6d 79 20 66 61 76 6f 75 72 69 74 65 20 73 6c 69 │ my favourite sli + 0x10 │ 63 65 │ ce + } + diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff index a5c29c191ad5c..71a36a67b0032 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff @@ -47,3 +47,7 @@ } } + ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic + } + diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff index 6f2e52482716d..bb7431e078415 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff @@ -47,3 +47,7 @@ } } + ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic + } + diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff index d675695eb1047..7d1116d25ee4b 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff @@ -38,5 +38,9 @@ + StorageLive(_7); + _7 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; } ++ } ++ ++ ALLOC0 (size: 14, align: 1) { ++ 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic } diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff index 1142616115fb7..d125a51bc37e9 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff @@ -38,5 +38,9 @@ + StorageLive(_7); + _7 = begin_panic::<&str>(const "explicit panic") -> unwind continue; } ++ } ++ ++ ALLOC0 (size: 14, align: 1) { ++ 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic } diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff index b2539f391d1a5..f5139776ceff9 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -53,3 +53,9 @@ } } + ALLOC0 (size: 40, align: 1) { + 0x00 │ 69 6e 74 65 72 6e 61 6c 20 65 72 72 6f 72 3a 20 │ internal error: + 0x10 │ 65 6e 74 65 72 65 64 20 75 6e 72 65 61 63 68 61 │ entered unreacha + 0x20 │ 62 6c 65 20 63 6f 64 65 │ ble code + } + diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index ff7f12c093ce4..d9df7f88fc9a9 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -53,3 +53,9 @@ } } + ALLOC0 (size: 40, align: 1) { + 0x00 │ 69 6e 74 65 72 6e 61 6c 20 65 72 72 6f 72 3a 20 │ internal error: + 0x10 │ 65 6e 74 65 72 65 64 20 75 6e 72 65 61 63 68 61 │ entered unreacha + 0x20 │ 62 6c 65 20 63 6f 64 65 │ ble code + } + diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-abort.mir index fa6c6ce8e5750..6e5f6dc9ea899 100644 --- a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -36,3 +36,7 @@ fn unwrap(_1: Option) -> T { return; } } + +ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic +} diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index 54fec3c0f9847..758aa45f2a2b6 100644 --- a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -41,3 +41,7 @@ fn unwrap(_1: Option) -> T { resume; } } + +ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic +} diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir index 99a7a6b6154d5..404de884ab562 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir @@ -38,3 +38,5 @@ fn main() -> () { resume; } } + +ALLOC0 (size: 0, align: 1) {} diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir index 7364b329e123a..47a0878ffae1c 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir @@ -38,3 +38,5 @@ fn main() -> () { resume; } } + +ALLOC0 (size: 0, align: 1) {} 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 2865b829e3e54..62c565a387778 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 @@ -26,9 +26,8 @@ let mut _12: isize; let _13: std::alloc::AllocError; let mut _14: !; - let _15: &str; - let mut _16: &dyn std::fmt::Debug; - let mut _17: &std::alloc::AllocError; + let mut _15: &dyn std::fmt::Debug; + let mut _16: &std::alloc::AllocError; scope 7 { debug t => _5; } @@ -38,7 +37,7 @@ } scope 9 (inlined NonNull::<[u8]>::as_ptr) { debug self => _5; - let mut _18: *const [u8]; + let mut _17: *const [u8]; } } scope 3 (inlined #[track_caller] Option::::unwrap) { @@ -95,36 +94,33 @@ StorageDead(_8); StorageDead(_7); StorageLive(_12); - StorageLive(_15); _12 = discriminant(_6); switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { - _15 = const "called `Result::unwrap()` on an `Err` value"; + StorageLive(_15); StorageLive(_16); - StorageLive(_17); - _17 = &_13; - _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); - StorageDead(_17); - _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable; + _16 = &_13; + _15 = move _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); + StorageDead(_16); + _14 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _15) -> unwind unreachable; } bb6: { _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); - StorageDead(_15); StorageDead(_12); StorageDead(_6); -- StorageLive(_18); +- StorageLive(_17); + nop; - _18 = (_5.0: *const [u8]); -- _4 = move _18 as *mut [u8] (PtrToPtr); -- StorageDead(_18); -+ _4 = _18 as *mut [u8] (PtrToPtr); + _17 = (_5.0: *const [u8]); +- _4 = move _17 as *mut [u8] (PtrToPtr); +- StorageDead(_17); ++ _4 = _17 as *mut [u8] (PtrToPtr); + nop; StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); -+ _3 = _18 as *mut u8 (PtrToPtr); ++ _3 = _17 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); @@ -132,10 +128,17 @@ return; } } -+ + +- ALLOC0 (size: 43, align: 1) { + ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ + } + ++ ALLOC2 (size: 43, align: 1) { + 0x00 │ 63 61 6c 6c 65 64 20 60 52 65 73 75 6c 74 3a 3a │ called `Result:: + 0x10 │ 75 6e 77 72 61 70 28 29 60 20 6f 6e 20 61 6e 20 │ unwrap()` on an + 0x20 │ 60 45 72 72 60 20 76 61 6c 75 65 │ `Err` value + } ++ + ALLOC1 (size: 0, align: 1) {} 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 44964392dd658..1bba3875c511d 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 @@ -26,9 +26,8 @@ let mut _12: isize; let _13: std::alloc::AllocError; let mut _14: !; - let _15: &str; - let mut _16: &dyn std::fmt::Debug; - let mut _17: &std::alloc::AllocError; + let mut _15: &dyn std::fmt::Debug; + let mut _16: &std::alloc::AllocError; scope 7 { debug t => _5; } @@ -38,7 +37,7 @@ } scope 9 (inlined NonNull::<[u8]>::as_ptr) { debug self => _5; - let mut _18: *const [u8]; + let mut _17: *const [u8]; } } scope 3 (inlined #[track_caller] Option::::unwrap) { @@ -95,36 +94,33 @@ StorageDead(_8); StorageDead(_7); StorageLive(_12); - StorageLive(_15); _12 = discriminant(_6); switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { - _15 = const "called `Result::unwrap()` on an `Err` value"; + StorageLive(_15); StorageLive(_16); - StorageLive(_17); - _17 = &_13; - _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); - StorageDead(_17); - _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable; + _16 = &_13; + _15 = move _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); + StorageDead(_16); + _14 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _15) -> unwind unreachable; } bb6: { _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); - StorageDead(_15); StorageDead(_12); StorageDead(_6); -- StorageLive(_18); +- StorageLive(_17); + nop; - _18 = (_5.0: *const [u8]); -- _4 = move _18 as *mut [u8] (PtrToPtr); -- StorageDead(_18); -+ _4 = _18 as *mut [u8] (PtrToPtr); + _17 = (_5.0: *const [u8]); +- _4 = move _17 as *mut [u8] (PtrToPtr); +- StorageDead(_17); ++ _4 = _17 as *mut [u8] (PtrToPtr); + nop; StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); -+ _3 = _18 as *mut u8 (PtrToPtr); ++ _3 = _17 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); @@ -132,10 +128,17 @@ return; } } -+ + +- ALLOC0 (size: 43, align: 1) { + ALLOC0 (size: 16, align: 8) { + 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ + } + ++ ALLOC2 (size: 43, align: 1) { + 0x00 │ 63 61 6c 6c 65 64 20 60 52 65 73 75 6c 74 3a 3a │ called `Result:: + 0x10 │ 75 6e 77 72 61 70 28 29 60 20 6f 6e 20 61 6e 20 │ unwrap()` on an + 0x20 │ 60 45 72 72 60 20 76 61 6c 75 65 │ `Err` value + } ++ + ALLOC1 (size: 0, align: 1) {} diff --git a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff index a84048365a4ba..88e2e77cce875 100644 --- a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff @@ -75,3 +75,7 @@ } } + ALLOC0 (size: 1, align: 1) { + 61 │ a + } + diff --git a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff index e5dab5d52a6b7..08bda8c685972 100644 --- a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff @@ -113,3 +113,35 @@ } } + ALLOC0 (size: 1, align: 1) { + 44 │ D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC3 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + + ALLOC4 (size: 1, align: 1) { + 44 │ D + } + + ALLOC5 (size: 1, align: 1) { + 43 │ C + } + + ALLOC6 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC7 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff index e5dab5d52a6b7..08bda8c685972 100644 --- a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff @@ -113,3 +113,35 @@ } } + ALLOC0 (size: 1, align: 1) { + 44 │ D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC3 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + + ALLOC4 (size: 1, align: 1) { + 44 │ D + } + + ALLOC5 (size: 1, align: 1) { + 43 │ C + } + + ALLOC6 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC7 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff index ea6cdbfbe6612..97c71762f22e6 100644 --- a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff @@ -41,3 +41,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 45 │ E + } + + ALLOC1 (size: 1, align: 1) { + 44 │ D + } + diff --git a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff index ea6cdbfbe6612..97c71762f22e6 100644 --- a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff @@ -41,3 +41,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 45 │ E + } + + ALLOC1 (size: 1, align: 1) { + 44 │ D + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff index 02b9f02f4c0ec..4def129d9a195 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff index 02b9f02f4c0ec..4def129d9a195 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff index a6d6e0861b1ba..ac9b047624b1f 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff @@ -42,3 +42,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 45 │ E + } + + ALLOC1 (size: 1, align: 1) { + 44 │ D + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff index a6d6e0861b1ba..ac9b047624b1f 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff @@ -42,3 +42,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 45 │ E + } + + ALLOC1 (size: 1, align: 1) { + 44 │ D + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff index d3376442376d3..30516813357a9 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff index d3376442376d3..30516813357a9 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff index 8f0d5b7cd99c4..95369d0ea1f27 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff @@ -46,3 +46,15 @@ } } + ALLOC0 (size: 2, align: 1) { + 43 44 │ CD + } + + ALLOC1 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC2 (size: 6, align: 1) { + 41 28 69 33 32 29 │ A(i32) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff index 8f0d5b7cd99c4..95369d0ea1f27 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff @@ -46,3 +46,15 @@ } } + ALLOC0 (size: 2, align: 1) { + 43 44 │ CD + } + + ALLOC1 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC2 (size: 6, align: 1) { + 41 28 69 33 32 29 │ A(i32) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff index b1ecd00858290..9c8234c285e5a 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff @@ -60,3 +60,19 @@ } } + ALLOC0 (size: 1, align: 1) { + 44 │ D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC3 (size: 6, align: 1) { + 41 28 69 33 32 29 │ A(i32) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff index b1ecd00858290..9c8234c285e5a 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff @@ -60,3 +60,19 @@ } } + ALLOC0 (size: 1, align: 1) { + 44 │ D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC3 (size: 6, align: 1) { + 41 28 69 33 32 29 │ A(i32) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff index 28c6d4fb67599..64c85d71f05e3 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff @@ -73,3 +73,23 @@ } } + ALLOC0 (size: 9, align: 1) { + 41 28 6f 74 68 65 72 29 44 │ A(other)D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC3 (size: 4, align: 1) { + 41 28 32 29 │ A(2) + } + + ALLOC4 (size: 4, align: 1) { + 41 28 31 29 │ A(1) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff index 28c6d4fb67599..64c85d71f05e3 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff @@ -73,3 +73,23 @@ } } + ALLOC0 (size: 9, align: 1) { + 41 28 6f 74 68 65 72 29 44 │ A(other)D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC3 (size: 4, align: 1) { + 41 28 32 29 │ A(2) + } + + ALLOC4 (size: 4, align: 1) { + 41 28 31 29 │ A(1) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff index f36a7efd80d45..c0c0630511a75 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff @@ -64,3 +64,19 @@ } } + ALLOC0 (size: 1, align: 1) { + 44 │ D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 4, align: 1) { + 42 28 54 29 │ B(T) + } + + ALLOC3 (size: 4, align: 1) { + 41 28 54 29 │ A(T) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff index 20e31c24c84b5..3af431ec82857 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff @@ -68,3 +68,19 @@ } } + ALLOC0 (size: 1, align: 1) { + 44 │ D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 4, align: 1) { + 42 28 54 29 │ B(T) + } + + ALLOC3 (size: 4, align: 1) { + 41 28 54 29 │ A(T) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff index a85fc0da99232..bd3ffc10dc0d3 100644 --- a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff index a85fc0da99232..bd3ffc10dc0d3 100644 --- a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } +