From ff855547f463aecb0c86f8f78ebc605ef097664b Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sat, 6 May 2023 23:20:58 -0400 Subject: [PATCH] Rename InstCombine to InstSimplify --- .../src/{instcombine.rs => instsimplify.rs} | 50 +++++++++---------- compiler/rustc_mir_transform/src/lib.rs | 4 +- compiler/rustc_mir_transform/src/simplify.rs | 4 +- compiler/rustc_session/src/options.rs | 2 +- ...ff => bool_compare.opt1.InstSimplify.diff} | 4 +- ...ff => bool_compare.opt2.InstSimplify.diff} | 4 +- ...ff => bool_compare.opt3.InstSimplify.diff} | 4 +- ...ff => bool_compare.opt4.InstSimplify.diff} | 4 +- tests/mir-opt/bool_compare.rs | 10 ++-- ...diff => casts.redundant.InstSimplify.diff} | 4 +- tests/mir-opt/casts.rs | 2 +- ...combine_array_len.norm2.InstSimplify.diff} | 4 +- tests/mir-opt/combine_array_len.rs | 4 +- tests/mir-opt/combine_clone_of_primitives.rs | 4 +- ...imitives.{impl#0}-clone.InstSimplify.diff} | 4 +- ...ansmutes.adt_transmutes.InstSimplify.diff} | 4 +- ...tes.identity_transmutes.InstSimplify.diff} | 4 +- ...utes.integer_transmutes.InstSimplify.diff} | 4 +- tests/mir-opt/combine_transmutes.rs | 8 +-- tests/mir-opt/const_prop/slice_len.rs | 2 +- ...ont_yeet_assert.generic.InstSimplify.diff} | 4 +- tests/mir-opt/dont_yeet_assert.rs | 4 +- ....diff => equal_true.opt.InstSimplify.diff} | 4 +- tests/mir-opt/equal_true.rs | 4 +- ...tch_targets.assert_zero.InstSimplify.diff} | 16 +++--- ... instsimplify_duplicate_switch_targets.rs} | 4 +- ...trinsic_asserts.generic.InstSimplify.diff} | 4 +- ...ntrinsic_asserts.panics.InstSimplify.diff} | 4 +- ...insic_asserts.removable.InstSimplify.diff} | 4 +- tests/mir-opt/intrinsic_asserts.rs | 6 +-- ...e.diff => issue_78192.f.InstSimplify.diff} | 4 +- tests/mir-opt/issue_78192.rs | 2 +- ... => not_equal_false.opt.InstSimplify.diff} | 4 +- tests/mir-opt/not_equal_false.rs | 4 +- tests/ui/lint/invalid_value-polymorphic.rs | 2 +- 35 files changed, 100 insertions(+), 100 deletions(-) rename compiler/rustc_mir_transform/src/{instcombine.rs => instsimplify.rs} (87%) rename tests/mir-opt/{bool_compare.opt1.InstCombine.diff => bool_compare.opt1.InstSimplify.diff} (95%) rename tests/mir-opt/{bool_compare.opt2.InstCombine.diff => bool_compare.opt2.InstSimplify.diff} (95%) rename tests/mir-opt/{bool_compare.opt3.InstCombine.diff => bool_compare.opt3.InstSimplify.diff} (95%) rename tests/mir-opt/{bool_compare.opt4.InstCombine.diff => bool_compare.opt4.InstSimplify.diff} (95%) rename tests/mir-opt/{casts.redundant.InstCombine.diff => casts.redundant.InstSimplify.diff} (93%) rename tests/mir-opt/{combine_array_len.norm2.InstCombine.diff => combine_array_len.norm2.InstSimplify.diff} (98%) rename tests/mir-opt/{combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff => combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff} (98%) rename tests/mir-opt/{combine_transmutes.adt_transmutes.InstCombine.diff => combine_transmutes.adt_transmutes.InstSimplify.diff} (99%) rename tests/mir-opt/{combine_transmutes.identity_transmutes.InstCombine.diff => combine_transmutes.identity_transmutes.InstSimplify.diff} (95%) rename tests/mir-opt/{combine_transmutes.integer_transmutes.InstCombine.diff => combine_transmutes.integer_transmutes.InstSimplify.diff} (93%) rename tests/mir-opt/{dont_yeet_assert.generic.InstCombine.diff => dont_yeet_assert.generic.InstSimplify.diff} (93%) rename tests/mir-opt/{equal_true.opt.InstCombine.diff => equal_true.opt.InstSimplify.diff} (95%) rename tests/mir-opt/{instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff => instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff} (52%) rename tests/mir-opt/{instcombine_duplicate_switch_targets.rs => instsimplify_duplicate_switch_targets.rs} (82%) rename tests/mir-opt/{intrinsic_asserts.generic.InstCombine.diff => intrinsic_asserts.generic.InstSimplify.diff} (96%) rename tests/mir-opt/{intrinsic_asserts.panics.InstCombine.diff => intrinsic_asserts.panics.InstSimplify.diff} (97%) rename tests/mir-opt/{intrinsic_asserts.removable.InstCombine.diff => intrinsic_asserts.removable.InstSimplify.diff} (97%) rename tests/mir-opt/{issue_78192.f.InstCombine.diff => issue_78192.f.InstSimplify.diff} (95%) rename tests/mir-opt/{not_equal_false.opt.InstCombine.diff => not_equal_false.opt.InstSimplify.diff} (95%) diff --git a/compiler/rustc_mir_transform/src/instcombine.rs b/compiler/rustc_mir_transform/src/instsimplify.rs similarity index 87% rename from compiler/rustc_mir_transform/src/instcombine.rs rename to compiler/rustc_mir_transform/src/instsimplify.rs index 432852a1fdd..6bff535586a 100644 --- a/compiler/rustc_mir_transform/src/instcombine.rs +++ b/compiler/rustc_mir_transform/src/instsimplify.rs @@ -1,6 +1,6 @@ //! Performs various peephole optimizations. -use crate::simplify::combine_duplicate_switch_targets; +use crate::simplify::simplify_duplicate_switch_targets; use crate::MirPass; use rustc_hir::Mutability; use rustc_middle::mir::*; @@ -10,15 +10,15 @@ use rustc_middle::ty::{self, ParamEnv, SubstsRef, Ty, TyCtxt}; use rustc_span::symbol::Symbol; use rustc_target::abi::FieldIdx; -pub struct InstCombine; +pub struct InstSimplify; -impl<'tcx> MirPass<'tcx> for InstCombine { +impl<'tcx> MirPass<'tcx> for InstSimplify { fn is_enabled(&self, sess: &rustc_session::Session) -> bool { sess.mir_opt_level() > 0 } fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let ctx = InstCombineContext { + let ctx = InstSimplifyContext { tcx, local_decls: &body.local_decls, param_env: tcx.param_env_reveal_all_normalized(body.source.def_id()), @@ -27,43 +27,43 @@ impl<'tcx> MirPass<'tcx> for InstCombine { for statement in block.statements.iter_mut() { match statement.kind { StatementKind::Assign(box (_place, ref mut rvalue)) => { - ctx.combine_bool_cmp(&statement.source_info, rvalue); - ctx.combine_ref_deref(&statement.source_info, rvalue); - ctx.combine_len(&statement.source_info, rvalue); - ctx.combine_cast(&statement.source_info, rvalue); + ctx.simplify_bool_cmp(&statement.source_info, rvalue); + ctx.simplify_ref_deref(&statement.source_info, rvalue); + ctx.simplify_len(&statement.source_info, rvalue); + ctx.simplify_cast(&statement.source_info, rvalue); } _ => {} } } - ctx.combine_primitive_clone( + ctx.simplify_primitive_clone( &mut block.terminator.as_mut().unwrap(), &mut block.statements, ); - ctx.combine_intrinsic_assert( + ctx.simplify_intrinsic_assert( &mut block.terminator.as_mut().unwrap(), &mut block.statements, ); - combine_duplicate_switch_targets(block.terminator.as_mut().unwrap()); + simplify_duplicate_switch_targets(block.terminator.as_mut().unwrap()); } } } -struct InstCombineContext<'tcx, 'a> { +struct InstSimplifyContext<'tcx, 'a> { tcx: TyCtxt<'tcx>, local_decls: &'a LocalDecls<'tcx>, param_env: ParamEnv<'tcx>, } -impl<'tcx> InstCombineContext<'tcx, '_> { - fn should_combine(&self, source_info: &SourceInfo, rvalue: &Rvalue<'tcx>) -> bool { +impl<'tcx> InstSimplifyContext<'tcx, '_> { + fn should_simplify(&self, source_info: &SourceInfo, rvalue: &Rvalue<'tcx>) -> bool { self.tcx.consider_optimizing(|| { - format!("InstCombine - Rvalue: {:?} SourceInfo: {:?}", rvalue, source_info) + format!("InstSimplify - Rvalue: {:?} SourceInfo: {:?}", rvalue, source_info) }) } /// Transform boolean comparisons into logical operations. - fn combine_bool_cmp(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { + fn simplify_bool_cmp(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { match rvalue { Rvalue::BinaryOp(op @ (BinOp::Eq | BinOp::Ne), box (a, b)) => { let new = match (op, self.try_eval_bool(a), self.try_eval_bool(b)) { @@ -94,7 +94,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { _ => None, }; - if let Some(new) = new && self.should_combine(source_info, rvalue) { + if let Some(new) = new && self.should_simplify(source_info, rvalue) { *rvalue = new; } } @@ -109,14 +109,14 @@ impl<'tcx> InstCombineContext<'tcx, '_> { } /// Transform "&(*a)" ==> "a". - fn combine_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { + fn simplify_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { if let Rvalue::Ref(_, _, place) = rvalue { if let Some((base, ProjectionElem::Deref)) = place.as_ref().last_projection() { if rvalue.ty(self.local_decls, self.tcx) != base.ty(self.local_decls, self.tcx).ty { return; } - if !self.should_combine(source_info, rvalue) { + if !self.should_simplify(source_info, rvalue) { return; } @@ -129,11 +129,11 @@ impl<'tcx> InstCombineContext<'tcx, '_> { } /// Transform "Len([_; N])" ==> "N". - fn combine_len(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { + fn simplify_len(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { if let Rvalue::Len(ref place) = *rvalue { let place_ty = place.ty(self.local_decls, self.tcx).ty; if let ty::Array(_, len) = *place_ty.kind() { - if !self.should_combine(source_info, rvalue) { + if !self.should_simplify(source_info, rvalue) { return; } @@ -144,7 +144,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { } } - fn combine_cast(&self, _source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { + fn simplify_cast(&self, _source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { if let Rvalue::Cast(kind, operand, cast_ty) = rvalue { let operand_ty = operand.ty(self.local_decls, self.tcx); if operand_ty == *cast_ty { @@ -196,7 +196,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { } } - fn combine_primitive_clone( + fn simplify_primitive_clone( &self, terminator: &mut Terminator<'tcx>, statements: &mut Vec>, @@ -239,7 +239,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { if !self.tcx.consider_optimizing(|| { format!( - "InstCombine - Call: {:?} SourceInfo: {:?}", + "InstSimplify - Call: {:?} SourceInfo: {:?}", (fn_def_id, fn_substs), terminator.source_info ) @@ -262,7 +262,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { terminator.kind = TerminatorKind::Goto { target: destination_block }; } - fn combine_intrinsic_assert( + fn simplify_intrinsic_assert( &self, terminator: &mut Terminator<'tcx>, _statements: &mut Vec>, diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 8d9a22ea30d..f25a9f042c4 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -73,7 +73,7 @@ mod ffi_unwind_calls; mod function_item_references; mod generator; mod inline; -mod instcombine; +mod instsimplify; mod large_enums; mod lower_intrinsics; mod lower_slice_len; @@ -547,7 +547,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &match_branches::MatchBranchSimplification, // inst combine is after MatchBranchSimplification to clean up Ne(_1, false) &multiple_return_terminators::MultipleReturnTerminators, - &instcombine::InstCombine, + &instsimplify::InstSimplify, &separate_const_switch::SeparateConstSwitch, &simplify::SimplifyLocals::BeforeConstProp, ©_prop::CopyProp, diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs index 7e0cef025f7..1b96df3aed5 100644 --- a/compiler/rustc_mir_transform/src/simplify.rs +++ b/compiler/rustc_mir_transform/src/simplify.rs @@ -278,7 +278,7 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> { } } -pub fn combine_duplicate_switch_targets(terminator: &mut Terminator<'_>) { +pub fn simplify_duplicate_switch_targets(terminator: &mut Terminator<'_>) { if let TerminatorKind::SwitchInt { targets, .. } = &mut terminator.kind { let otherwise = targets.otherwise(); if targets.iter().any(|t| t.1 == otherwise) { @@ -310,7 +310,7 @@ pub fn remove_duplicate_unreachable_blocks<'tcx>(tcx: TyCtxt<'tcx>, body: &mut B } } - combine_duplicate_switch_targets(terminator); + simplify_duplicate_switch_targets(terminator); self.super_terminator(terminator, location); } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 243da98c3c2..5cbd7f98b6b 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1555,7 +1555,7 @@ options! { "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \ (default: no)"), mir_enable_passes: Vec<(String, bool)> = (Vec::new(), parse_list_with_polarity, [TRACKED], - "use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be \ + "use like `-Zmir-enable-passes=+DestinationPropagation,-InstSimplify`. Forces the specified passes to be \ enabled, overriding all other checks. Passes that are not specified are enabled or \ disabled by other flags as usual."), mir_keep_place_mention: bool = (false, parse_bool, [TRACKED], diff --git a/tests/mir-opt/bool_compare.opt1.InstCombine.diff b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff similarity index 95% rename from tests/mir-opt/bool_compare.opt1.InstCombine.diff rename to tests/mir-opt/bool_compare.opt1.InstSimplify.diff index 0af5d82d315..6c9df8f042b 100644 --- a/tests/mir-opt/bool_compare.opt1.InstCombine.diff +++ b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt1` before InstCombine -+ // MIR for `opt1` after InstCombine +- // MIR for `opt1` before InstSimplify ++ // MIR for `opt1` after InstSimplify fn opt1(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 diff --git a/tests/mir-opt/bool_compare.opt2.InstCombine.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff similarity index 95% rename from tests/mir-opt/bool_compare.opt2.InstCombine.diff rename to tests/mir-opt/bool_compare.opt2.InstSimplify.diff index f5d1febd991..9fb3982654a 100644 --- a/tests/mir-opt/bool_compare.opt2.InstCombine.diff +++ b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt2` before InstCombine -+ // MIR for `opt2` after InstCombine +- // MIR for `opt2` before InstSimplify ++ // MIR for `opt2` after InstSimplify fn opt2(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 diff --git a/tests/mir-opt/bool_compare.opt3.InstCombine.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff similarity index 95% rename from tests/mir-opt/bool_compare.opt3.InstCombine.diff rename to tests/mir-opt/bool_compare.opt3.InstSimplify.diff index e7432adac7d..3a47da86735 100644 --- a/tests/mir-opt/bool_compare.opt3.InstCombine.diff +++ b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt3` before InstCombine -+ // MIR for `opt3` after InstCombine +- // MIR for `opt3` before InstSimplify ++ // MIR for `opt3` after InstSimplify fn opt3(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 diff --git a/tests/mir-opt/bool_compare.opt4.InstCombine.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff similarity index 95% rename from tests/mir-opt/bool_compare.opt4.InstCombine.diff rename to tests/mir-opt/bool_compare.opt4.InstSimplify.diff index 6b3e27772f7..5319c987d41 100644 --- a/tests/mir-opt/bool_compare.opt4.InstCombine.diff +++ b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt4` before InstCombine -+ // MIR for `opt4` after InstCombine +- // MIR for `opt4` before InstSimplify ++ // MIR for `opt4` after InstSimplify fn opt4(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 diff --git a/tests/mir-opt/bool_compare.rs b/tests/mir-opt/bool_compare.rs index 4435bf5b0f2..080f7f72d11 100644 --- a/tests/mir-opt/bool_compare.rs +++ b/tests/mir-opt/bool_compare.rs @@ -1,21 +1,21 @@ -// unit-test: InstCombine +// unit-test: InstSimplify -// EMIT_MIR bool_compare.opt1.InstCombine.diff +// EMIT_MIR bool_compare.opt1.InstSimplify.diff fn opt1(x: bool) -> u32 { if x != true { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt2.InstCombine.diff +// EMIT_MIR bool_compare.opt2.InstSimplify.diff fn opt2(x: bool) -> u32 { if true != x { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt3.InstCombine.diff +// EMIT_MIR bool_compare.opt3.InstSimplify.diff fn opt3(x: bool) -> u32 { if x == false { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt4.InstCombine.diff +// EMIT_MIR bool_compare.opt4.InstSimplify.diff fn opt4(x: bool) -> u32 { if false == x { 0 } else { 1 } } diff --git a/tests/mir-opt/casts.redundant.InstCombine.diff b/tests/mir-opt/casts.redundant.InstSimplify.diff similarity index 93% rename from tests/mir-opt/casts.redundant.InstCombine.diff rename to tests/mir-opt/casts.redundant.InstSimplify.diff index 528a8e5a90f..a641b69deb0 100644 --- a/tests/mir-opt/casts.redundant.InstCombine.diff +++ b/tests/mir-opt/casts.redundant.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `redundant` before InstCombine -+ // MIR for `redundant` after InstCombine +- // MIR for `redundant` before InstSimplify ++ // MIR for `redundant` after InstSimplify fn redundant(_1: *const &u8) -> *const &u8 { debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31 diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs index 259c462da3d..413b0e09d3f 100644 --- a/tests/mir-opt/casts.rs +++ b/tests/mir-opt/casts.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -// EMIT_MIR casts.redundant.InstCombine.diff +// EMIT_MIR casts.redundant.InstSimplify.diff // EMIT_MIR casts.redundant.PreCodegen.after.mir pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8 diff --git a/tests/mir-opt/combine_array_len.norm2.InstCombine.diff b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff similarity index 98% rename from tests/mir-opt/combine_array_len.norm2.InstCombine.diff rename to tests/mir-opt/combine_array_len.norm2.InstSimplify.diff index c73150f947d..0777007cefa 100644 --- a/tests/mir-opt/combine_array_len.norm2.InstCombine.diff +++ b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `norm2` before InstCombine -+ // MIR for `norm2` after InstCombine +- // MIR for `norm2` before InstSimplify ++ // MIR for `norm2` after InstSimplify fn norm2(_1: [f32; 2]) -> f32 { debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11 diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/combine_array_len.rs index 08c5f1a1fc5..970cafafcf0 100644 --- a/tests/mir-opt/combine_array_len.rs +++ b/tests/mir-opt/combine_array_len.rs @@ -1,6 +1,6 @@ // ignore-wasm32 compiled with panic=abort by default -// unit-test: InstCombine -// EMIT_MIR combine_array_len.norm2.InstCombine.diff +// unit-test: InstSimplify +// EMIT_MIR combine_array_len.norm2.InstSimplify.diff fn norm2(x: [f32; 2]) -> f32 { let a = x[0]; diff --git a/tests/mir-opt/combine_clone_of_primitives.rs b/tests/mir-opt/combine_clone_of_primitives.rs index 7cc50a86e21..1deee9dd6d2 100644 --- a/tests/mir-opt/combine_clone_of_primitives.rs +++ b/tests/mir-opt/combine_clone_of_primitives.rs @@ -1,7 +1,7 @@ -// unit-test: InstCombine +// unit-test: InstSimplify // ignore-wasm32 compiled with panic=abort by default -// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff +// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff #[derive(Clone)] struct MyThing { diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff similarity index 98% rename from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff rename to tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff index b715a544ffe..bb0811a7abb 100644 --- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff +++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `::clone` before InstCombine -+ // MIR for `::clone` after InstCombine +- // MIR for `::clone` before InstSimplify ++ // MIR for `::clone` after InstSimplify fn ::clone(_1: &MyThing) -> MyThing { debug self => _1; // in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff similarity index 99% rename from tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff rename to tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff index 168e8c61031..c5907e7cf18 100644 --- a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff +++ b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `adt_transmutes` before InstCombine -+ // MIR for `adt_transmutes` after InstCombine +- // MIR for `adt_transmutes` before InstSimplify ++ // MIR for `adt_transmutes` after InstSimplify fn adt_transmutes() -> () { let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:32: +0:32 diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff similarity index 95% rename from tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff rename to tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff index ae1185c7f71..57d9f4b1402 100644 --- a/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff +++ b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `identity_transmutes` before InstCombine -+ // MIR for `identity_transmutes` after InstCombine +- // MIR for `identity_transmutes` before InstSimplify ++ // MIR for `identity_transmutes` after InstSimplify fn identity_transmutes() -> () { let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:37: +0:37 diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff similarity index 93% rename from tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff rename to tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff index 8de7c34e6b2..ec7c982c151 100644 --- a/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff +++ b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `integer_transmutes` before InstCombine -+ // MIR for `integer_transmutes` after InstCombine +- // MIR for `integer_transmutes` before InstSimplify ++ // MIR for `integer_transmutes` after InstSimplify fn integer_transmutes() -> () { let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:36: +0:36 diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/combine_transmutes.rs index de9b9c35c03..7088488c1b8 100644 --- a/tests/mir-opt/combine_transmutes.rs +++ b/tests/mir-opt/combine_transmutes.rs @@ -1,4 +1,4 @@ -// unit-test: InstCombine +// unit-test: InstSimplify // compile-flags: -C panic=abort #![crate_type = "lib"] @@ -8,7 +8,7 @@ use std::intrinsics::mir::*; use std::mem::{MaybeUninit, ManuallyDrop, transmute}; -// EMIT_MIR combine_transmutes.identity_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff pub unsafe fn identity_transmutes() { // These are nops and should be removed let _a = transmute::(1); @@ -16,7 +16,7 @@ pub unsafe fn identity_transmutes() { } #[custom_mir(dialect = "runtime", phase = "initial")] -// EMIT_MIR combine_transmutes.integer_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff pub unsafe fn integer_transmutes() { mir! { { @@ -30,7 +30,7 @@ pub unsafe fn integer_transmutes() { } } -// EMIT_MIR combine_transmutes.adt_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff pub unsafe fn adt_transmutes() { let _a: u8 = transmute(EnumNoRepr::A); let _a: i8 = transmute(EnumNoRepr::B); diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 4499c54f264..9821d1b1e92 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -1,6 +1,6 @@ // ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp -// compile-flags: -Zmir-enable-passes=+InstCombine +// compile-flags: -Zmir-enable-passes=+InstSimplify // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR slice_len.main.ConstProp.diff diff --git a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff similarity index 93% rename from tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff rename to tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff index c0fc1fb1df3..cadf05152a4 100644 --- a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff +++ b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `generic` before InstCombine -+ // MIR for `generic` after InstCombine +- // MIR for `generic` before InstSimplify ++ // MIR for `generic` after InstSimplify fn generic() -> () { let mut _0: (); // return place in scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +0:21 diff --git a/tests/mir-opt/dont_yeet_assert.rs b/tests/mir-opt/dont_yeet_assert.rs index 7cec761eaba..38cc5a293e8 100644 --- a/tests/mir-opt/dont_yeet_assert.rs +++ b/tests/mir-opt/dont_yeet_assert.rs @@ -1,11 +1,11 @@ // compile-flags: --crate-type=lib -// unit-test: InstCombine +// unit-test: InstSimplify #![feature(core_intrinsics)] // Want to make sure this assertion isn't compiled away in generic code. -// EMIT_MIR dont_yeet_assert.generic.InstCombine.diff +// EMIT_MIR dont_yeet_assert.generic.InstSimplify.diff pub fn generic() { core::intrinsics::assert_mem_uninitialized_valid::<&T>(); } diff --git a/tests/mir-opt/equal_true.opt.InstCombine.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff similarity index 95% rename from tests/mir-opt/equal_true.opt.InstCombine.diff rename to tests/mir-opt/equal_true.opt.InstSimplify.diff index 8b542a7c19d..4ef4132008e 100644 --- a/tests/mir-opt/equal_true.opt.InstCombine.diff +++ b/tests/mir-opt/equal_true.opt.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt` before InstCombine -+ // MIR for `opt` after InstCombine +- // MIR for `opt` before InstSimplify ++ // MIR for `opt` after InstSimplify fn opt(_1: bool) -> i32 { debug x => _1; // in scope 0 at $DIR/equal_true.rs:+0:8: +0:9 diff --git a/tests/mir-opt/equal_true.rs b/tests/mir-opt/equal_true.rs index 717d10c6d76..fbb5d8d37db 100644 --- a/tests/mir-opt/equal_true.rs +++ b/tests/mir-opt/equal_true.rs @@ -1,6 +1,6 @@ -// unit-test InstCombine +// unit-test InstSimplify -// EMIT_MIR equal_true.opt.InstCombine.diff +// EMIT_MIR equal_true.opt.InstSimplify.diff fn opt(x: bool) -> i32 { if x == true { 0 } else { 1 } diff --git a/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff similarity index 52% rename from tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff rename to tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff index e04079453d2..04ba8dd8e4d 100644 --- a/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff +++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff @@ -1,21 +1,21 @@ -- // MIR for `assert_zero` before InstCombine -+ // MIR for `assert_zero` after InstCombine +- // MIR for `assert_zero` before InstSimplify ++ // MIR for `assert_zero` after InstSimplify fn assert_zero(_1: u8) -> u8 { - let mut _0: u8; // return place in scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+0:37: +0:39 + let mut _0: u8; // return place in scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+0:37: +0:39 bb0: { -- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+3:13: +7:14 -+ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+3:13: +7:14 +- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14 ++ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14 } bb1: { - unreachable; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+10:13: +10:26 + unreachable; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+10:13: +10:26 } bb2: { - _0 = _1; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+13:13: +13:20 - return; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+14:13: +14:21 + _0 = _1; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+13:13: +13:20 + return; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+14:13: +14:21 } } diff --git a/tests/mir-opt/instcombine_duplicate_switch_targets.rs b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs similarity index 82% rename from tests/mir-opt/instcombine_duplicate_switch_targets.rs rename to tests/mir-opt/instsimplify_duplicate_switch_targets.rs index ef3b487afa3..3e280a40fda 100644 --- a/tests/mir-opt/instcombine_duplicate_switch_targets.rs +++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs @@ -3,9 +3,9 @@ use std::intrinsics::mir::*; -// unit-test: InstCombine +// unit-test: InstSimplify -// EMIT_MIR instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff +// EMIT_MIR instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff #[custom_mir(dialect = "runtime", phase = "post-cleanup")] pub unsafe fn assert_zero(x: u8) -> u8 { mir!( diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff similarity index 96% rename from tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff rename to tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff index 09fc145e734..a59f4a43aed 100644 --- a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `generic` before InstCombine -+ // MIR for `generic` after InstCombine +- // MIR for `generic` before InstSimplify ++ // MIR for `generic` after InstSimplify fn generic() -> () { let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +0:21 diff --git a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff similarity index 97% rename from tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff rename to tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff index c52174ef5ea..195e8bd4eae 100644 --- a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `panics` before InstCombine -+ // MIR for `panics` after InstCombine +- // MIR for `panics` before InstSimplify ++ // MIR for `panics` after InstSimplify fn panics() -> () { let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +0:17 diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff similarity index 97% rename from tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff rename to tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff index d059d47ee58..a4a65074caa 100644 --- a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `removable` before InstCombine -+ // MIR for `removable` after InstCombine +- // MIR for `removable` before InstSimplify ++ // MIR for `removable` after InstSimplify fn removable() -> () { let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +0:20 diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/intrinsic_asserts.rs index 8fb99cdf6e0..302d4bda188 100644 --- a/tests/mir-opt/intrinsic_asserts.rs +++ b/tests/mir-opt/intrinsic_asserts.rs @@ -2,7 +2,7 @@ #![feature(core_intrinsics)] // All these assertions pass, so all the intrinsic calls should be deleted. -// EMIT_MIR intrinsic_asserts.removable.InstCombine.diff +// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff pub fn removable() { core::intrinsics::assert_inhabited::<()>(); core::intrinsics::assert_zero_valid::(); @@ -12,7 +12,7 @@ pub fn removable() { enum Never {} // These assertions all diverge, so their target blocks should become None. -// EMIT_MIR intrinsic_asserts.panics.InstCombine.diff +// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff pub fn panics() { core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::<&u8>(); @@ -20,7 +20,7 @@ pub fn panics() { } // Whether or not these asserts pass isn't known, so they shouldn't be modified. -// EMIT_MIR intrinsic_asserts.generic.InstCombine.diff +// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff pub fn generic() { core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::(); diff --git a/tests/mir-opt/issue_78192.f.InstCombine.diff b/tests/mir-opt/issue_78192.f.InstSimplify.diff similarity index 95% rename from tests/mir-opt/issue_78192.f.InstCombine.diff rename to tests/mir-opt/issue_78192.f.InstSimplify.diff index 116ca304c99..914d7ceb29a 100644 --- a/tests/mir-opt/issue_78192.f.InstCombine.diff +++ b/tests/mir-opt/issue_78192.f.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `f` before InstCombine -+ // MIR for `f` after InstCombine +- // MIR for `f` before InstSimplify ++ // MIR for `f` after InstSimplify fn f(_1: &T) -> *const T { debug a => _1; // in scope 0 at $DIR/issue_78192.rs:+0:13: +0:14 diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs index 39f665402b0..95142a3e463 100644 --- a/tests/mir-opt/issue_78192.rs +++ b/tests/mir-opt/issue_78192.rs @@ -8,4 +8,4 @@ fn main() { f(&2); } -// EMIT_MIR issue_78192.f.InstCombine.diff +// EMIT_MIR issue_78192.f.InstSimplify.diff diff --git a/tests/mir-opt/not_equal_false.opt.InstCombine.diff b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff similarity index 95% rename from tests/mir-opt/not_equal_false.opt.InstCombine.diff rename to tests/mir-opt/not_equal_false.opt.InstSimplify.diff index b558c35ac1e..8e7776a0bbc 100644 --- a/tests/mir-opt/not_equal_false.opt.InstCombine.diff +++ b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt` before InstCombine -+ // MIR for `opt` after InstCombine +- // MIR for `opt` before InstSimplify ++ // MIR for `opt` after InstSimplify fn opt(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/not_equal_false.rs:+0:8: +0:9 diff --git a/tests/mir-opt/not_equal_false.rs b/tests/mir-opt/not_equal_false.rs index 2ae03da40f8..e0560732900 100644 --- a/tests/mir-opt/not_equal_false.rs +++ b/tests/mir-opt/not_equal_false.rs @@ -1,5 +1,5 @@ -// unit-test: InstCombine -// EMIT_MIR not_equal_false.opt.InstCombine.diff +// unit-test: InstSimplify +// EMIT_MIR not_equal_false.opt.InstSimplify.diff fn opt(x: bool) -> u32 { if x != false { 0 } else { 1 } diff --git a/tests/ui/lint/invalid_value-polymorphic.rs b/tests/ui/lint/invalid_value-polymorphic.rs index 055173e9842..98f82b792fc 100644 --- a/tests/ui/lint/invalid_value-polymorphic.rs +++ b/tests/ui/lint/invalid_value-polymorphic.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib -Zmir-enable-passes=+InstCombine +// compile-flags: --crate-type=lib -Zmir-enable-passes=+InstSimplify // build-pass #![feature(core_intrinsics)]