diff --git a/compiler/rustc_middle/src/mir/tcx.rs b/compiler/rustc_middle/src/mir/tcx.rs index c93b7a955022925bd0b01d2168dd9a2f8a7ac3b2..f1fb484a801ba97c2c723d5166dfef813176b2a3 100644 --- a/compiler/rustc_middle/src/mir/tcx.rs +++ b/compiler/rustc_middle/src/mir/tcx.rs @@ -4,6 +4,7 @@ */ use crate::mir::*; +use crate::ty::cast::CastTy; use crate::ty::subst::Subst; use crate::ty::{self, Ty, TyCtxt}; use rustc_hir as hir; @@ -223,6 +224,22 @@ pub fn initialization_state(&self) -> RvalueInitializationState { _ => RvalueInitializationState::Deep, } } + + pub fn is_pointer_int_cast(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> bool + where + D: HasLocalDecls<'tcx>, + { + if let Rvalue::Cast(CastKind::Misc, src_op, dest_ty) = self { + if let Some(CastTy::Int(_)) = CastTy::from_ty(*dest_ty) { + let src_ty = src_op.ty(local_decls, tcx); + if let Some(CastTy::FnPtr | CastTy::Ptr(_)) = CastTy::from_ty(src_ty) { + return true; + } + } + } + + false + } } impl<'tcx> Operand<'tcx> { diff --git a/compiler/rustc_mir_dataflow/src/impls/liveness.rs b/compiler/rustc_mir_dataflow/src/impls/liveness.rs index 5a788c153a477efeeae3ab575078e82926584b9b..4350eb6cdd3b1fa3943beb4bb612f6aaba32ba92 100644 --- a/compiler/rustc_mir_dataflow/src/impls/liveness.rs +++ b/compiler/rustc_mir_dataflow/src/impls/liveness.rs @@ -1,8 +1,9 @@ -use rustc_index::bit_set::BitSet; +use rustc_index::bit_set::{BitSet, ChunkedBitSet}; use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor}; -use rustc_middle::mir::{self, Local, Location}; +use rustc_middle::mir::{self, Local, LocalDecls, Location, Place, StatementKind}; +use rustc_middle::ty::TyCtxt; -use crate::{AnalysisDomain, Backward, CallReturnPlaces, GenKill, GenKillAnalysis}; +use crate::{Analysis, AnalysisDomain, Backward, CallReturnPlaces, GenKill, GenKillAnalysis}; /// A [live-variable dataflow analysis][liveness]. /// @@ -98,19 +99,16 @@ impl<'tcx, T> Visitor<'tcx> for TransferFunction<'_, T> T: GenKill, { fn visit_place(&mut self, place: &mir::Place<'tcx>, context: PlaceContext, location: Location) { - let mir::Place { projection, local } = *place; + let local = place.local; // We purposefully do not call `super_place` here to avoid calling `visit_local` for this // place with one of the `Projection` variants of `PlaceContext`. self.visit_projection(place.as_ref(), context, location); - match DefUse::for_place(context) { - // Treat derefs as a use of the base local. `*p = 4` is not a def of `p` but a use. - Some(_) if place.is_indirect() => self.0.gen(local), - - Some(DefUse::Def) if projection.is_empty() => self.0.kill(local), + match DefUse::for_place(*place, context) { + Some(DefUse::Def) => self.0.kill(local), Some(DefUse::Use) => self.0.gen(local), - _ => {} + None => {} } } @@ -118,10 +116,10 @@ fn visit_local(&mut self, &local: &Local, context: PlaceContext, _: Location) { // Because we do not call `super_place` above, `visit_local` is only called for locals that // do not appear as part of a `Place` in the MIR. This handles cases like the implicit use // of the return place in a `Return` terminator or the index in an `Index` projection. - match DefUse::for_place(context) { + match DefUse::for_place(local.into(), context) { Some(DefUse::Def) => self.0.kill(local), Some(DefUse::Use) => self.0.gen(local), - _ => {} + None => {} } } } @@ -133,27 +131,37 @@ enum DefUse { } impl DefUse { - fn for_place(context: PlaceContext) -> Option { + fn for_place<'tcx>(place: Place<'tcx>, context: PlaceContext) -> Option { match context { PlaceContext::NonUse(_) => None, PlaceContext::MutatingUse(MutatingUseContext::Store | MutatingUseContext::Deinit) => { - Some(DefUse::Def) + if place.is_indirect() { + // Treat derefs as a use of the base local. `*p = 4` is not a def of `p` but a + // use. + Some(DefUse::Use) + } else if place.projection.is_empty() { + Some(DefUse::Def) + } else { + None + } } // Setting the discriminant is not a use because it does no reading, but it is also not // a def because it does not overwrite the whole place - PlaceContext::MutatingUse(MutatingUseContext::SetDiscriminant) => None, + PlaceContext::MutatingUse(MutatingUseContext::SetDiscriminant) => { + place.is_indirect().then_some(DefUse::Use) + } - // `MutatingUseContext::Call` and `MutatingUseContext::Yield` indicate that this is the - // destination place for a `Call` return or `Yield` resume respectively. Since this is - // only a `Def` when the function returns successfully, we handle this case separately - // in `call_return_effect` above. + // For the associated terminators, this is only a `Def` when the terminator returns + // "successfully." As such, we handle this case separately in `call_return_effect` + // above. However, if the place looks like `*_5`, this is still unconditionally a use of + // `_5`. PlaceContext::MutatingUse( MutatingUseContext::Call - | MutatingUseContext::AsmOutput - | MutatingUseContext::Yield, - ) => None, + | MutatingUseContext::Yield + | MutatingUseContext::AsmOutput, + ) => place.is_indirect().then_some(DefUse::Use), // All other contexts are uses... PlaceContext::MutatingUse( @@ -179,3 +187,133 @@ fn for_place(context: PlaceContext) -> Option { } } } + +/// Like `MaybeLiveLocals`, but does not mark locals as live if they are used in a dead assignment. +/// +/// This is basically written for dead store elimination and nothing else. +/// +/// All of the caveats of `MaybeLiveLocals` apply. +pub struct MaybeTransitiveLiveLocals<'a, 'tcx> { + always_live: &'a BitSet, + local_decls: &'a LocalDecls<'tcx>, + tcx: TyCtxt<'tcx>, +} + +impl<'a, 'tcx> MaybeTransitiveLiveLocals<'a, 'tcx> { + /// The `always_alive` set is the set of locals to which all stores should unconditionally be + /// considered live. + /// + /// This should include at least all locals that are ever borrowed. + pub fn new( + always_live: &'a BitSet, + local_decls: &'a LocalDecls<'tcx>, + tcx: TyCtxt<'tcx>, + ) -> Self { + MaybeTransitiveLiveLocals { always_live, local_decls, tcx } + } +} + +impl<'a, 'tcx> AnalysisDomain<'tcx> for MaybeTransitiveLiveLocals<'a, 'tcx> { + type Domain = ChunkedBitSet; + type Direction = Backward; + + const NAME: &'static str = "transitive liveness"; + + fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain { + // bottom = not live + ChunkedBitSet::new_empty(body.local_decls.len()) + } + + fn initialize_start_block(&self, _: &mir::Body<'tcx>, _: &mut Self::Domain) { + // No variables are live until we observe a use + } +} + +struct TransferWrapper<'a>(&'a mut ChunkedBitSet); + +impl<'a> GenKill for TransferWrapper<'a> { + fn gen(&mut self, l: Local) { + self.0.insert(l); + } + + fn kill(&mut self, l: Local) { + self.0.remove(l); + } +} + +impl<'a, 'tcx> Analysis<'tcx> for MaybeTransitiveLiveLocals<'a, 'tcx> { + fn apply_statement_effect( + &self, + trans: &mut Self::Domain, + statement: &mir::Statement<'tcx>, + location: Location, + ) { + // Compute the place that we are storing to, if any + let destination = match &statement.kind { + StatementKind::Assign(assign) => { + if assign.1.is_pointer_int_cast(self.local_decls, self.tcx) { + // Pointer to int casts may be side-effects due to exposing the provenance. + // While the model is undecided, we should be conservative. See + // + None + } else { + Some(assign.0) + } + } + StatementKind::SetDiscriminant { place, .. } | StatementKind::Deinit(place) => { + Some(**place) + } + StatementKind::FakeRead(_) + | StatementKind::StorageLive(_) + | StatementKind::StorageDead(_) + | StatementKind::Retag(..) + | StatementKind::AscribeUserType(..) + | StatementKind::Coverage(..) + | StatementKind::CopyNonOverlapping(..) + | StatementKind::Nop => None, + }; + if let Some(destination) = destination { + if !destination.is_indirect() + && !trans.contains(destination.local) + && !self.always_live.contains(destination.local) + { + // This store is dead + return; + } + } + TransferFunction(&mut TransferWrapper(trans)).visit_statement(statement, location); + } + + fn apply_terminator_effect( + &self, + trans: &mut Self::Domain, + terminator: &mir::Terminator<'tcx>, + location: Location, + ) { + TransferFunction(&mut TransferWrapper(trans)).visit_terminator(terminator, location); + } + + fn apply_call_return_effect( + &self, + trans: &mut Self::Domain, + _block: mir::BasicBlock, + return_places: CallReturnPlaces<'_, 'tcx>, + ) { + return_places.for_each(|place| { + if let Some(local) = place.as_local() { + trans.remove(local); + } + }); + } + + fn apply_yield_resume_effect( + &self, + trans: &mut Self::Domain, + _resume_block: mir::BasicBlock, + resume_place: mir::Place<'tcx>, + ) { + if let Some(local) = resume_place.as_local() { + trans.remove(local); + } + } +} diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs index c9722a6df77dbef683c933f10981d0f5121e29e9..41cf43fc8e186767e417e9a0b612ba6197b6f1e7 100644 --- a/compiler/rustc_mir_dataflow/src/impls/mod.rs +++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs @@ -26,6 +26,7 @@ pub use self::borrowed_locals::MaybeBorrowedLocals; pub use self::init_locals::MaybeInitializedLocals; pub use self::liveness::MaybeLiveLocals; +pub use self::liveness::MaybeTransitiveLiveLocals; pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageLive}; /// `MaybeInitializedPlaces` tracks all places that might be diff --git a/compiler/rustc_mir_transform/src/dead_store_elimination.rs b/compiler/rustc_mir_transform/src/dead_store_elimination.rs new file mode 100644 index 0000000000000000000000000000000000000000..84f2ee639e4d8a2ca3b8998185b4cf5be8ec74a2 --- /dev/null +++ b/compiler/rustc_mir_transform/src/dead_store_elimination.rs @@ -0,0 +1,148 @@ +//! This module implements a dead store elimination (DSE) routine. +//! +//! This transformation was written specifically for the needs of dest prop. Although it is +//! perfectly sound to use it in any context that might need it, its behavior should not be changed +//! without analyzing the interaction this will have with dest prop. Specifically, in addition to +//! the soundness of this pass in general, dest prop needs it to satisfy two additional conditions: +//! +//! 1. It's idempotent, meaning that running this pass a second time immediately after running it a +//! first time will not cause any further changes. +//! 2. This idempotence persists across dest prop's main transform, in other words inserting any +//! number of iterations of dest prop between the first and second application of this transform +//! will still not cause any further changes. +//! + +use rustc_index::bit_set::BitSet; +use rustc_middle::{ + mir::{visit::Visitor, *}, + ty::TyCtxt, +}; +use rustc_mir_dataflow::{impls::MaybeTransitiveLiveLocals, Analysis}; + +/// Performs the optimization on the body +/// +/// The `borrowed` set must be a `BitSet` of all the locals that are ever borrowed in this body. It +/// can be generated via the [`get_borrowed_locals`] function. +pub fn eliminate<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, borrowed: &BitSet) { + let mut live = MaybeTransitiveLiveLocals::new(borrowed, &body.local_decls, tcx) + .into_engine(tcx, body) + .iterate_to_fixpoint() + .into_results_cursor(body); + + let mut patch = Vec::new(); + for (bb, bb_data) in traversal::preorder(body) { + for (statement_index, statement) in bb_data.statements.iter().enumerate().rev() { + let loc = Location { block: bb, statement_index }; + if let StatementKind::Assign(assign) = &statement.kind { + if assign.1.is_pointer_int_cast(&body.local_decls, tcx) { + continue; + } + } + match &statement.kind { + StatementKind::Assign(box (place, _)) + | StatementKind::SetDiscriminant { place: box place, .. } + | StatementKind::Deinit(box place) => { + if !place.is_indirect() && !borrowed.contains(place.local) { + live.seek_before_primary_effect(loc); + if !live.get().contains(place.local) { + patch.push(loc); + } + } + } + StatementKind::Retag(_, _) + | StatementKind::StorageLive(_) + | StatementKind::StorageDead(_) + | StatementKind::Coverage(_) + | StatementKind::CopyNonOverlapping(_) + | StatementKind::Nop => (), + + StatementKind::FakeRead(_) | StatementKind::AscribeUserType(_, _) => { + bug!("{:?} not found in this MIR phase!", &statement.kind) + } + } + } + } + + if patch.is_empty() { + return; + } + + let bbs = body.basic_blocks_mut(); + for Location { block, statement_index } in patch { + bbs[block].statements[statement_index].make_nop(); + } +} + +pub fn get_borrowed_locals(body: &Body<'_>) -> BitSet { + let mut b = BorrowedLocals(BitSet::new_empty(body.local_decls.len())); + b.visit_body(body); + b.0 +} + +struct BorrowedLocals(BitSet); + +impl<'tcx> Visitor<'tcx> for BorrowedLocals { + fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, loc: Location) { + self.super_rvalue(rvalue, loc); + match rvalue { + Rvalue::AddressOf(_, borrowed_place) | Rvalue::Ref(_, _, borrowed_place) => { + if !borrowed_place.is_indirect() { + self.0.insert(borrowed_place.local); + } + } + + Rvalue::Cast(..) + | Rvalue::ShallowInitBox(..) + | Rvalue::Use(..) + | Rvalue::Repeat(..) + | Rvalue::Len(..) + | Rvalue::BinaryOp(..) + | Rvalue::CheckedBinaryOp(..) + | Rvalue::NullaryOp(..) + | Rvalue::UnaryOp(..) + | Rvalue::Discriminant(..) + | Rvalue::Aggregate(..) + | Rvalue::ThreadLocalRef(..) => {} + } + } + + fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) { + self.super_terminator(terminator, location); + + match terminator.kind { + TerminatorKind::Drop { place: dropped_place, .. } => { + if !dropped_place.is_indirect() { + self.0.insert(dropped_place.local); + } + } + + TerminatorKind::Abort + | TerminatorKind::DropAndReplace { .. } + | TerminatorKind::Assert { .. } + | TerminatorKind::Call { .. } + | TerminatorKind::FalseEdge { .. } + | TerminatorKind::FalseUnwind { .. } + | TerminatorKind::GeneratorDrop + | TerminatorKind::Goto { .. } + | TerminatorKind::Resume + | TerminatorKind::Return + | TerminatorKind::SwitchInt { .. } + | TerminatorKind::Unreachable + | TerminatorKind::Yield { .. } + | TerminatorKind::InlineAsm { .. } => {} + } + } +} + +pub struct DeadStoreElimination; + +impl<'tcx> MirPass<'tcx> for DeadStoreElimination { + fn is_enabled(&self, sess: &rustc_session::Session) -> bool { + sess.mir_opt_level() >= 2 + } + + fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { + let borrowed = get_borrowed_locals(body); + eliminate(tcx, body, &borrowed); + } +} diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 571f541072a38ac01ef634fd8f2ec956adfe05d5..0e57c3c69799970bccb597d8f08adb570cb6d958 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -49,6 +49,7 @@ mod const_prop; mod const_prop_lint; mod coverage; +mod dead_store_elimination; mod deaggregator; mod deduplicate_blocks; mod deref_separator; @@ -481,17 +482,18 @@ fn o1(x: T) -> WithMinOptLevel { &const_prop::ConstProp, // // Const-prop runs unconditionally, but doesn't mutate the MIR at mir-opt-level=0. + &const_debuginfo::ConstDebugInfo, &o1(simplify_branches::SimplifyConstCondition::new("after-const-prop")), &early_otherwise_branch::EarlyOtherwiseBranch, &simplify_comparison_integral::SimplifyComparisonIntegral, &simplify_try::SimplifyArmIdentity, &simplify_try::SimplifyBranchSame, + &dead_store_elimination::DeadStoreElimination, &dest_prop::DestinationPropagation, &o1(simplify_branches::SimplifyConstCondition::new("final")), &o1(remove_noop_landing_pads::RemoveNoopLandingPads), &o1(simplify::SimplifyCfg::new("final")), &nrvo::RenameReturnPlace, - &const_debuginfo::ConstDebugInfo, &simplify::SimplifyLocals, &multiple_return_terminators::MultipleReturnTerminators, &deduplicate_blocks::DeduplicateBlocks, diff --git a/src/test/codegen-units/item-collection/unsizing.rs b/src/test/codegen-units/item-collection/unsizing.rs index 1b963a24ce8be616d3227d81b99dbe1ede94405f..81675377941bd6ba04f17b646ef414e5e8870d0c 100644 --- a/src/test/codegen-units/item-collection/unsizing.rs +++ b/src/test/codegen-units/item-collection/unsizing.rs @@ -1,5 +1,6 @@ // compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus +// compile-flags:-Zmir-opt-level=0 #![deny(dead_code)] #![feature(coerce_unsized)] diff --git a/src/test/incremental/hashes/call_expressions.rs b/src/test/incremental/hashes/call_expressions.rs index 648f71f9230c3b3b7abe384e2cdbf81169907786..f3a7722cdcad020aa0faf147bc720ef3586349d1 100644 --- a/src/test/incremental/hashes/call_expressions.rs +++ b/src/test/incremental/hashes/call_expressions.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/closure_expressions.rs b/src/test/incremental/hashes/closure_expressions.rs index 2a4306fc17c2d9406a9df9c5acc0c9ff7adb70f6..c769246b29b2f9565a3c396ee5a79716261d9589 100644 --- a/src/test/incremental/hashes/closure_expressions.rs +++ b/src/test/incremental/hashes/closure_expressions.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -Zmir-opt-level=0 +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans @@ -63,9 +63,9 @@ pub fn change_parameter_pattern() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck, optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck, optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck")] #[rustc_clean(cfg="cfail6")] pub fn change_parameter_pattern() { let _ = |(x,): (u32,)| x; @@ -82,7 +82,7 @@ pub fn add_move() { #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn add_move() { let _ = move || 1; diff --git a/src/test/incremental/hashes/consts.rs b/src/test/incremental/hashes/consts.rs index c85f0bbecdb3928bacb3afe2e5f33d66fe85bfeb..eaef63386ffd50f2329c77c3a8231ee9614e68ad 100644 --- a/src/test/incremental/hashes/consts.rs +++ b/src/test/incremental/hashes/consts.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/src/test/incremental/hashes/enum_constructors.rs b/src/test/incremental/hashes/enum_constructors.rs index 7522fa5a0260c4ce30625781a5896f08a7b8d817..70ef10645f19f3ab8ea25ab91a8930805efab064 100644 --- a/src/test/incremental/hashes/enum_constructors.rs +++ b/src/test/incremental/hashes/enum_constructors.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph -Zmir-opt-level=0 +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans @@ -106,9 +106,9 @@ pub fn change_constructor_path_struct_like() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail6")] pub fn change_constructor_path_struct_like() { let _ = Enum2::Struct { @@ -131,9 +131,9 @@ pub fn change_constructor_variant_struct_like() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_constructor_variant_struct_like() { let _ = Enum2::Struct2 { @@ -221,12 +221,12 @@ pub fn change_constructor_path_tuple_like() { #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean( cfg="cfail2", - except="hir_owner_nodes,optimized_mir,typeck" + except="hir_owner_nodes,typeck" )] #[rustc_clean(cfg="cfail3")] #[rustc_clean( cfg="cfail5", - except="hir_owner_nodes,optimized_mir,typeck" + except="hir_owner_nodes,typeck" )] #[rustc_clean(cfg="cfail6")] pub fn change_constructor_path_tuple_like() { @@ -244,12 +244,12 @@ pub fn change_constructor_variant_tuple_like() { #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean( cfg="cfail2", - except="hir_owner_nodes,optimized_mir,typeck" + except="hir_owner_nodes,typeck" )] #[rustc_clean(cfg="cfail3")] #[rustc_clean( cfg="cfail5", - except="hir_owner_nodes,optimized_mir,typeck" + except="hir_owner_nodes,typeck" )] #[rustc_clean(cfg="cfail6")] pub fn change_constructor_variant_tuple_like() { @@ -337,9 +337,9 @@ pub fn change_constructor_variant_c_like() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_constructor_variant_c_like() { let _x = Clike::C; diff --git a/src/test/incremental/hashes/enum_defs.rs b/src/test/incremental/hashes/enum_defs.rs index 6582cdc4a2c85e4ba16c11e3329022092a9af43a..b466cfdd595946e5212305a460c26cae2ce909f7 100644 --- a/src/test/incremental/hashes/enum_defs.rs +++ b/src/test/incremental/hashes/enum_defs.rs @@ -12,7 +12,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/exported_vs_not.rs b/src/test/incremental/hashes/exported_vs_not.rs index d5fb8a2e53437a118e03c66aa14dbcaa77f8c74f..87fd21fd1b8107ccea5fdc8276dba39c770754d9 100644 --- a/src/test/incremental/hashes/exported_vs_not.rs +++ b/src/test/incremental/hashes/exported_vs_not.rs @@ -1,6 +1,6 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/extern_mods.rs b/src/test/incremental/hashes/extern_mods.rs index 142780bbc85a00b32fa0524e64e9e12f5b1daf2d..ff79acc7f6392e03c9e92050e361bd72fc1cbc8d 100644 --- a/src/test/incremental/hashes/extern_mods.rs +++ b/src/test/incremental/hashes/extern_mods.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/for_loops.rs b/src/test/incremental/hashes/for_loops.rs index d3687d5b9081ea28b01063a37a41f565b9257b04..16d6af01695f1965df01d432e9b941ba9eb21bc5 100644 --- a/src/test/incremental/hashes/for_loops.rs +++ b/src/test/incremental/hashes/for_loops.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans @@ -31,9 +31,9 @@ pub fn change_loop_body() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_loop_body() { let mut _x = 0; @@ -183,7 +183,7 @@ pub fn add_loop_label_to_break() { #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn add_loop_label_to_break() { let mut _x = 0; diff --git a/src/test/incremental/hashes/function_interfaces.rs b/src/test/incremental/hashes/function_interfaces.rs index 31564a0cbd5c64a059d7d412301b2e493a9382ba..076eddaabc048b818a302cfe66957c701a9307cc 100644 --- a/src/test/incremental/hashes/function_interfaces.rs +++ b/src/test/incremental/hashes/function_interfaces.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/if_expressions.rs b/src/test/incremental/hashes/if_expressions.rs index 37d67b946dacc694e3e5a38d49293c967fd01716..cff557dcb74b8830e7ae14e93d9f0ab6b9741f13 100644 --- a/src/test/incremental/hashes/if_expressions.rs +++ b/src/test/incremental/hashes/if_expressions.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/indexing_expressions.rs b/src/test/incremental/hashes/indexing_expressions.rs index 12c4d9f1e2998b6641952777a41b555fc0322bab..9ef46847243641bd3997a869be5b865234fdc8a3 100644 --- a/src/test/incremental/hashes/indexing_expressions.rs +++ b/src/test/incremental/hashes/indexing_expressions.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/inherent_impls.rs b/src/test/incremental/hashes/inherent_impls.rs index 5463b0dc87e4020ba43ee5c236d781b5e8af157d..69883058335f0566486a9ced7cdd10d412b1ee46 100644 --- a/src/test/incremental/hashes/inherent_impls.rs +++ b/src/test/incremental/hashes/inherent_impls.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/inline_asm.rs b/src/test/incremental/hashes/inline_asm.rs index bb836f203f5c060f1f2e0ac5dbc801bc3b8e305c..dc878d6827cbf87f3b5ea96738b27c1d700cb1be 100644 --- a/src/test/incremental/hashes/inline_asm.rs +++ b/src/test/incremental/hashes/inline_asm.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // needs-asm-support // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/let_expressions.rs b/src/test/incremental/hashes/let_expressions.rs index a9f90ca9fed81ba359acddb381884fc9a473bfec..01320cd51f4453d356a4c23a573fed3b9e7ddd0c 100644 --- a/src/test/incremental/hashes/let_expressions.rs +++ b/src/test/incremental/hashes/let_expressions.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans @@ -213,9 +213,9 @@ pub fn change_initializer() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_initializer() { let _x = 5u16; diff --git a/src/test/incremental/hashes/loop_expressions.rs b/src/test/incremental/hashes/loop_expressions.rs index 6fef31f5b32104ed758b7193ca62c759ec18c9c4..a12cd0d021e59cf910896954d410af5c5eae0bec 100644 --- a/src/test/incremental/hashes/loop_expressions.rs +++ b/src/test/incremental/hashes/loop_expressions.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans @@ -31,9 +31,9 @@ pub fn change_loop_body() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_loop_body() { let mut _x = 0; diff --git a/src/test/incremental/hashes/match_expressions.rs b/src/test/incremental/hashes/match_expressions.rs index 66a82e835dc924caa22a4d6e7b46b63c768c4012..fa054c7decc57056b3b1bcf1758f08e1cf664a42 100644 --- a/src/test/incremental/hashes/match_expressions.rs +++ b/src/test/incremental/hashes/match_expressions.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/panic_exprs.rs b/src/test/incremental/hashes/panic_exprs.rs index cc0bd45a4b4c14cc948390057cf44919da717904..37d10d922c177ac2d0165d38e89a532bcc2785c2 100644 --- a/src/test/incremental/hashes/panic_exprs.rs +++ b/src/test/incremental/hashes/panic_exprs.rs @@ -10,7 +10,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -C debug-assertions +// compile-flags: -Z query-dep-graph -C debug-assertions -O #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/src/test/incremental/hashes/statics.rs b/src/test/incremental/hashes/statics.rs index 697be056761530e4312b751604fb17ee09d51c25..67d87f5c4ed92e7cad5c7f9d97f113e08a82e05a 100644 --- a/src/test/incremental/hashes/statics.rs +++ b/src/test/incremental/hashes/statics.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/struct_constructors.rs b/src/test/incremental/hashes/struct_constructors.rs index 0f2966922bc8fd478003b54d86118a41f251866c..fc9671cb41b47ef529455ab52a8875a4d0573dc0 100644 --- a/src/test/incremental/hashes/struct_constructors.rs +++ b/src/test/incremental/hashes/struct_constructors.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/struct_defs.rs b/src/test/incremental/hashes/struct_defs.rs index b4d558d259fe696b734fa402af305ede5fdb45e9..7a91722d70fda1e4027728bbb078e8b7acbeb7bb 100644 --- a/src/test/incremental/hashes/struct_defs.rs +++ b/src/test/incremental/hashes/struct_defs.rs @@ -12,7 +12,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/trait_defs.rs b/src/test/incremental/hashes/trait_defs.rs index 717e9e8c8e1112bea8ad0679fc0d4c73e4b98c25..9b79fd8a0a105fe71f85a13f46e6f7b3ef479cd5 100644 --- a/src/test/incremental/hashes/trait_defs.rs +++ b/src/test/incremental/hashes/trait_defs.rs @@ -12,7 +12,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/trait_impls.rs b/src/test/incremental/hashes/trait_impls.rs index 2fb991b60ef3f7b25aadf73ff8495c345995f0c9..cc63aa4f5566399f6aa575c2b01769332404a943 100644 --- a/src/test/incremental/hashes/trait_impls.rs +++ b/src/test/incremental/hashes/trait_impls.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/type_defs.rs b/src/test/incremental/hashes/type_defs.rs index 1d278c4efa987383ee731ed0ed95d60345910bd7..79398eb07fe44c6ec89ceb27d7aa254665028c4e 100644 --- a/src/test/incremental/hashes/type_defs.rs +++ b/src/test/incremental/hashes/type_defs.rs @@ -12,7 +12,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/src/test/incremental/hashes/unary_and_binary_exprs.rs b/src/test/incremental/hashes/unary_and_binary_exprs.rs index 8d8345e10f5553f4b0efb5f0b9435f48e780c2b2..18fb716353fa7f55484b766af5477efd6245c2af 100644 --- a/src/test/incremental/hashes/unary_and_binary_exprs.rs +++ b/src/test/incremental/hashes/unary_and_binary_exprs.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/while_let_loops.rs b/src/test/incremental/hashes/while_let_loops.rs index 64a6517836cd80f708247c23aa893f76ac0b6eba..f81855e42becbd67a13dc5f45f5b7e7e63a1ed81 100644 --- a/src/test/incremental/hashes/while_let_loops.rs +++ b/src/test/incremental/hashes/while_let_loops.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/while_loops.rs b/src/test/incremental/hashes/while_loops.rs index b8796d3446be72826328aff7ee9a64c8e3ca87ed..e432cf8fe4cc3068753af5b375c1408de6185a59 100644 --- a/src/test/incremental/hashes/while_loops.rs +++ b/src/test/incremental/hashes/while_loops.rs @@ -7,7 +7,7 @@ // build-pass (FIXME(62277): could be check-pass?) // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -O // [cfail1]compile-flags: -Zincremental-ignore-spans // [cfail2]compile-flags: -Zincremental-ignore-spans // [cfail3]compile-flags: -Zincremental-ignore-spans @@ -31,9 +31,9 @@ pub fn change_loop_body() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_loop_body() { let mut _x = 0; @@ -56,9 +56,9 @@ pub fn change_loop_condition() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_loop_condition() { let mut _x = 0; diff --git a/src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff index bbde6ad4b637d433097c4548b551e4fde3f2db88..cd4b471b28cc18cfc017b758315134d2ef7bbcec 100644 --- a/src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff +++ b/src/test/mir-opt/const_debuginfo.main.ConstDebugInfo.diff @@ -99,6 +99,7 @@ _13 = const 64_u32; // scope 8 at $DIR/const_debuginfo.rs:21:13: 21:22 StorageDead(_15); // scope 8 at $DIR/const_debuginfo.rs:21:21: 21:22 StorageDead(_14); // scope 8 at $DIR/const_debuginfo.rs:21:21: 21:22 + nop; // scope 0 at $DIR/const_debuginfo.rs:8:11: 22:2 StorageDead(_13); // scope 8 at $DIR/const_debuginfo.rs:22:1: 22:2 StorageDead(_12); // scope 7 at $DIR/const_debuginfo.rs:22:1: 22:2 StorageDead(_11); // scope 6 at $DIR/const_debuginfo.rs:22:1: 22:2 diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir b/src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir index c6f1d86ae3a0743f43a68963f72d064e97736363..6d11d02d6792896e7c50e4148d8606593453d90a 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir +++ b/src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir @@ -17,11 +17,8 @@ fn main() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10 - _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10 - _2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34 StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10 - _3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38 StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2 StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2 StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2 diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir b/src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir index c6f1d86ae3a0743f43a68963f72d064e97736363..6d11d02d6792896e7c50e4148d8606593453d90a 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir +++ b/src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir @@ -17,11 +17,8 @@ fn main() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10 - _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18 StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10 - _2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34 StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10 - _3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38 StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2 StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2 StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2 diff --git a/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff new file mode 100644 index 0000000000000000000000000000000000000000..6037f89086dc125677fead02f7cbf10e59031ec3 --- /dev/null +++ b/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff @@ -0,0 +1,75 @@ +- // MIR for `cycle` before DeadStoreElimination ++ // MIR for `cycle` after DeadStoreElimination + + fn cycle(_1: i32, _2: i32, _3: i32) -> () { + debug x => _1; // in scope 0 at $DIR/cycle.rs:9:10: 9:15 + debug y => _2; // in scope 0 at $DIR/cycle.rs:9:22: 9:27 + debug z => _3; // in scope 0 at $DIR/cycle.rs:9:34: 9:39 + let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:9:46: 9:46 + let mut _4: (); // in scope 0 at $DIR/cycle.rs:9:1: 18:2 + let mut _5: bool; // in scope 0 at $DIR/cycle.rs:12:11: 12:17 + let _6: i32; // in scope 0 at $DIR/cycle.rs:13:13: 13:17 + let mut _7: i32; // in scope 0 at $DIR/cycle.rs:14:13: 14:14 + let mut _8: i32; // in scope 0 at $DIR/cycle.rs:15:13: 15:14 + let mut _9: i32; // in scope 0 at $DIR/cycle.rs:16:13: 16:17 + let mut _10: !; // in scope 0 at $DIR/cycle.rs:12:5: 17:6 + let _11: (); // in scope 0 at $DIR/cycle.rs:12:5: 17:6 + let mut _12: !; // in scope 0 at $DIR/cycle.rs:12:5: 17:6 + scope 1 { + debug temp => _6; // in scope 1 at $DIR/cycle.rs:13:13: 13:17 + } + + bb0: { + goto -> bb1; // scope 0 at $DIR/cycle.rs:12:5: 17:6 + } + + bb1: { + StorageLive(_5); // scope 0 at $DIR/cycle.rs:12:11: 12:17 + _5 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:12:11: 12:17 + // mir::Constant + // + span: $DIR/cycle.rs:12:11: 12:15 + // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar()) } + } + + bb2: { + switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:12:11: 12:17 + } + + bb3: { + StorageLive(_6); // scope 0 at $DIR/cycle.rs:13:13: 13:17 +- _6 = _3; // scope 0 at $DIR/cycle.rs:13:20: 13:21 ++ nop; // scope 0 at $DIR/cycle.rs:13:20: 13:21 + StorageLive(_7); // scope 1 at $DIR/cycle.rs:14:13: 14:14 +- _7 = _2; // scope 1 at $DIR/cycle.rs:14:13: 14:14 +- _3 = move _7; // scope 1 at $DIR/cycle.rs:14:9: 14:14 ++ nop; // scope 1 at $DIR/cycle.rs:14:13: 14:14 ++ nop; // scope 1 at $DIR/cycle.rs:14:9: 14:14 + StorageDead(_7); // scope 1 at $DIR/cycle.rs:14:13: 14:14 + StorageLive(_8); // scope 1 at $DIR/cycle.rs:15:13: 15:14 +- _8 = _1; // scope 1 at $DIR/cycle.rs:15:13: 15:14 +- _2 = move _8; // scope 1 at $DIR/cycle.rs:15:9: 15:14 ++ nop; // scope 1 at $DIR/cycle.rs:15:13: 15:14 ++ nop; // scope 1 at $DIR/cycle.rs:15:9: 15:14 + StorageDead(_8); // scope 1 at $DIR/cycle.rs:15:13: 15:14 + StorageLive(_9); // scope 1 at $DIR/cycle.rs:16:13: 16:17 +- _9 = _6; // scope 1 at $DIR/cycle.rs:16:13: 16:17 +- _1 = move _9; // scope 1 at $DIR/cycle.rs:16:9: 16:17 ++ nop; // scope 1 at $DIR/cycle.rs:16:13: 16:17 ++ nop; // scope 1 at $DIR/cycle.rs:16:9: 16:17 + StorageDead(_9); // scope 1 at $DIR/cycle.rs:16:16: 16:17 +- _4 = const (); // scope 0 at $DIR/cycle.rs:12:18: 17:6 ++ nop; // scope 0 at $DIR/cycle.rs:12:18: 17:6 + StorageDead(_6); // scope 0 at $DIR/cycle.rs:17:5: 17:6 + StorageDead(_5); // scope 0 at $DIR/cycle.rs:17:5: 17:6 + goto -> bb1; // scope 0 at $DIR/cycle.rs:12:5: 17:6 + } + + bb4: { + StorageLive(_11); // scope 0 at $DIR/cycle.rs:12:5: 17:6 + _0 = const (); // scope 0 at $DIR/cycle.rs:12:5: 17:6 + StorageDead(_11); // scope 0 at $DIR/cycle.rs:17:5: 17:6 + StorageDead(_5); // scope 0 at $DIR/cycle.rs:17:5: 17:6 + return; // scope 0 at $DIR/cycle.rs:18:2: 18:2 + } + } + diff --git a/src/test/mir-opt/dead-store-elimination/cycle.rs b/src/test/mir-opt/dead-store-elimination/cycle.rs new file mode 100644 index 0000000000000000000000000000000000000000..b35ce0bcb5ad1de071ec29bca04d8a649371afe5 --- /dev/null +++ b/src/test/mir-opt/dead-store-elimination/cycle.rs @@ -0,0 +1,22 @@ +// unit-test: DeadStoreElimination + +#[inline(never)] +fn cond() -> bool { + false +} + +// EMIT_MIR cycle.cycle.DeadStoreElimination.diff +fn cycle(mut x: i32, mut y: i32, mut z: i32) { + // This example is interesting because the non-transitive version of `MaybeLiveLocals` would + // report that *all* of these stores are live. + while cond() { + let temp = z; + z = y; + y = x; + x = temp; + } +} + +fn main() { + cycle(1, 2, 3); +} diff --git a/src/test/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff b/src/test/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff new file mode 100644 index 0000000000000000000000000000000000000000..2250159c8166784ae5065a10b6b5d3dea550bca7 --- /dev/null +++ b/src/test/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff @@ -0,0 +1,35 @@ +- // MIR for `pointer_to_int` before DeadStoreElimination ++ // MIR for `pointer_to_int` after DeadStoreElimination + + fn pointer_to_int(_1: *mut i32) -> () { + debug p => _1; // in scope 0 at $DIR/provenance_soundness.rs:7:19: 7:20 + let mut _0: (); // return place in scope 0 at $DIR/provenance_soundness.rs:7:32: 7:32 + let _2: usize; // in scope 0 at $DIR/provenance_soundness.rs:8:9: 8:11 + let mut _3: *mut i32; // in scope 0 at $DIR/provenance_soundness.rs:8:14: 8:15 + let mut _5: *mut i32; // in scope 0 at $DIR/provenance_soundness.rs:9:14: 9:15 + scope 1 { + debug _x => _2; // in scope 1 at $DIR/provenance_soundness.rs:8:9: 8:11 + let _4: isize; // in scope 1 at $DIR/provenance_soundness.rs:9:9: 9:11 + scope 2 { + debug _y => _4; // in scope 2 at $DIR/provenance_soundness.rs:9:9: 9:11 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/provenance_soundness.rs:8:9: 8:11 + StorageLive(_3); // scope 0 at $DIR/provenance_soundness.rs:8:14: 8:15 + _3 = _1; // scope 0 at $DIR/provenance_soundness.rs:8:14: 8:15 + _2 = move _3 as usize (Misc); // scope 0 at $DIR/provenance_soundness.rs:8:14: 8:24 + StorageDead(_3); // scope 0 at $DIR/provenance_soundness.rs:8:23: 8:24 + StorageLive(_4); // scope 1 at $DIR/provenance_soundness.rs:9:9: 9:11 + StorageLive(_5); // scope 1 at $DIR/provenance_soundness.rs:9:14: 9:15 + _5 = _1; // scope 1 at $DIR/provenance_soundness.rs:9:14: 9:15 + _4 = move _5 as isize (Misc); // scope 1 at $DIR/provenance_soundness.rs:9:14: 9:24 + StorageDead(_5); // scope 1 at $DIR/provenance_soundness.rs:9:23: 9:24 + _0 = const (); // scope 0 at $DIR/provenance_soundness.rs:7:32: 10:2 + StorageDead(_4); // scope 1 at $DIR/provenance_soundness.rs:10:1: 10:2 + StorageDead(_2); // scope 0 at $DIR/provenance_soundness.rs:10:1: 10:2 + return; // scope 0 at $DIR/provenance_soundness.rs:10:2: 10:2 + } + } + diff --git a/src/test/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff b/src/test/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff new file mode 100644 index 0000000000000000000000000000000000000000..0bfffb6dca3dca9c326b57cf1af0019f11f6d3af --- /dev/null +++ b/src/test/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff @@ -0,0 +1,14 @@ +- // MIR for `retags` before DeadStoreElimination ++ // MIR for `retags` after DeadStoreElimination + + fn retags(_1: &mut i32) -> () { + debug _r => _1; // in scope 0 at $DIR/provenance_soundness.rs:13:11: 13:13 + let mut _0: (); // return place in scope 0 at $DIR/provenance_soundness.rs:13:25: 13:25 + + bb0: { + Retag([fn entry] _1); // scope 0 at $DIR/provenance_soundness.rs:13:1: 13:27 + _0 = const (); // scope 0 at $DIR/provenance_soundness.rs:13:25: 13:27 + return; // scope 0 at $DIR/provenance_soundness.rs:13:27: 13:27 + } + } + diff --git a/src/test/mir-opt/dead-store-elimination/provenance_soundness.rs b/src/test/mir-opt/dead-store-elimination/provenance_soundness.rs new file mode 100644 index 0000000000000000000000000000000000000000..11314e990982c579677fe57991e84d27adbaacce --- /dev/null +++ b/src/test/mir-opt/dead-store-elimination/provenance_soundness.rs @@ -0,0 +1,18 @@ +// unit-test: DeadStoreElimination +// compile-flags: -Zmir-emit-retag + +// Test that we don't remove pointer to int casts or retags + +// EMIT_MIR provenance_soundness.pointer_to_int.DeadStoreElimination.diff +fn pointer_to_int(p: *mut i32) { + let _x = p as usize; + let _y = p as isize; +} + +// EMIT_MIR provenance_soundness.retags.DeadStoreElimination.diff +fn retags(_r: &mut i32) {} + +fn main() { + pointer_to_int(&mut 5 as *mut _); + retags(&mut 5); +} diff --git a/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff index 02821a1079e0a219bc25e670e856f3ee8927138a..c3aa19e6c5f8402fa0e7475fc6198ed6015a8c43 100644 --- a/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff @@ -7,8 +7,7 @@ let mut _3: bool; // in scope 0 at $DIR/branch.rs:15:16: 15:22 let _4: i32; // in scope 0 at $DIR/branch.rs:18:9: 18:14 scope 1 { -- debug x => _1; // in scope 1 at $DIR/branch.rs:13:9: 13:10 -+ debug x => _2; // in scope 1 at $DIR/branch.rs:13:9: 13:10 + debug x => _1; // in scope 1 at $DIR/branch.rs:13:9: 13:10 let _2: i32; // in scope 1 at $DIR/branch.rs:15:9: 15:10 scope 2 { debug y => _2; // in scope 2 at $DIR/branch.rs:15:9: 15:10 @@ -16,18 +15,15 @@ } bb0: { -- StorageLive(_1); // scope 0 at $DIR/branch.rs:13:9: 13:10 -- _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18 -+ nop; // scope 0 at $DIR/branch.rs:13:9: 13:10 -+ _2 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18 + StorageLive(_1); // scope 0 at $DIR/branch.rs:13:9: 13:10 + _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:13:13: 13:18 // mir::Constant // + span: $DIR/branch.rs:13:13: 13:16 // + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar()) } } bb1: { -- StorageLive(_2); // scope 1 at $DIR/branch.rs:15:9: 15:10 -+ nop; // scope 1 at $DIR/branch.rs:15:9: 15:10 + StorageLive(_2); // scope 1 at $DIR/branch.rs:15:9: 15:10 StorageLive(_3); // scope 1 at $DIR/branch.rs:15:16: 15:22 _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:15:16: 15:22 // mir::Constant @@ -40,8 +36,7 @@ } bb3: { -- _2 = _1; // scope 1 at $DIR/branch.rs:16:9: 16:10 -+ nop; // scope 1 at $DIR/branch.rs:16:9: 16:10 + nop; // scope 1 at $DIR/branch.rs:16:9: 16:10 goto -> bb6; // scope 1 at $DIR/branch.rs:15:13: 20:6 } @@ -55,18 +50,15 @@ bb5: { StorageDead(_4); // scope 1 at $DIR/branch.rs:18:14: 18:15 -- _2 = _1; // scope 1 at $DIR/branch.rs:19:9: 19:10 -+ nop; // scope 1 at $DIR/branch.rs:19:9: 19:10 + nop; // scope 1 at $DIR/branch.rs:19:9: 19:10 goto -> bb6; // scope 1 at $DIR/branch.rs:15:13: 20:6 } bb6: { StorageDead(_3); // scope 1 at $DIR/branch.rs:20:5: 20:6 nop; // scope 0 at $DIR/branch.rs:12:11: 21:2 -- StorageDead(_2); // scope 1 at $DIR/branch.rs:21:1: 21:2 -- StorageDead(_1); // scope 0 at $DIR/branch.rs:21:1: 21:2 -+ nop; // scope 1 at $DIR/branch.rs:21:1: 21:2 -+ nop; // scope 0 at $DIR/branch.rs:21:1: 21:2 + StorageDead(_2); // scope 1 at $DIR/branch.rs:21:1: 21:2 + StorageDead(_1); // scope 0 at $DIR/branch.rs:21:1: 21:2 return; // scope 0 at $DIR/branch.rs:21:2: 21:2 } } diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff index a5d80e750533251aa8e3a3aed0f67c9ef72fd779..8919703647d6d3cb24a831191dc1867d1c36cc42 100644 --- a/src/test/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff @@ -2,7 +2,7 @@ + // MIR for `arg_src` after DestinationPropagation fn arg_src(_1: i32) -> i32 { - debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:27:12: 27:17 + debug x => const 123_i32; // in scope 0 at $DIR/copy_propagation_arg.rs:27:12: 27:17 let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:27:27: 27:30 let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10 scope 1 { @@ -15,7 +15,7 @@ - _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10 + _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14 - _1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:29:5: 29:12 + nop; // scope 1 at $DIR/copy_propagation_arg.rs:29:5: 29:12 - _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6 - StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2 + nop; // scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6 diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff index 383f00f01253b6e19256b224893dca0d5d43b245..3f9ba4ad4f0ac3eaa2eb0f0886b5e0cacb5d7fd8 100644 --- a/src/test/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff @@ -2,7 +2,7 @@ + // MIR for `bar` after DestinationPropagation fn bar(_1: u8) -> () { - debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:15:8: 15:13 + debug x => const 5_u8; // in scope 0 at $DIR/copy_propagation_arg.rs:15:8: 15:13 let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:15:19: 15:19 let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13 let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12 @@ -20,7 +20,7 @@ bb1: { StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:16:12: 16:13 StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:16:13: 16:14 - _1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:17:5: 17:10 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:17:5: 17:10 nop; // scope 0 at $DIR/copy_propagation_arg.rs:15:19: 18:2 return; // scope 0 at $DIR/copy_propagation_arg.rs:18:2: 18:2 } diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff index 2349d5b0771b57c42a39e6008a4e65197d059afb..67ce87e842d043dde23cac2991796f23015315d4 100644 --- a/src/test/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff @@ -7,14 +7,10 @@ let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 bb0: { -- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 -- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 -- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10 -- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 + StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10 + StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10 nop; // scope 0 at $DIR/copy_propagation_arg.rs:21:20: 24:2 return; // scope 0 at $DIR/copy_propagation_arg.rs:24:2: 24:2 } diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff index f955a9c043f763968c8f1fe76dbbb477882418e3..963881d7ae062d906d765841adab700bdfca58a2 100644 --- a/src/test/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff @@ -8,12 +8,10 @@ let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16 bb0: { -- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 + StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16 _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16 -- _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 -+ _1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 + _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17 // mir::Constant // + span: $DIR/copy_propagation_arg.rs:11:9: 11:14 // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar()) } @@ -21,10 +19,8 @@ bb1: { StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17 -- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17 -- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17 -+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17 + nop; // scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17 + StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17 nop; // scope 0 at $DIR/copy_propagation_arg.rs:9:19: 12:2 return; // scope 0 at $DIR/copy_propagation_arg.rs:12:2: 12:2 } diff --git a/src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff index c6c4d6dcc0fb6c056badfc10b77c7f96bba8704b..8e44d68d9348e47d59e06ed8439f96e8ad1a059a 100644 --- a/src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff @@ -8,16 +8,13 @@ let _5: (); // in scope 0 at $DIR/cycle.rs:14:5: 14:12 let mut _6: i32; // in scope 0 at $DIR/cycle.rs:14:10: 14:11 scope 1 { -- debug x => _1; // in scope 1 at $DIR/cycle.rs:9:9: 9:14 -+ debug x => _4; // in scope 1 at $DIR/cycle.rs:9:9: 9:14 + debug x => _1; // in scope 1 at $DIR/cycle.rs:9:9: 9:14 let _2: i32; // in scope 1 at $DIR/cycle.rs:10:9: 10:10 scope 2 { -- debug y => _2; // in scope 2 at $DIR/cycle.rs:10:9: 10:10 -+ debug y => _4; // in scope 2 at $DIR/cycle.rs:10:9: 10:10 + debug y => _2; // in scope 2 at $DIR/cycle.rs:10:9: 10:10 let _3: i32; // in scope 2 at $DIR/cycle.rs:11:9: 11:10 scope 3 { -- debug z => _3; // in scope 3 at $DIR/cycle.rs:11:9: 11:10 -+ debug z => _4; // in scope 3 at $DIR/cycle.rs:11:9: 11:10 + debug z => _3; // in scope 3 at $DIR/cycle.rs:11:9: 11:10 scope 4 (inlined std::mem::drop::) { // at $DIR/cycle.rs:14:5: 14:12 debug _x => _6; // in scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL } @@ -26,44 +23,30 @@ } bb0: { -- StorageLive(_1); // scope 0 at $DIR/cycle.rs:9:9: 9:14 -- _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22 -+ nop; // scope 0 at $DIR/cycle.rs:9:9: 9:14 -+ _4 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22 + StorageLive(_1); // scope 0 at $DIR/cycle.rs:9:9: 9:14 + _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:9:17: 9:22 // mir::Constant // + span: $DIR/cycle.rs:9:17: 9:20 // + literal: Const { ty: fn() -> i32 {val}, val: Value(Scalar()) } } bb1: { -- StorageLive(_2); // scope 1 at $DIR/cycle.rs:10:9: 10:10 -- _2 = _1; // scope 1 at $DIR/cycle.rs:10:13: 10:14 -- StorageLive(_3); // scope 2 at $DIR/cycle.rs:11:9: 11:10 -- _3 = _2; // scope 2 at $DIR/cycle.rs:11:13: 11:14 -- StorageLive(_4); // scope 3 at $DIR/cycle.rs:12:9: 12:10 -- _4 = _3; // scope 3 at $DIR/cycle.rs:12:9: 12:10 -- _1 = move _4; // scope 3 at $DIR/cycle.rs:12:5: 12:10 -- StorageDead(_4); // scope 3 at $DIR/cycle.rs:12:9: 12:10 -+ nop; // scope 1 at $DIR/cycle.rs:10:9: 10:10 -+ nop; // scope 1 at $DIR/cycle.rs:10:13: 10:14 -+ nop; // scope 2 at $DIR/cycle.rs:11:9: 11:10 -+ nop; // scope 2 at $DIR/cycle.rs:11:13: 11:14 -+ nop; // scope 3 at $DIR/cycle.rs:12:9: 12:10 -+ nop; // scope 3 at $DIR/cycle.rs:12:9: 12:10 -+ nop; // scope 3 at $DIR/cycle.rs:12:5: 12:10 -+ nop; // scope 3 at $DIR/cycle.rs:12:9: 12:10 + StorageLive(_2); // scope 1 at $DIR/cycle.rs:10:9: 10:10 + nop; // scope 1 at $DIR/cycle.rs:10:13: 10:14 + StorageLive(_3); // scope 2 at $DIR/cycle.rs:11:9: 11:10 + nop; // scope 2 at $DIR/cycle.rs:11:13: 11:14 + StorageLive(_4); // scope 3 at $DIR/cycle.rs:12:9: 12:10 + nop; // scope 3 at $DIR/cycle.rs:12:9: 12:10 + nop; // scope 3 at $DIR/cycle.rs:12:5: 12:10 + StorageDead(_4); // scope 3 at $DIR/cycle.rs:12:9: 12:10 StorageLive(_5); // scope 3 at $DIR/cycle.rs:14:5: 14:12 StorageLive(_6); // scope 3 at $DIR/cycle.rs:14:10: 14:11 -- _6 = _1; // scope 3 at $DIR/cycle.rs:14:10: 14:11 -+ _6 = _4; // scope 3 at $DIR/cycle.rs:14:10: 14:11 + nop; // scope 3 at $DIR/cycle.rs:14:10: 14:11 StorageDead(_6); // scope 3 at $DIR/cycle.rs:14:11: 14:12 StorageDead(_5); // scope 3 at $DIR/cycle.rs:14:12: 14:13 -- StorageDead(_3); // scope 2 at $DIR/cycle.rs:15:1: 15:2 -- StorageDead(_2); // scope 1 at $DIR/cycle.rs:15:1: 15:2 -- StorageDead(_1); // scope 0 at $DIR/cycle.rs:15:1: 15:2 -+ nop; // scope 2 at $DIR/cycle.rs:15:1: 15:2 -+ nop; // scope 1 at $DIR/cycle.rs:15:1: 15:2 -+ nop; // scope 0 at $DIR/cycle.rs:15:1: 15:2 + StorageDead(_3); // scope 2 at $DIR/cycle.rs:15:1: 15:2 + StorageDead(_2); // scope 1 at $DIR/cycle.rs:15:1: 15:2 + StorageDead(_1); // scope 0 at $DIR/cycle.rs:15:1: 15:2 return; // scope 0 at $DIR/cycle.rs:15:2: 15:2 } } diff --git a/src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff index 9330e68b1aa8912eda06287591ea024c2476c12e..582a1738cbf96b69e2f4d3fcc10dbf6dc620701a 100644 --- a/src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff @@ -17,30 +17,24 @@ } bb0: { -- StorageLive(_1); // scope 0 at $DIR/union.rs:13:9: 13:11 -- StorageLive(_2); // scope 0 at $DIR/union.rs:13:23: 13:28 -- _2 = val() -> bb1; // scope 0 at $DIR/union.rs:13:23: 13:28 -+ nop; // scope 0 at $DIR/union.rs:13:9: 13:11 -+ nop; // scope 0 at $DIR/union.rs:13:23: 13:28 -+ (_1.0: u32) = val() -> bb1; // scope 0 at $DIR/union.rs:13:23: 13:28 + StorageLive(_1); // scope 0 at $DIR/union.rs:13:9: 13:11 + StorageLive(_2); // scope 0 at $DIR/union.rs:13:23: 13:28 + _2 = val() -> bb1; // scope 0 at $DIR/union.rs:13:23: 13:28 // mir::Constant // + span: $DIR/union.rs:13:23: 13:26 // + literal: Const { ty: fn() -> u32 {val}, val: Value(Scalar()) } } bb1: { - Deinit(_1); // scope 0 at $DIR/union.rs:13:14: 13:30 -- (_1.0: u32) = move _2; // scope 0 at $DIR/union.rs:13:14: 13:30 -- StorageDead(_2); // scope 0 at $DIR/union.rs:13:29: 13:30 -+ nop; // scope 0 at $DIR/union.rs:13:14: 13:30 -+ nop; // scope 0 at $DIR/union.rs:13:29: 13:30 + nop; // scope 0 at $DIR/union.rs:13:14: 13:30 + nop; // scope 0 at $DIR/union.rs:13:14: 13:30 + StorageDead(_2); // scope 0 at $DIR/union.rs:13:29: 13:30 StorageLive(_3); // scope 1 at $DIR/union.rs:15:5: 15:27 StorageLive(_4); // scope 1 at $DIR/union.rs:15:10: 15:26 - _4 = (_1.0: u32); // scope 2 at $DIR/union.rs:15:19: 15:24 + nop; // scope 2 at $DIR/union.rs:15:19: 15:24 StorageDead(_4); // scope 1 at $DIR/union.rs:15:26: 15:27 StorageDead(_3); // scope 1 at $DIR/union.rs:15:27: 15:28 -- StorageDead(_1); // scope 0 at $DIR/union.rs:16:1: 16:2 -+ nop; // scope 0 at $DIR/union.rs:16:1: 16:2 + StorageDead(_1); // scope 0 at $DIR/union.rs:16:1: 16:2 return; // scope 0 at $DIR/union.rs:16:2: 16:2 } } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index 4426cd8661661316a64b6fc85d02d935bd7b1c94..8b0a73ec4ba61fd16a3dfced5874fbf4adf36056 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -6,33 +6,32 @@ let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14 let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30 let _3: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - let mut _5: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27 - let mut _6: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _7: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _8: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _13: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _15: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _16: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _18: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _19: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _20: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _14: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _16: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _18: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _19: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 + let _8: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _9: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _10: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _21: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { - debug left_val => _9; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _10; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _14: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug left_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _9; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _13: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug kind => _14; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug kind => _13; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -53,58 +52,50 @@ StorageDead(_3); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 StorageLive(_4); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 - StorageLive(_5); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - _5 = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - Deinit(_4); // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - ((_4 as Some).0: i32) = move _5; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - StorageDead(_5); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28 + StorageLive(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _6 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _7 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } - _8 = _21; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_6.0: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_6.1: &i32) = move _8; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = _20; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_5.0: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_5.1: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _8 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _9 = (_6.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _10 = (_6.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _9 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _13 = (*_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = Eq(move _13, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _11 = Not(move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = (*_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = Eq(move _12, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _11) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _10 = Not(move _11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _10) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { - StorageLive(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_14) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = _8; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = _16; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _17 = _9; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = _17; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = _9; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = _18; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _19 = _10; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = _19; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_20) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _15 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _16, move _18, move _20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_19) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _14 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } @@ -114,10 +105,10 @@ } bb2: { - StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index 4426cd8661661316a64b6fc85d02d935bd7b1c94..8b0a73ec4ba61fd16a3dfced5874fbf4adf36056 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -6,33 +6,32 @@ let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14 let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30 let _3: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - let mut _5: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27 - let mut _6: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _7: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _8: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _13: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _15: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _16: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _18: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _19: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _20: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _14: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _16: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _18: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _19: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 + let _8: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _9: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _10: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _21: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { - debug left_val => _9; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _10; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _14: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug left_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _9; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _13: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug kind => _14; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug kind => _13; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -53,58 +52,50 @@ StorageDead(_3); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 StorageLive(_4); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 - StorageLive(_5); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - _5 = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - Deinit(_4); // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - ((_4 as Some).0: i32) = move _5; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - StorageDead(_5); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28 + StorageLive(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _6 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _7 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } - _8 = _21; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_6.0: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_6.1: &i32) = move _8; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = _20; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_5.0: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_5.1: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _8 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _9 = (_6.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _10 = (_6.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _9 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _13 = (*_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = Eq(move _13, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _11 = Not(move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = (*_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = Eq(move _12, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _11) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _10 = Not(move _11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _10) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { - StorageLive(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_14) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = _8; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = _16; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _17 = _9; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = _17; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = _9; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = _18; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _19 = _10; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = _19; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_20) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _15 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _16, move _18, move _20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_19) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _14 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } @@ -114,10 +105,10 @@ } bb2: { - StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 1e6da388e3a25f0ab6b5a4e8cdd800aa0754dc55..40e7b74453a7c01ba220bcaa396be59f3040226b 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -32,7 +32,6 @@ fn num_to_digit(_1: char) -> u32 { StorageLive(_2); // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 _2 = _1; // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 StorageLive(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - _5 = const 8_u32; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageLive(_7); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageLive(_8); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL diff --git a/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff b/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff index 5cf3312cd641b528b4b737184e8c7d0b027e50b2..887c7b01f432752543e80dc6a223a7306fc6018a 100644 --- a/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff +++ b/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff @@ -25,10 +25,7 @@ StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- _7 = _2; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- _11 = _7; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21 _5 = const N; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 diff --git a/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff b/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff index f72aee0e502804108014d4fddebdabd4aae6f66c..51d5f1acdab839683cb3b653d26bf1e94ec9c102 100644 --- a/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff +++ b/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff @@ -31,10 +31,7 @@ StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- _14 = _7; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:18:20: 18:21 _5 = const N; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 diff --git a/src/test/mir-opt/lower_array_len.array_len.SimplifyLocals.diff b/src/test/mir-opt/lower_array_len.array_len.SimplifyLocals.diff index 20e2685aba59f69656e5cbe1080ca84af6122ebf..3c26cf32a76c7391fa240c536a1c63c5637e9571 100644 --- a/src/test/mir-opt/lower_array_len.array_len.SimplifyLocals.diff +++ b/src/test/mir-opt/lower_array_len.array_len.SimplifyLocals.diff @@ -11,10 +11,7 @@ bb0: { - StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14 - StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14 -- _3 = _1; // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14 - StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14 -- _4 = _3; // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14 -- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14 - StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:31:7: 31:8 _0 = const N; // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:31:5: 31:14 diff --git a/src/test/mir-opt/lower_array_len.array_len_by_value.SimplifyLocals.diff b/src/test/mir-opt/lower_array_len.array_len_by_value.SimplifyLocals.diff index 7e7b708145f40a4ebd2b6c6dd298c3d7c650ab4a..7a94217fa8b096fdef8e800c67fb1f484d1764da 100644 --- a/src/test/mir-opt/lower_array_len.array_len_by_value.SimplifyLocals.diff +++ b/src/test/mir-opt/lower_array_len.array_len_by_value.SimplifyLocals.diff @@ -11,10 +11,7 @@ bb0: { - StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14 - StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14 -- _3 = &_1; // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14 - StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14 -- _4 = _3; // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14 -- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14 - StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:38:7: 38:8 _0 = const N; // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:38:5: 38:14 diff --git a/src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir b/src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir index d388376ca483ab90c1d15c924ff05f3bd399fad2..39100316597e31117c959fdd95f1b6e7c319c1d8 100644 --- a/src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir +++ b/src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir @@ -8,10 +8,9 @@ fn too_complex(_1: Result) -> Option { let _4: i32; // in scope 0 at $DIR/separate_const_switch.rs:16:16: 16:17 let mut _5: i32; // in scope 0 at $DIR/separate_const_switch.rs:16:44: 16:45 let _6: usize; // in scope 0 at $DIR/separate_const_switch.rs:17:17: 17:18 - let mut _7: usize; // in scope 0 at $DIR/separate_const_switch.rs:17:42: 17:43 - let _8: i32; // in scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 - let mut _9: i32; // in scope 0 at $DIR/separate_const_switch.rs:20:42: 20:43 - let _10: usize; // in scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29 + let _7: i32; // in scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 + let mut _8: i32; // in scope 0 at $DIR/separate_const_switch.rs:20:42: 20:43 + let _9: usize; // in scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29 scope 1 { debug v => _4; // in scope 1 at $DIR/separate_const_switch.rs:16:16: 16:17 } @@ -19,10 +18,10 @@ fn too_complex(_1: Result) -> Option { debug r => _6; // in scope 2 at $DIR/separate_const_switch.rs:17:17: 17:18 } scope 3 { - debug v => _8; // in scope 3 at $DIR/separate_const_switch.rs:20:31: 20:32 + debug v => _7; // in scope 3 at $DIR/separate_const_switch.rs:20:31: 20:32 } scope 4 { - debug r => _10; // in scope 4 at $DIR/separate_const_switch.rs:21:28: 21:29 + debug r => _9; // in scope 4 at $DIR/separate_const_switch.rs:21:28: 21:29 } bb0: { @@ -33,19 +32,11 @@ fn too_complex(_1: Result) -> Option { bb1: { StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:17:17: 17:18 - _6 = ((_1 as Err).0: usize); // scope 0 at $DIR/separate_const_switch.rs:17:17: 17:18 - StorageLive(_7); // scope 2 at $DIR/separate_const_switch.rs:17:42: 17:43 - _7 = _6; // scope 2 at $DIR/separate_const_switch.rs:17:42: 17:43 - Deinit(_2); // scope 2 at $DIR/separate_const_switch.rs:17:23: 17:44 - ((_2 as Break).0: usize) = move _7; // scope 2 at $DIR/separate_const_switch.rs:17:23: 17:44 - discriminant(_2) = 1; // scope 2 at $DIR/separate_const_switch.rs:17:23: 17:44 - StorageDead(_7); // scope 2 at $DIR/separate_const_switch.rs:17:43: 17:44 StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:17:43: 17:44 - StorageLive(_10); // scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29 - _10 = ((_2 as Break).0: usize); // scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29 + StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29 Deinit(_0); // scope 4 at $DIR/separate_const_switch.rs:21:34: 21:38 discriminant(_0) = 0; // scope 4 at $DIR/separate_const_switch.rs:21:34: 21:38 - StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:21:37: 21:38 + StorageDead(_9); // scope 0 at $DIR/separate_const_switch.rs:21:37: 21:38 goto -> bb3; // scope 0 at $DIR/separate_const_switch.rs:21:37: 21:38 } @@ -59,15 +50,15 @@ fn too_complex(_1: Result) -> Option { discriminant(_2) = 0; // scope 1 at $DIR/separate_const_switch.rs:16:22: 16:46 StorageDead(_5); // scope 1 at $DIR/separate_const_switch.rs:16:45: 16:46 StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:16:45: 16:46 - StorageLive(_8); // scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 - _8 = ((_2 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 - StorageLive(_9); // scope 3 at $DIR/separate_const_switch.rs:20:42: 20:43 - _9 = _8; // scope 3 at $DIR/separate_const_switch.rs:20:42: 20:43 + StorageLive(_7); // scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 + _7 = ((_2 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 + StorageLive(_8); // scope 3 at $DIR/separate_const_switch.rs:20:42: 20:43 + _8 = _7; // scope 3 at $DIR/separate_const_switch.rs:20:42: 20:43 Deinit(_0); // scope 3 at $DIR/separate_const_switch.rs:20:37: 20:44 - ((_0 as Some).0: i32) = move _9; // scope 3 at $DIR/separate_const_switch.rs:20:37: 20:44 + ((_0 as Some).0: i32) = move _8; // scope 3 at $DIR/separate_const_switch.rs:20:37: 20:44 discriminant(_0) = 1; // scope 3 at $DIR/separate_const_switch.rs:20:37: 20:44 - StorageDead(_9); // scope 3 at $DIR/separate_const_switch.rs:20:43: 20:44 - StorageDead(_8); // scope 0 at $DIR/separate_const_switch.rs:20:43: 20:44 + StorageDead(_8); // scope 3 at $DIR/separate_const_switch.rs:20:43: 20:44 + StorageDead(_7); // scope 0 at $DIR/separate_const_switch.rs:20:43: 20:44 goto -> bb3; // scope 0 at $DIR/separate_const_switch.rs:20:43: 20:44 } diff --git a/src/test/mir-opt/simplify-locals.rs b/src/test/mir-opt/simplify-locals.rs index dca8f30c89494774fedf3762e9646818569fe43b..5862cf2eb29057ebf3472903f45ea094bc1e145d 100644 --- a/src/test/mir-opt/simplify-locals.rs +++ b/src/test/mir-opt/simplify-locals.rs @@ -1,4 +1,4 @@ -// compile-flags: -C overflow-checks=off +// unit-test: SimplifyLocals #![feature(box_syntax)] #![feature(thread_local)] diff --git a/src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff index 2995d1e86e3bf0ee76756a4599ad0787ee1a9edb..dd2d79549612355f1f565b1c8f87295461ec3f2f 100644 --- a/src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff @@ -20,11 +20,12 @@ - StorageLive(_3); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 - StorageLive(_4); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 - _4 = &_1; // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 -- _3 = _4; // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 +- _3 = &(*_4); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 - _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 - StorageDead(_3); // scope 1 at $DIR/simplify-locals.rs:16:25: 16:26 - StorageDead(_4); // scope 1 at $DIR/simplify-locals.rs:16:26: 16:27 - StorageDead(_2); // scope 1 at $DIR/simplify-locals.rs:16:26: 16:27 + _0 = const (); // scope 0 at $DIR/simplify-locals.rs:13:8: 17:2 StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:17:1: 17:2 return; // scope 0 at $DIR/simplify-locals.rs:17:2: 17:2 } diff --git a/src/test/mir-opt/simplify_locals.d1.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals.d1.SimplifyLocals.diff index 6d76b51cb193c51029c1e8c3972e550f3eb96a91..3be73ecfcb812427fa0dffa600dee07274d558d1 100644 --- a/src/test/mir-opt/simplify_locals.d1.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals.d1.SimplifyLocals.diff @@ -12,6 +12,7 @@ - Deinit(_1); // scope 0 at $DIR/simplify-locals.rs:22:13: 22:17 - discriminant(_1) = 0; // scope 0 at $DIR/simplify-locals.rs:22:13: 22:17 - StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:22:17: 22:18 + _0 = const (); // scope 0 at $DIR/simplify-locals.rs:20:9: 23:2 return; // scope 0 at $DIR/simplify-locals.rs:23:2: 23:2 } } diff --git a/src/test/mir-opt/simplify_locals.d2.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals.d2.SimplifyLocals.diff index 4a386d46468c9bf94fd8b8634d75ec61543f4db0..641f64fd9b7cd22b35fdaa211ad6f08890be6daf 100644 --- a/src/test/mir-opt/simplify_locals.d2.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals.d2.SimplifyLocals.diff @@ -17,17 +17,12 @@ - discriminant(_3) = 0; // scope 0 at $DIR/simplify-locals.rs:28:11: 28:15 - Deinit(_2); // scope 0 at $DIR/simplify-locals.rs:28:6: 28:16 - (_2.0: i32) = const 10_i32; // scope 0 at $DIR/simplify-locals.rs:28:6: 28:16 -- (_2.1: E) = const E::A; // scope 0 at $DIR/simplify-locals.rs:28:6: 28:16 -- // mir::Constant -- // + span: $DIR/simplify-locals.rs:28:6: 28:16 -- // + literal: Const { ty: E, val: Value(Scalar(0x00)) } +- (_2.1: E) = move _3; // scope 0 at $DIR/simplify-locals.rs:28:6: 28:16 - StorageDead(_3); // scope 0 at $DIR/simplify-locals.rs:28:15: 28:16 -- (_2.1: E) = const E::B; // scope 0 at $DIR/simplify-locals.rs:28:5: 28:26 -- // mir::Constant -- // + span: $DIR/simplify-locals.rs:28:5: 28:26 -- // + literal: Const { ty: E, val: Value(Scalar(0x01)) } +- (_2.1: E) = move _1; // scope 0 at $DIR/simplify-locals.rs:28:5: 28:26 - StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:28:25: 28:26 - StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:28:26: 28:27 + _0 = const (); // scope 0 at $DIR/simplify-locals.rs:26:9: 29:2 return; // scope 0 at $DIR/simplify-locals.rs:29:2: 29:2 } } diff --git a/src/test/mir-opt/simplify_locals.r.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals.r.SimplifyLocals.diff index cf5785438be8792cabf59033456b7d432526ac63..85cf398d316939650d99bb46100dad1cbc0ae696 100644 --- a/src/test/mir-opt/simplify_locals.r.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals.r.SimplifyLocals.diff @@ -23,6 +23,7 @@ - StorageLive(_3); // scope 2 at $DIR/simplify-locals.rs:36:13: 36:19 - _3 = &mut _1; // scope 2 at $DIR/simplify-locals.rs:36:13: 36:19 - StorageDead(_3); // scope 2 at $DIR/simplify-locals.rs:36:19: 36:20 + _0 = const (); // scope 0 at $DIR/simplify-locals.rs:32:8: 37:2 StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:37:1: 37:2 return; // scope 0 at $DIR/simplify-locals.rs:37:2: 37:2 } diff --git a/src/test/mir-opt/simplify_locals.t1.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals.t1.SimplifyLocals.diff index 54b167bc68e11174ece8da662d18cda6689a7ab5..991a0721cca302bfaefebf1325988c555f1e2a50 100644 --- a/src/test/mir-opt/simplify_locals.t1.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals.t1.SimplifyLocals.diff @@ -15,6 +15,7 @@ - _1 = (*_2); // scope 1 at $DIR/simplify-locals.rs:44:14: 44:15 - StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:44:17: 44:18 - StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:44:17: 44:18 + _0 = const (); // scope 0 at $DIR/simplify-locals.rs:42:9: 45:2 return; // scope 0 at $DIR/simplify-locals.rs:45:2: 45:2 } } diff --git a/src/test/mir-opt/simplify_locals.t2.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals.t2.SimplifyLocals.diff index 06216efcec04e3127946cd4509af3b4f3ead63e5..6c9ed96e78ffe401f2668f3aec5f04d488a1112c 100644 --- a/src/test/mir-opt/simplify_locals.t2.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals.t2.SimplifyLocals.diff @@ -15,6 +15,7 @@ - _1 = &mut (*_2); // scope 1 at $DIR/simplify-locals.rs:50:14: 50:20 - StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:50:22: 50:23 - StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:50:22: 50:23 + _0 = const (); // scope 0 at $DIR/simplify-locals.rs:48:9: 51:2 return; // scope 0 at $DIR/simplify-locals.rs:51:2: 51:2 } } diff --git a/src/test/mir-opt/simplify_locals.t3.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals.t3.SimplifyLocals.diff index ee9d2934afd4093dea5e0b59b63ba1bb0f77aa75..2d5fb352f8be3b013602ed76b175ff5e11a1d8a9 100644 --- a/src/test/mir-opt/simplify_locals.t3.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals.t3.SimplifyLocals.diff @@ -19,6 +19,7 @@ - StorageDead(_3); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24 - StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24 - StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24 + _0 = const (); // scope 0 at $DIR/simplify-locals.rs:54:9: 57:2 return; // scope 0 at $DIR/simplify-locals.rs:57:2: 57:2 } } diff --git a/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff index 55b9838031cb3de30c946c0d38dc04e2816df4cc..1bba1e9e88a4ed1dc9ff90073304efbe7afa3aed 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff @@ -47,10 +47,6 @@ - StorageLive(_9); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:34 - StorageLive(_10); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:30 - StorageLive(_11); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28 -- Deinit(_11); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28 -- (_11.0: u8) = const 40_u8; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28 -- _10 = const 40_u8; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:30 -- _9 = const 42_u8; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:34 - StorageDead(_10); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:33: 16:34 - _8 = use_u8(const 42_u8) -> bb2; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:5: 16:35 + StorageDead(_1); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:22: 14:23 diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff index aa9f0c18d09ac77d44590482d9743b5f60657502..fc1726f98cb1de6ad495794a5725c6dfda364df9 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff @@ -15,8 +15,6 @@ } bb0: { -- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:11: 4:12 -- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:11: 4:12 _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:11: 4:12 switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:5: 4:12 } @@ -35,7 +33,6 @@ } bb3: { -- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:2: 8:2 } } diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff index aa9f0c18d09ac77d44590482d9743b5f60657502..fc1726f98cb1de6ad495794a5725c6dfda364df9 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff @@ -15,8 +15,6 @@ } bb0: { -- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:11: 4:12 -- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:11: 4:12 _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:11: 4:12 switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:5: 4:12 } @@ -35,7 +33,6 @@ } bb3: { -- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:2: 8:2 } } diff --git a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff index 1e0071353f9272e190bdee45e0bafd04a9e21000..15de0839c22fa8bb55777af9fe59e4e83bde0dd1 100644 --- a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff +++ b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff @@ -19,15 +19,12 @@ + debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:21:9: 21:10 } scope 2 { -- debug e => _6; // in scope 2 at $DIR/simplify_try.rs:22:13: 22:14 -+ debug e => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:22:13: 22:14 + debug e => _6; // in scope 2 at $DIR/simplify_try.rs:22:13: 22:14 scope 5 (inlined >::from) { // at $DIR/simplify_try.rs:22:37: 22:50 -- debug t => _9; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ debug t => ((_0 as Err).0: i32); // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug t => _9; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL } scope 6 (inlined from_error::) { // at $DIR/simplify_try.rs:22:26: 22:51 -- debug e => _8; // in scope 6 at $DIR/simplify_try.rs:12:21: 12:22 -+ debug e => ((_0 as Err).0: i32); // in scope 6 at $DIR/simplify_try.rs:12:21: 12:22 + debug e => _8; // in scope 6 at $DIR/simplify_try.rs:12:21: 12:22 } } scope 3 { @@ -83,30 +80,20 @@ } bb2: { -- StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:22:13: 22:14 -- _6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:22:13: 22:14 -- StorageLive(_8); // scope 2 at $DIR/simplify_try.rs:22:37: 22:50 -- StorageLive(_9); // scope 2 at $DIR/simplify_try.rs:22:48: 22:49 -- _9 = _6; // scope 2 at $DIR/simplify_try.rs:22:48: 22:49 -- _8 = move _9; // scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -- StorageDead(_9); // scope 2 at $DIR/simplify_try.rs:22:49: 22:50 -- ((_0 as Err).0: i32) = move _8; // scope 6 at $DIR/simplify_try.rs:13:9: 13:10 -+ nop; // scope 0 at $DIR/simplify_try.rs:22:13: 22:14 -+ ((_0 as Err).0: i32) = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:22:13: 22:14 -+ nop; // scope 2 at $DIR/simplify_try.rs:22:37: 22:50 -+ nop; // scope 2 at $DIR/simplify_try.rs:22:48: 22:49 -+ nop; // scope 2 at $DIR/simplify_try.rs:22:48: 22:49 -+ nop; // scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ nop; // scope 2 at $DIR/simplify_try.rs:22:49: 22:50 -+ nop; // scope 6 at $DIR/simplify_try.rs:13:9: 13:10 + StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:22:13: 22:14 + nop; // scope 0 at $DIR/simplify_try.rs:22:13: 22:14 + StorageLive(_8); // scope 2 at $DIR/simplify_try.rs:22:37: 22:50 + StorageLive(_9); // scope 2 at $DIR/simplify_try.rs:22:48: 22:49 + nop; // scope 2 at $DIR/simplify_try.rs:22:48: 22:49 + nop; // scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + StorageDead(_9); // scope 2 at $DIR/simplify_try.rs:22:49: 22:50 + nop; // scope 6 at $DIR/simplify_try.rs:13:9: 13:10 Deinit(_0); // scope 6 at $DIR/simplify_try.rs:13:5: 13:11 discriminant(_0) = 1; // scope 6 at $DIR/simplify_try.rs:13:5: 13:11 -- StorageDead(_8); // scope 2 at $DIR/simplify_try.rs:22:50: 22:51 -- StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:22:50: 22:51 + StorageDead(_8); // scope 2 at $DIR/simplify_try.rs:22:50: 22:51 + StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:22:50: 22:51 - StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:24:6: 24:7 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:26:1: 26:2 -+ nop; // scope 2 at $DIR/simplify_try.rs:22:50: 22:51 -+ nop; // scope 0 at $DIR/simplify_try.rs:22:50: 22:51 + nop; // scope 0 at $DIR/simplify_try.rs:24:6: 24:7 + nop; // scope 0 at $DIR/simplify_try.rs:26:1: 26:2 return; // scope 0 at $DIR/simplify_try.rs:26:2: 26:2 diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir b/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir index 4407e8e36fdd07d0cad0a4e780c9235426b553c0..b9252df6f3e2e552eef24f3f7c5ba9c0ca3d528c 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir @@ -5,16 +5,19 @@ fn try_identity(_1: Result) -> Result { let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:20:41: 20:57 let mut _2: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:21:19: 21:33 let mut _3: isize; // in scope 0 at $DIR/simplify_try.rs:22:9: 22:15 + let _4: i32; // in scope 0 at $DIR/simplify_try.rs:22:13: 22:14 + let mut _5: i32; // in scope 0 at $DIR/simplify_try.rs:22:37: 22:50 + let mut _6: i32; // in scope 0 at $DIR/simplify_try.rs:22:48: 22:49 scope 1 { debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:21:9: 21:10 } scope 2 { - debug e => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:22:13: 22:14 + debug e => _4; // in scope 2 at $DIR/simplify_try.rs:22:13: 22:14 scope 5 (inlined >::from) { // at $DIR/simplify_try.rs:22:37: 22:50 - debug t => ((_0 as Err).0: i32); // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug t => _6; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL } scope 6 (inlined from_error::) { // at $DIR/simplify_try.rs:22:26: 22:51 - debug e => ((_0 as Err).0: i32); // in scope 6 at $DIR/simplify_try.rs:12:21: 12:22 + debug e => _5; // in scope 6 at $DIR/simplify_try.rs:12:21: 12:22 } } scope 3 { @@ -38,9 +41,14 @@ fn try_identity(_1: Result) -> Result { } bb2: { - ((_0 as Err).0: i32) = ((_2 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:22:13: 22:14 + StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:22:13: 22:14 + StorageLive(_5); // scope 2 at $DIR/simplify_try.rs:22:37: 22:50 + StorageLive(_6); // scope 2 at $DIR/simplify_try.rs:22:48: 22:49 + StorageDead(_6); // scope 2 at $DIR/simplify_try.rs:22:49: 22:50 Deinit(_0); // scope 6 at $DIR/simplify_try.rs:13:5: 13:11 discriminant(_0) = 1; // scope 6 at $DIR/simplify_try.rs:13:5: 13:11 + StorageDead(_5); // scope 2 at $DIR/simplify_try.rs:22:50: 22:51 + StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:22:50: 22:51 return; // scope 0 at $DIR/simplify_try.rs:26:2: 26:2 } } diff --git a/src/test/mir-opt/tls-access.rs b/src/test/mir-opt/tls-access.rs index b585fd0c808e5d514388890f61c9260c28e7a175..9036c57556ddaf109c7c418f3216cba6d2fa6f90 100644 --- a/src/test/mir-opt/tls-access.rs +++ b/src/test/mir-opt/tls-access.rs @@ -11,3 +11,4 @@ fn main() { } // EMIT_MIR tls_access.main.SimplifyCfg-final.after.mir +// compile-flags: -Zmir-opt-level=0 diff --git a/src/test/mir-opt/tls_access.main.SimplifyCfg-final.after.mir b/src/test/mir-opt/tls_access.main.SimplifyCfg-final.after.mir index 78ddabd0d31fe4dae21024c3da9dedd222471cd4..de19a226e8f75709d2807b91d7985a6b4369713d 100644 --- a/src/test/mir-opt/tls_access.main.SimplifyCfg-final.after.mir +++ b/src/test/mir-opt/tls_access.main.SimplifyCfg-final.after.mir @@ -14,8 +14,6 @@ fn main() -> () { bb0: { StorageLive(_1); // scope 1 at $DIR/tls-access.rs:8:13: 8:14 StorageLive(_2); // scope 1 at $DIR/tls-access.rs:8:18: 8:21 - _2 = &/*tls*/ mut FOO; // scope 1 at $DIR/tls-access.rs:8:18: 8:21 - _1 = &(*_2); // scope 1 at $DIR/tls-access.rs:8:17: 8:21 StorageLive(_3); // scope 2 at $DIR/tls-access.rs:9:9: 9:12 _3 = &/*tls*/ mut FOO; // scope 2 at $DIR/tls-access.rs:9:9: 9:12 (*_3) = const 42_u8; // scope 2 at $DIR/tls-access.rs:9:9: 9:17 diff --git a/src/test/mir-opt/uninhabited_enum.process_never.SimplifyLocals.after.mir b/src/test/mir-opt/uninhabited_enum.process_never.SimplifyLocals.after.mir index c17fe3bb757575195e4880e2312a579449ce294a..aa6a4cac350b53468a52551964f4a604408c39a4 100644 --- a/src/test/mir-opt/uninhabited_enum.process_never.SimplifyLocals.after.mir +++ b/src/test/mir-opt/uninhabited_enum.process_never.SimplifyLocals.after.mir @@ -12,7 +12,6 @@ fn process_never(_1: *const !) -> () { bb0: { StorageLive(_2); // scope 0 at $DIR/uninhabited-enum.rs:8:8: 8:14 - _2 = &(*_1); // scope 2 at $DIR/uninhabited-enum.rs:8:26: 8:33 StorageDead(_2); // scope 0 at $DIR/uninhabited-enum.rs:9:1: 9:2 unreachable; // scope 0 at $DIR/uninhabited-enum.rs:7:39: 9:2 } diff --git a/src/test/mir-opt/uninhabited_enum.process_void.SimplifyLocals.after.mir b/src/test/mir-opt/uninhabited_enum.process_void.SimplifyLocals.after.mir index eeaabb7b9884eb16812f8f5a1cb174051e21e510..9fd4b1b54e73d5ab94feea038e8bf8774709af97 100644 --- a/src/test/mir-opt/uninhabited_enum.process_void.SimplifyLocals.after.mir +++ b/src/test/mir-opt/uninhabited_enum.process_void.SimplifyLocals.after.mir @@ -12,7 +12,6 @@ fn process_void(_1: *const Void) -> () { bb0: { StorageLive(_2); // scope 0 at $DIR/uninhabited-enum.rs:14:8: 14:14 - _2 = &(*_1); // scope 2 at $DIR/uninhabited-enum.rs:14:26: 14:33 StorageDead(_2); // scope 0 at $DIR/uninhabited-enum.rs:17:1: 17:2 return; // scope 0 at $DIR/uninhabited-enum.rs:17:2: 17:2 } diff --git a/src/test/mir-opt/unusual-item-types.rs b/src/test/mir-opt/unusual-item-types.rs index c68ec21a039fdf16ae59fa1623cddf7a2f64e0cf..670f61cd5ce3aff53a6a51ef1364b1e06bb94509 100644 --- a/src/test/mir-opt/unusual-item-types.rs +++ b/src/test/mir-opt/unusual-item-types.rs @@ -1,6 +1,6 @@ // Test that we don't ICE when trying to dump MIR for unusual item types and // that we don't create filenames containing `<` and `>` - +// compile-flags: -Zmir-opt-level=0 // EMIT_MIR_FOR_EACH_BIT_WIDTH struct A; diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir index b6767077d429a1a1940cfd6e7205798638e3dbb0..3c94fbddc4421622cbbefab82507734cba5b0b1f 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir @@ -9,7 +9,6 @@ fn change_loop_body() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 - _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2 return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2 } diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir index b6767077d429a1a1940cfd6e7205798638e3dbb0..3c94fbddc4421622cbbefab82507734cba5b0b1f 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir @@ -9,7 +9,6 @@ fn change_loop_body() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 - _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2 return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2 }