From 4ff03cd1a49dbf08f24c7054d4fd478e87c3a4de Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 17:36:39 +0000 Subject: [PATCH 01/21] Allow to run filecheck in mir-opt tests. --- src/tools/compiletest/src/runtest.rs | 65 ++++++++---------- src/tools/miropt-test-tools/src/lib.rs | 27 +++++--- src/tools/tidy/src/mir_opt_tests.rs | 3 +- ..._of_reborrow.SimplifyCfg-initial.after.mir | 60 ++++++++--------- tests/mir-opt/address_of.rs | 1 + tests/mir-opt/array_index_is_temporary.rs | 1 + tests/mir-opt/asm_unwind_panic_abort.rs | 1 + ...ignment.main.SimplifyCfg-initial.after.mir | 4 +- tests/mir-opt/basic_assignment.rs | 1 + tests/mir-opt/bool_compare.rs | 1 + tests/mir-opt/box_expr.rs | 1 + ...await.a-{closure#0}.generator_resume.0.mir | 6 +- ...await.b-{closure#0}.generator_resume.0.mir | 66 +++++++++---------- tests/mir-opt/building/async_await.rs | 1 + .../building/custom/aggregate_exprs.rs | 1 + .../mir-opt/building/custom/arbitrary_let.rs | 1 + tests/mir-opt/building/custom/arrays.rs | 1 + tests/mir-opt/building/custom/as_cast.rs | 1 + .../building/custom/composite_return.rs | 1 + tests/mir-opt/building/custom/consts.rs | 1 + tests/mir-opt/building/custom/debuginfo.rs | 1 + tests/mir-opt/building/custom/enums.rs | 1 + tests/mir-opt/building/custom/operators.rs | 1 + tests/mir-opt/building/custom/projections.rs | 1 + tests/mir-opt/building/custom/references.rs | 1 + .../mir-opt/building/custom/simple_assign.rs | 1 + tests/mir-opt/building/custom/terminators.rs | 1 + tests/mir-opt/building/enum_cast.rs | 1 + .../issue_101867.main.built.after.mir | 4 +- tests/mir-opt/building/issue_101867.rs | 1 + tests/mir-opt/building/issue_110508.rs | 1 + .../issue_110508.{impl#0}-BAR.built.after.mir | 4 +- ...e_110508.{impl#0}-SELF_BAR.built.after.mir | 4 +- tests/mir-opt/building/issue_49232.rs | 1 + .../building/logical_or_in_conditional.rs | 1 + tests/mir-opt/building/match_false_edges.rs | 1 + ...ceiver_ptr_mutability.main.built.after.mir | 8 +-- .../building/receiver_ptr_mutability.rs | 1 + tests/mir-opt/building/shifts.rs | 1 + tests/mir-opt/building/simple_match.rs | 1 + .../building/storage_live_dead_in_statics.rs | 1 + .../building/uniform_array_move_out.rs | 1 + tests/mir-opt/byte_slice.rs | 1 + tests/mir-opt/casts.rs | 1 + tests/mir-opt/combine_array_len.rs | 1 + tests/mir-opt/combine_clone_of_primitives.rs | 1 + ...mpl#0}-clone.InstSimplify.panic-abort.diff | 6 +- ...pl#0}-clone.InstSimplify.panic-unwind.diff | 6 +- tests/mir-opt/combine_transmutes.rs | 1 + tests/mir-opt/const_allocation.rs | 1 + tests/mir-opt/const_allocation2.rs | 1 + tests/mir-opt/const_allocation3.rs | 1 + tests/mir-opt/const_debuginfo.rs | 1 + tests/mir-opt/const_goto.rs | 1 + tests/mir-opt/const_goto_const_eval_fail.rs | 1 + tests/mir-opt/const_goto_storage.rs | 1 + .../mir-opt/const_promotion_extern_static.rs | 1 + tests/mir-opt/const_prop/address_of_pair.rs | 1 + tests/mir-opt/const_prop/aggregate.rs | 1 + tests/mir-opt/const_prop/array_index.rs | 1 + .../mir-opt/const_prop/bad_op_div_by_zero.rs | 1 + .../mir-opt/const_prop/bad_op_mod_by_zero.rs | 1 + .../bad_op_unsafe_oob_for_slices.rs | 1 + .../mir-opt/const_prop/boolean_identities.rs | 1 + tests/mir-opt/const_prop/boxes.rs | 1 + tests/mir-opt/const_prop/cast.rs | 1 + tests/mir-opt/const_prop/checked_add.rs | 1 + .../const_prop/const_prop_fails_gracefully.rs | 1 + .../const_prop/control_flow_simplification.rs | 1 + tests/mir-opt/const_prop/discriminant.rs | 1 + tests/mir-opt/const_prop/indirect.rs | 1 + tests/mir-opt/const_prop/inherit_overflow.rs | 1 + tests/mir-opt/const_prop/invalid_constant.rs | 1 + tests/mir-opt/const_prop/issue_66971.rs | 1 + tests/mir-opt/const_prop/issue_67019.rs | 1 + tests/mir-opt/const_prop/large_array_index.rs | 1 + tests/mir-opt/const_prop/mult_by_zero.rs | 1 + tests/mir-opt/const_prop/mutable_variable.rs | 1 + .../const_prop/mutable_variable_aggregate.rs | 1 + .../mutable_variable_aggregate_mut_ref.rs | 1 + ...mutable_variable_aggregate_partial_read.rs | 1 + .../const_prop/mutable_variable_no_prop.rs | 1 + .../mutable_variable_unprop_assign.rs | 1 + tests/mir-opt/const_prop/offset_of.rs | 1 + .../const_prop/read_immutable_static.rs | 1 + tests/mir-opt/const_prop/ref_deref.rs | 1 + tests/mir-opt/const_prop/ref_deref_project.rs | 1 + tests/mir-opt/const_prop/reify_fn_ptr.rs | 1 + tests/mir-opt/const_prop/repeat.rs | 1 + tests/mir-opt/const_prop/return_place.rs | 1 + .../const_prop/scalar_literal_propagation.rs | 1 + tests/mir-opt/const_prop/slice_len.rs | 1 + tests/mir-opt/const_prop/switch_int.rs | 1 + tests/mir-opt/const_prop/transmute.rs | 1 + .../const_prop/tuple_literal_propagation.rs | 1 + tests/mir-opt/const_prop/while_let_loops.rs | 1 + tests/mir-opt/const_prop_miscompile.rs | 1 + tests/mir-opt/copy-prop/borrowed_local.rs | 1 + tests/mir-opt/copy-prop/branch.rs | 1 + tests/mir-opt/copy-prop/calls.rs | 1 + .../mir-opt/copy-prop/copy_propagation_arg.rs | 1 + tests/mir-opt/copy-prop/custom_move_arg.rs | 1 + tests/mir-opt/copy-prop/cycle.rs | 1 + tests/mir-opt/copy-prop/dead_stores_79191.rs | 1 + tests/mir-opt/copy-prop/dead_stores_better.rs | 1 + tests/mir-opt/copy-prop/issue_107511.rs | 1 + tests/mir-opt/copy-prop/move_arg.rs | 1 + tests/mir-opt/copy-prop/move_projection.rs | 1 + .../copy-prop/mutate_through_pointer.rs | 1 + tests/mir-opt/copy-prop/non_dominate.rs | 1 + tests/mir-opt/copy-prop/partial_init.rs | 1 + tests/mir-opt/copy-prop/reborrow.rs | 1 + .../dataflow-const-prop/array_index.rs | 1 + .../dataflow-const-prop/boolean_identities.rs | 1 + tests/mir-opt/dataflow-const-prop/cast.rs | 1 + tests/mir-opt/dataflow-const-prop/checked.rs | 1 + .../default_boxed_slice.rs | 1 + tests/mir-opt/dataflow-const-prop/enum.rs | 1 + tests/mir-opt/dataflow-const-prop/if.rs | 1 + .../dataflow-const-prop/inherit_overflow.rs | 1 + .../dataflow-const-prop/issue_81605.rs | 1 + .../dataflow-const-prop/large_array_index.rs | 1 + .../dataflow-const-prop/mult_by_zero.rs | 1 + .../mir-opt/dataflow-const-prop/offset_of.rs | 1 + .../dataflow-const-prop/ref_without_sb.rs | 1 + tests/mir-opt/dataflow-const-prop/repeat.rs | 1 + .../dataflow-const-prop/repr_transparent.rs | 1 + .../dataflow-const-prop/self_assign.rs | 1 + .../dataflow-const-prop/self_assign_add.rs | 1 + .../dataflow-const-prop/sibling_ptr.rs | 1 + .../mir-opt/dataflow-const-prop/slice_len.rs | 1 + tests/mir-opt/dataflow-const-prop/struct.rs | 1 + .../mir-opt/dataflow-const-prop/terminator.rs | 1 + .../mir-opt/dataflow-const-prop/transmute.rs | 1 + tests/mir-opt/dataflow-const-prop/tuple.rs | 1 + .../dead-store-elimination/call_arg_copy.rs | 1 + tests/mir-opt/dead-store-elimination/cycle.rs | 1 + .../dead-store-elimination/place_mention.rs | 1 + .../provenance_soundness.rs | 1 + tests/mir-opt/deduplicate_blocks.rs | 1 + tests/mir-opt/deref-patterns/string.rs | 1 + tests/mir-opt/derefer_complex_case.rs | 1 + tests/mir-opt/derefer_inline_test.rs | 1 + tests/mir-opt/derefer_terminator_test.rs | 1 + tests/mir-opt/derefer_test.rs | 1 + tests/mir-opt/derefer_test_multiple.rs | 1 + tests/mir-opt/dest-prop/branch.rs | 1 + .../mir-opt/dest-prop/copy_propagation_arg.rs | 1 + tests/mir-opt/dest-prop/cycle.rs | 1 + tests/mir-opt/dest-prop/dead_stores_79191.rs | 1 + tests/mir-opt/dest-prop/dead_stores_better.rs | 1 + tests/mir-opt/dest-prop/simple.rs | 1 + tests/mir-opt/dest-prop/union.rs | 1 + tests/mir-opt/dest-prop/unreachable.rs | 1 + tests/mir-opt/dont_inline_type_id.rs | 1 + tests/mir-opt/dont_yeet_assert.rs | 1 + tests/mir-opt/early_otherwise_branch.rs | 1 + .../early_otherwise_branch_3_element_tuple.rs | 1 + tests/mir-opt/early_otherwise_branch_68867.rs | 1 + tests/mir-opt/early_otherwise_branch_noopt.rs | 1 + .../early_otherwise_branch_soundness.rs | 1 + tests/mir-opt/enum_opt.rs | 1 + tests/mir-opt/equal_true.rs | 1 + tests/mir-opt/exponential_or.rs | 1 + tests/mir-opt/fn_ptr_shim.rs | 1 + tests/mir-opt/funky_arms.rs | 1 + ...losure#0}.generator_drop.0.panic-abort.mir | 4 +- ...osure#0}.generator_drop.0.panic-unwind.mir | 4 +- tests/mir-opt/generator_drop_cleanup.rs | 1 + ...e#0}.StateTransform.before.panic-abort.mir | 2 +- ...#0}.StateTransform.before.panic-unwind.mir | 2 +- .../mir-opt/generator_storage_dead_unwind.rs | 1 + ...ny.main-{closure#0}.generator_resume.0.mir | 12 ++-- tests/mir-opt/generator_tiny.rs | 1 + tests/mir-opt/graphviz.rs | 1 + tests/mir-opt/gvn.rs | 1 + tests/mir-opt/if_condition_int.rs | 1 + tests/mir-opt/inline/asm_unwind.rs | 1 + .../inline/caller_with_trivial_bound.rs | 1 + tests/mir-opt/inline/cycle.rs | 1 + .../inline/dont_ice_on_generic_rust_call.rs | 1 + tests/mir-opt/inline/dyn_trait.rs | 1 + tests/mir-opt/inline/exponential_runtime.rs | 1 + tests/mir-opt/inline/inline_any_operand.rs | 1 + tests/mir-opt/inline/inline_async.rs | 1 + tests/mir-opt/inline/inline_box_fn.rs | 1 + tests/mir-opt/inline/inline_closure.rs | 1 + .../inline/inline_closure_borrows_arg.rs | 1 + .../mir-opt/inline/inline_closure_captures.rs | 1 + tests/mir-opt/inline/inline_compatibility.rs | 1 + tests/mir-opt/inline/inline_cycle.rs | 1 + tests/mir-opt/inline/inline_cycle_generic.rs | 1 + tests/mir-opt/inline/inline_diverging.rs | 1 + ...ine_generator.main.Inline.panic-abort.diff | 22 +++---- ...ne_generator.main.Inline.panic-unwind.diff | 22 +++---- tests/mir-opt/inline/inline_generator.rs | 1 + .../mir-opt/inline/inline_instruction_set.rs | 1 + tests/mir-opt/inline/inline_into_box_place.rs | 1 + tests/mir-opt/inline/inline_options.rs | 1 + tests/mir-opt/inline/inline_retag.rs | 1 + tests/mir-opt/inline/inline_shims.rs | 1 + tests/mir-opt/inline/inline_specialization.rs | 1 + tests/mir-opt/inline/inline_trait_method.rs | 1 + tests/mir-opt/inline/inline_trait_method_2.rs | 1 + tests/mir-opt/inline/issue_106141.rs | 1 + .../issue_58867_inline_as_ref_as_mut.rs | 1 + ...ine_scopes_parenting.main.Inline.after.mir | 6 +- .../issue_76997_inline_scopes_parenting.rs | 1 + tests/mir-opt/inline/issue_78442.rs | 1 + tests/mir-opt/inline/polymorphic_recursion.rs | 1 + tests/mir-opt/inline/unchecked_shifts.rs | 1 + tests/mir-opt/inline/unsized_argument.rs | 1 + tests/mir-opt/inline/unwrap_unchecked.rs | 1 + tests/mir-opt/inline_generically_if_sized.rs | 1 + ...ument_coverage.bar.InstrumentCoverage.diff | 2 +- ...ment_coverage.main.InstrumentCoverage.diff | 10 +-- tests/mir-opt/instrument_coverage.rs | 1 + .../instsimplify_duplicate_switch_targets.rs | 1 + tests/mir-opt/intrinsic_asserts.rs | 1 + tests/mir-opt/issue_101973.rs | 1 + .../issue_104451_unwindable_intrinsics.rs | 1 + tests/mir-opt/issue_38669.rs | 1 + tests/mir-opt/issue_41110.rs | 1 + tests/mir-opt/issue_41697.rs | 1 + ...nt#0}.SimplifyCfg-promote-consts.after.mir | 4 +- tests/mir-opt/issue_41888.rs | 1 + tests/mir-opt/issue_62289.rs | 1 + tests/mir-opt/issue_72181.rs | 1 + .../issue_72181_1.main.built.after.mir | 4 +- tests/mir-opt/issue_72181_1.rs | 1 + tests/mir-opt/issue_76432.rs | 1 + tests/mir-opt/issue_78192.rs | 1 + tests/mir-opt/issue_91633.rs | 1 + .../issue_99325.main.built.after.32bit.mir | 4 +- .../issue_99325.main.built.after.64bit.mir | 4 +- tests/mir-opt/issue_99325.rs | 1 + tests/mir-opt/issues/issue_59352.rs | 1 + tests/mir-opt/issues/issue_75439.rs | 1 + tests/mir-opt/loop_test.rs | 1 + tests/mir-opt/lower_array_len.rs | 1 + tests/mir-opt/lower_intrinsics.rs | 1 + tests/mir-opt/lower_slice_len.rs | 1 + tests/mir-opt/match_arm_scopes.rs | 1 + tests/mir-opt/match_test.rs | 1 + tests/mir-opt/matches_reduce_branches.rs | 1 + tests/mir-opt/matches_u8.rs | 1 + tests/mir-opt/multiple_return_terminators.rs | 1 + tests/mir-opt/nll/named_lifetimes_basic.rs | 1 + .../nll/named_lifetimes_basic.use_x.nll.0.mir | 16 ++--- ...egion_subtyping_basic.main.nll.0.32bit.mir | 4 +- ...egion_subtyping_basic.main.nll.0.64bit.mir | 4 +- tests/mir-opt/nll/region_subtyping_basic.rs | 1 + tests/mir-opt/no_drop_for_inactive_variant.rs | 1 + tests/mir-opt/no_spurious_drop_after_call.rs | 1 + tests/mir-opt/not_equal_false.rs | 1 + tests/mir-opt/nrvo_miscompile_111005.rs | 1 + tests/mir-opt/nrvo_simple.rs | 1 + tests/mir-opt/packed_struct_drop_aligned.rs | 1 + .../mir-opt/pre-codegen/chained_comparison.rs | 1 + tests/mir-opt/pre-codegen/checked_ops.rs | 1 + .../pre-codegen/duplicate_switch_targets.rs | 1 + tests/mir-opt/pre-codegen/intrinsics.rs | 1 + tests/mir-opt/pre-codegen/loops.rs | 1 + tests/mir-opt/pre-codegen/mem_replace.rs | 1 + .../pre-codegen/optimizes_into_variable.rs | 1 + tests/mir-opt/pre-codegen/range_iter.rs | 1 + ...mple_option_map.ezmap.PreCodegen.after.mir | 4 +- .../mir-opt/pre-codegen/simple_option_map.rs | 1 + tests/mir-opt/pre-codegen/slice_filter.rs | 1 + ...variant_a-{closure#0}.PreCodegen.after.mir | 2 +- ...variant_b-{closure#0}.PreCodegen.after.mir | 2 +- tests/mir-opt/pre-codegen/slice_index.rs | 1 + tests/mir-opt/pre-codegen/slice_iter.rs | 1 + ...ans.outer.PreCodegen.after.panic-abort.mir | 20 +++--- ...ns.outer.PreCodegen.after.panic-unwind.mir | 20 +++--- tests/mir-opt/pre-codegen/spans.rs | 1 + tests/mir-opt/pre-codegen/try_identity.rs | 1 + tests/mir-opt/reference_prop.rs | 1 + tests/mir-opt/remove_fake_borrows.rs | 1 + tests/mir-opt/remove_never_const.rs | 1 + tests/mir-opt/remove_storage_markers.rs | 1 + tests/mir-opt/remove_unneeded_drops.rs | 1 + tests/mir-opt/remove_zsts.rs | 1 + tests/mir-opt/retag.rs | 1 + ...yCfg-elaborate-drops.after.panic-abort.mir | 4 +- ...Cfg-elaborate-drops.after.panic-unwind.mir | 4 +- ...yCfg-elaborate-drops.after.panic-abort.mir | 4 +- ...Cfg-elaborate-drops.after.panic-unwind.mir | 4 +- tests/mir-opt/return_an_array.rs | 1 + tests/mir-opt/separate_const_switch.rs | 1 + tests/mir-opt/simplify_arm.rs | 1 + tests/mir-opt/simplify_arm_identity.rs | 1 + tests/mir-opt/simplify_cfg.rs | 1 + .../simplify_duplicate_unreachable_blocks.rs | 1 + tests/mir-opt/simplify_if.rs | 1 + tests/mir-opt/simplify_locals.rs | 1 + tests/mir-opt/simplify_locals_fixedpoint.rs | 1 + .../simplify_locals_removes_unused_consts.rs | 1 + ...ocals_removes_unused_discriminant_reads.rs | 1 + tests/mir-opt/simplify_match.rs | 1 + tests/mir-opt/simplify_try_if_let.rs | 1 + tests/mir-opt/slice_drop_shim.rs | 1 + .../spanview_block.main.built.after.html | 6 +- tests/mir-opt/spanview_block.rs | 1 + .../spanview_statement.main.built.after.html | 6 +- tests/mir-opt/spanview_statement.rs | 1 + .../spanview_terminator.main.built.after.html | 4 +- tests/mir-opt/spanview_terminator.rs | 1 + tests/mir-opt/sroa/lifetimes.rs | 1 + tests/mir-opt/sroa/structs.rs | 1 + tests/mir-opt/ssa_unreachable_116212.rs | 1 + tests/mir-opt/storage_ranges.main.nll.0.mir | 2 +- tests/mir-opt/storage_ranges.rs | 1 + tests/mir-opt/switch_to_self.rs | 1 + tests/mir-opt/tls_access.rs | 1 + tests/mir-opt/uninhabited_enum.rs | 1 + tests/mir-opt/uninhabited_enum_branching.rs | 1 + tests/mir-opt/uninhabited_enum_branching2.rs | 1 + .../uninhabited_fallthrough_elimination.rs | 1 + tests/mir-opt/unreachable.rs | 1 + tests/mir-opt/unreachable_diverging.rs | 1 + tests/mir-opt/unusual_item_types.rs | 1 + ...mpl#0}-ASSOCIATED_CONSTANT.built.after.mir | 4 +- tests/mir-opt/while_storage.rs | 1 + 324 files changed, 515 insertions(+), 240 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 875671c64e002..8ce00e00b5727 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -15,6 +15,7 @@ use crate::json; use crate::read2::{read2_abbreviated, Truncated}; use crate::util::{add_dylib_path, dylib_env_var, logv, PathBufExt}; use crate::ColorConfig; +use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile}; use regex::{Captures, Regex}; use rustfix::{apply_suggestions, get_suggestions_from_json, Filter}; @@ -229,6 +230,7 @@ enum Emit { None, Metadata, LlvmIr, + Mir, Asm, LinkArgsAsm, } @@ -2506,6 +2508,9 @@ impl<'test> TestCx<'test> { Emit::LlvmIr => { rustc.args(&["--emit", "llvm-ir"]); } + Emit::Mir => { + rustc.args(&["--emit", "mir"]); + } Emit::Asm => { rustc.args(&["--emit", "asm"]); } @@ -3984,11 +3989,17 @@ impl<'test> TestCx<'test> { fn run_mir_opt_test(&self) { let pm = self.pass_mode(); let should_run = self.should_run(pm); - let emit_metadata = self.should_emit_metadata(pm); - let passes = self.get_passes(); - let proc_res = self.compile_test_with_passes(should_run, emit_metadata, passes); - self.check_mir_dump(); + let mut test_info = files_for_miropt_test( + &self.testpaths.file, + self.config.get_pointer_width(), + self.config.target_cfg().panic.for_miropt_test_tools(), + ); + + let passes = std::mem::take(&mut test_info.passes); + + let proc_res = self.compile_test_with_passes(should_run, Emit::Mir, passes); + self.check_mir_dump(test_info); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); } @@ -4002,37 +4013,12 @@ impl<'test> TestCx<'test> { } } - fn get_passes(&self) -> Vec { - let files = miropt_test_tools::files_for_miropt_test( - &self.testpaths.file, - self.config.get_pointer_width(), - self.config.target_cfg().panic.for_miropt_test_tools(), - ); - - let mut out = Vec::new(); - - for miropt_test_tools::MiroptTestFiles { - from_file: _, - to_file: _, - expected_file: _, - passes, - } in files - { - out.extend(passes); - } - out - } - - fn check_mir_dump(&self) { + fn check_mir_dump(&self, test_info: MiroptTest) { let test_dir = self.testpaths.file.parent().unwrap(); let test_crate = self.testpaths.file.file_stem().unwrap().to_str().unwrap().replace("-", "_"); - let suffix = miropt_test_tools::output_file_suffix( - &self.testpaths.file, - self.config.get_pointer_width(), - self.config.target_cfg().panic.for_miropt_test_tools(), - ); + let MiroptTest { run_filecheck, suffix, files, passes: _ } = test_info; if self.config.bless { for e in @@ -4047,14 +4033,7 @@ impl<'test> TestCx<'test> { } } - let files = miropt_test_tools::files_for_miropt_test( - &self.testpaths.file, - self.config.get_pointer_width(), - self.config.target_cfg().panic.for_miropt_test_tools(), - ); - for miropt_test_tools::MiroptTestFiles { from_file, to_file, expected_file, passes: _ } in - files - { + for MiroptTestFile { from_file, to_file, expected_file } in files { let dumped_string = if let Some(after) = to_file { self.diff_mir_files(from_file.into(), after.into()) } else { @@ -4095,6 +4074,14 @@ impl<'test> TestCx<'test> { } } } + + if run_filecheck { + let output_path = self.output_base_name().with_extension("mir"); + let proc_res = self.verify_with_filecheck(&output_path); + if !proc_res.status.success() { + self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res); + } + } } fn diff_mir_files(&self, before: PathBuf, after: PathBuf) -> String { diff --git a/src/tools/miropt-test-tools/src/lib.rs b/src/tools/miropt-test-tools/src/lib.rs index e33ecfe8eab24..cae96f593199e 100644 --- a/src/tools/miropt-test-tools/src/lib.rs +++ b/src/tools/miropt-test-tools/src/lib.rs @@ -1,10 +1,16 @@ use std::fs; use std::path::Path; -pub struct MiroptTestFiles { +pub struct MiroptTestFile { pub expected_file: std::path::PathBuf, pub from_file: String, pub to_file: Option, +} + +pub struct MiroptTest { + pub run_filecheck: bool, + pub suffix: String, + pub files: Vec, /// Vec of passes under test to be dumped pub passes: Vec, } @@ -14,11 +20,7 @@ pub enum PanicStrategy { Abort, } -pub fn output_file_suffix( - testfile: &Path, - bit_width: u32, - panic_strategy: PanicStrategy, -) -> String { +fn output_file_suffix(testfile: &Path, bit_width: u32, panic_strategy: PanicStrategy) -> String { let mut each_bit_width = false; let mut each_panic_strategy = false; for line in fs::read_to_string(testfile).unwrap().lines() { @@ -47,7 +49,7 @@ pub fn files_for_miropt_test( testfile: &std::path::Path, bit_width: u32, panic_strategy: PanicStrategy, -) -> Vec { +) -> MiroptTest { let mut out = Vec::new(); let test_file_contents = fs::read_to_string(&testfile).unwrap(); @@ -55,8 +57,14 @@ pub fn files_for_miropt_test( let test_crate = testfile.file_stem().unwrap().to_str().unwrap().replace('-', "_"); let suffix = output_file_suffix(testfile, bit_width, panic_strategy); + let mut run_filecheck = true; + let mut passes = Vec::new(); for l in test_file_contents.lines() { + if l.starts_with("// skip-filecheck") { + run_filecheck = false; + continue; + } if l.starts_with("// EMIT_MIR ") { let test_name = l.trim_start_matches("// EMIT_MIR ").trim(); let mut test_names = test_name.split(' '); @@ -65,7 +73,6 @@ pub fn files_for_miropt_test( let mut expected_file; let from_file; let to_file; - let mut passes = Vec::new(); if test_name.ends_with(".diff") { let trimmed = test_name.trim_end_matches(".diff"); @@ -114,9 +121,9 @@ pub fn files_for_miropt_test( } let expected_file = test_dir.join(expected_file); - out.push(MiroptTestFiles { expected_file, from_file, to_file, passes }); + out.push(MiroptTestFile { expected_file, from_file, to_file }); } } - out + MiroptTest { run_filecheck, suffix, files: out, passes } } diff --git a/src/tools/tidy/src/mir_opt_tests.rs b/src/tools/tidy/src/mir_opt_tests.rs index c307bcb93902d..76feeb343312a 100644 --- a/src/tools/tidy/src/mir_opt_tests.rs +++ b/src/tools/tidy/src/mir_opt_tests.rs @@ -26,7 +26,8 @@ fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) { for file in rs_files { for bw in [32, 64] { for ps in [PanicStrategy::Unwind, PanicStrategy::Abort] { - for output_file in miropt_test_tools::files_for_miropt_test(&file, bw, ps) { + let mir_opt_test = miropt_test_tools::files_for_miropt_test(&file, bw, ps); + for output_file in mir_opt_test.files { output_files.remove(&output_file.expected_file); } } diff --git a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir index 61aa89e445f50..76938c14e1ee6 100644 --- a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir @@ -1,36 +1,36 @@ // MIR for `address_of_reborrow` after SimplifyCfg-initial | User Type Annotations -| 0: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:7:5: 7:18, inferred_ty: *const [i32; 10] -| 1: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:9:5: 9:25, inferred_ty: *const dyn std::marker::Send -| 2: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10] -| 3: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10] -| 4: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10] -| 5: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10] -| 6: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send -| 7: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send -| 8: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32] -| 9: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32] -| 10: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:18:5: 18:18, inferred_ty: *const [i32; 10] -| 11: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:20:5: 20:25, inferred_ty: *const dyn std::marker::Send -| 12: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10] -| 13: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10] -| 14: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10] -| 15: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10] -| 16: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send -| 17: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send -| 18: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32] -| 19: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32] -| 20: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:28:5: 28:16, inferred_ty: *mut [i32; 10] -| 21: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:30:5: 30:23, inferred_ty: *mut dyn std::marker::Send -| 22: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10] -| 23: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10] -| 24: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10] -| 25: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10] -| 26: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send -| 27: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send -| 28: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32] -| 29: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32] +| 0: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:8:5: 8:18, inferred_ty: *const [i32; 10] +| 1: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:10:5: 10:25, inferred_ty: *const dyn std::marker::Send +| 2: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:14:12: 14:20, inferred_ty: *const [i32; 10] +| 3: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:14:12: 14:20, inferred_ty: *const [i32; 10] +| 4: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:15:12: 15:28, inferred_ty: *const [i32; 10] +| 5: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:15:12: 15:28, inferred_ty: *const [i32; 10] +| 6: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:16:12: 16:27, inferred_ty: *const dyn std::marker::Send +| 7: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:16:12: 16:27, inferred_ty: *const dyn std::marker::Send +| 8: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:17:12: 17:24, inferred_ty: *const [i32] +| 9: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:17:12: 17:24, inferred_ty: *const [i32] +| 10: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:19:5: 19:18, inferred_ty: *const [i32; 10] +| 11: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:21:5: 21:25, inferred_ty: *const dyn std::marker::Send +| 12: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:24:12: 24:20, inferred_ty: *const [i32; 10] +| 13: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:24:12: 24:20, inferred_ty: *const [i32; 10] +| 14: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:25:12: 25:28, inferred_ty: *const [i32; 10] +| 15: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:25:12: 25:28, inferred_ty: *const [i32; 10] +| 16: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:26:12: 26:27, inferred_ty: *const dyn std::marker::Send +| 17: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:26:12: 26:27, inferred_ty: *const dyn std::marker::Send +| 18: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:27:12: 27:24, inferred_ty: *const [i32] +| 19: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:27:12: 27:24, inferred_ty: *const [i32] +| 20: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:29:5: 29:16, inferred_ty: *mut [i32; 10] +| 21: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:31:5: 31:23, inferred_ty: *mut dyn std::marker::Send +| 22: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:34:12: 34:18, inferred_ty: *mut [i32; 10] +| 23: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:34:12: 34:18, inferred_ty: *mut [i32; 10] +| 24: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:35:12: 35:26, inferred_ty: *mut [i32; 10] +| 25: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:35:12: 35:26, inferred_ty: *mut [i32; 10] +| 26: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:36:12: 36:25, inferred_ty: *mut dyn std::marker::Send +| 27: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:36:12: 36:25, inferred_ty: *mut dyn std::marker::Send +| 28: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:37:12: 37:22, inferred_ty: *mut [i32] +| 29: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:37:12: 37:22, inferred_ty: *mut [i32] | fn address_of_reborrow() -> () { let mut _0: (); diff --git a/tests/mir-opt/address_of.rs b/tests/mir-opt/address_of.rs index c4bea5613e402..57a317a4a90b2 100644 --- a/tests/mir-opt/address_of.rs +++ b/tests/mir-opt/address_of.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR address_of.address_of_reborrow.SimplifyCfg-initial.after.mir fn address_of_reborrow() { diff --git a/tests/mir-opt/array_index_is_temporary.rs b/tests/mir-opt/array_index_is_temporary.rs index 950429fb6bca4..08db63a82bbf7 100644 --- a/tests/mir-opt/array_index_is_temporary.rs +++ b/tests/mir-opt/array_index_is_temporary.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Retagging (from Stacked Borrows) relies on the array index being a fresh // temporary, so that side-effects cannot change it. diff --git a/tests/mir-opt/asm_unwind_panic_abort.rs b/tests/mir-opt/asm_unwind_panic_abort.rs index ad8f9398e7f3c..873a8b28f5e0e 100644 --- a/tests/mir-opt/asm_unwind_panic_abort.rs +++ b/tests/mir-opt/asm_unwind_panic_abort.rs @@ -1,3 +1,4 @@ +// skip-filecheck //! Tests that unwinding from an asm block is caught and forced to abort //! when `-C panic=abort`. diff --git a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir index 75070ffda11fb..99b51a4e92f82 100644 --- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after SimplifyCfg-initial | User Type Annotations -| 0: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:20:17: 20:33, inferred_ty: std::option::Option> -| 1: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:20:17: 20:33, inferred_ty: std::option::Option> +| 0: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:21:17: 21:33, inferred_ty: std::option::Option> +| 1: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:21:17: 21:33, inferred_ty: std::option::Option> | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/basic_assignment.rs b/tests/mir-opt/basic_assignment.rs index 92434e44aa9a5..87e01932cb155 100644 --- a/tests/mir-opt/basic_assignment.rs +++ b/tests/mir-opt/basic_assignment.rs @@ -1,3 +1,4 @@ +// skip-filecheck // needs-unwind // this tests move up progration, which is not yet implemented diff --git a/tests/mir-opt/bool_compare.rs b/tests/mir-opt/bool_compare.rs index 080f7f72d1160..3de3fb93d15ef 100644 --- a/tests/mir-opt/bool_compare.rs +++ b/tests/mir-opt/bool_compare.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: InstSimplify // EMIT_MIR bool_compare.opt1.InstSimplify.diff diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs index 780420bda9fca..30969a1704d00 100644 --- a/tests/mir-opt/box_expr.rs +++ b/tests/mir-opt/box_expr.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![feature(rustc_attrs, stmt_expr_attributes)] diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir index 98b1befc3bfa2..bc4ca06c11358 100644 --- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir @@ -9,7 +9,7 @@ storage_conflicts: BitMatrix(0x0) {}, } */ -fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>, _2: &mut Context<'_>) -> Poll<()> { +fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>, _2: &mut Context<'_>) -> Poll<()> { debug _task_context => _4; let mut _0: std::task::Poll<()>; let mut _3: (); @@ -17,7 +17,7 @@ fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}> let mut _5: u32; bb0: { - _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))); + _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}))); switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5]; } @@ -29,7 +29,7 @@ fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}> bb2: { _0 = Poll::<()>::Ready(move _3); - discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))) = 1; + discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}))) = 1; return; } diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir index 15330b13cc214..4a60e353bf276 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir @@ -14,7 +14,7 @@ Static, ), source_info: SourceInfo { - span: $DIR/async_await.rs:15:9: 15:14 (#8), + span: $DIR/async_await.rs:16:9: 16:14 (#8), scope: scope[0], }, ignore_for_traits: false, @@ -32,7 +32,7 @@ Static, ), source_info: SourceInfo { - span: $DIR/async_await.rs:16:9: 16:14 (#10), + span: $DIR/async_await.rs:17:9: 17:14 (#10), scope: scope[0], }, ignore_for_traits: false, @@ -51,19 +51,19 @@ }, } */ -fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, _2: &mut Context<'_>) -> Poll<()> { +fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>, _2: &mut Context<'_>) -> Poll<()> { debug _task_context => _38; let mut _0: std::task::Poll<()>; let _3: (); - let mut _4: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _5: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _6: {async fn body@$DIR/async_await.rs:11:14: 11:16}; + let mut _4: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _5: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _6: {async fn body@$DIR/async_await.rs:12:14: 12:16}; let mut _7: (); let _8: (); let mut _9: std::task::Poll<()>; - let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>; - let mut _11: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _12: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}; + let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>; + let mut _11: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _12: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}; let mut _13: &mut std::task::Context<'_>; let mut _14: &mut std::task::Context<'_>; let mut _15: &mut std::task::Context<'_>; @@ -71,14 +71,14 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, let mut _18: !; let mut _19: &mut std::task::Context<'_>; let mut _20: (); - let mut _21: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _22: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _23: {async fn body@$DIR/async_await.rs:11:14: 11:16}; + let mut _21: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _22: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _23: {async fn body@$DIR/async_await.rs:12:14: 12:16}; let _24: (); let mut _25: std::task::Poll<()>; - let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>; - let mut _27: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _28: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}; + let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>; + let mut _27: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _28: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}; let mut _29: &mut std::task::Context<'_>; let mut _30: &mut std::task::Context<'_>; let mut _31: &mut std::task::Context<'_>; @@ -90,7 +90,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, let mut _38: &mut std::task::Context<'_>; let mut _39: u32; scope 1 { - debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}); + debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}); let _17: (); scope 2 { } @@ -99,7 +99,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, } } scope 4 { - debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}); + debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}); let _33: (); scope 5 { } @@ -109,7 +109,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, } bb0: { - _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))); + _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))); switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30]; } @@ -122,13 +122,13 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, } bb2: { - _4 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; + _4 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; } bb3: { StorageDead(_5); nop; - (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _4; + (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _4; goto -> bb4; } @@ -138,9 +138,9 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, StorageLive(_10); StorageLive(_11); StorageLive(_12); - _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}); + _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}); _11 = &mut (*_12); - _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; + _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; } bb5: { @@ -156,7 +156,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, bb6: { _13 = &mut (*_14); StorageDead(_15); - _9 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; + _9 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; } bb7: { @@ -176,7 +176,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, StorageLive(_20); _20 = (); _0 = Poll::<()>::Pending; - discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 3; + discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 3; return; } @@ -193,7 +193,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, StorageDead(_12); StorageDead(_9); StorageDead(_8); - drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb12, unwind unreachable]; + drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb12, unwind unreachable]; } bb11: { @@ -218,13 +218,13 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, } bb14: { - _21 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; + _21 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; } bb15: { StorageDead(_22); nop; - (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _21; + (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _21; goto -> bb16; } @@ -234,9 +234,9 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, StorageLive(_26); StorageLive(_27); StorageLive(_28); - _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}); + _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}); _27 = &mut (*_28); - _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; + _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; } bb17: { @@ -252,7 +252,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, bb18: { _29 = &mut (*_30); StorageDead(_31); - _25 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; + _25 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; } bb19: { @@ -272,7 +272,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, StorageLive(_36); _36 = (); _0 = Poll::<()>::Pending; - discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 4; + discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 4; return; } @@ -285,7 +285,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, StorageDead(_28); StorageDead(_25); StorageDead(_24); - drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb23, unwind unreachable]; + drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb23, unwind unreachable]; } bb22: { @@ -308,7 +308,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, bb25: { _0 = Poll::<()>::Ready(move _37); - discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 1; + discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 1; return; } diff --git a/tests/mir-opt/building/async_await.rs b/tests/mir-opt/building/async_await.rs index 0b991e3b8f8cc..74b15f2b98ffb 100644 --- a/tests/mir-opt/building/async_await.rs +++ b/tests/mir-opt/building/async_await.rs @@ -1,3 +1,4 @@ +// skip-filecheck // This test makes sure that the generator MIR pass eliminates all calls to // `get_context`, and that the MIR argument type for an async fn and all locals // related to `yield` are `&mut Context`, and its return type is `Poll`. diff --git a/tests/mir-opt/building/custom/aggregate_exprs.rs b/tests/mir-opt/building/custom/aggregate_exprs.rs index 554c9c03ba4a0..d581886247ff7 100644 --- a/tests/mir-opt/building/custom/aggregate_exprs.rs +++ b/tests/mir-opt/building/custom/aggregate_exprs.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/arbitrary_let.rs b/tests/mir-opt/building/custom/arbitrary_let.rs index 776df3151ffd7..f8ee8504e3229 100644 --- a/tests/mir-opt/building/custom/arbitrary_let.rs +++ b/tests/mir-opt/building/custom/arbitrary_let.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/arrays.rs b/tests/mir-opt/building/custom/arrays.rs index 8e0a1fd7a4390..fe6abc546879c 100644 --- a/tests/mir-opt/building/custom/arrays.rs +++ b/tests/mir-opt/building/custom/arrays.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics, inline_const)] extern crate core; diff --git a/tests/mir-opt/building/custom/as_cast.rs b/tests/mir-opt/building/custom/as_cast.rs index b4b5ac6aa3b1e..92aea64db07fd 100644 --- a/tests/mir-opt/building/custom/as_cast.rs +++ b/tests/mir-opt/building/custom/as_cast.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/composite_return.rs b/tests/mir-opt/building/custom/composite_return.rs index 701d6b1ab7131..33c903fa0f891 100644 --- a/tests/mir-opt/building/custom/composite_return.rs +++ b/tests/mir-opt/building/custom/composite_return.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/consts.rs b/tests/mir-opt/building/custom/consts.rs index 16d10eb5968c1..42abf5019e559 100644 --- a/tests/mir-opt/building/custom/consts.rs +++ b/tests/mir-opt/building/custom/consts.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics, inline_const)] extern crate core; diff --git a/tests/mir-opt/building/custom/debuginfo.rs b/tests/mir-opt/building/custom/debuginfo.rs index bfdc3d3eacd44..3671a1ef06198 100644 --- a/tests/mir-opt/building/custom/debuginfo.rs +++ b/tests/mir-opt/building/custom/debuginfo.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/enums.rs b/tests/mir-opt/building/custom/enums.rs index eca5b792ec0a2..6aab1503c0a3f 100644 --- a/tests/mir-opt/building/custom/enums.rs +++ b/tests/mir-opt/building/custom/enums.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/operators.rs b/tests/mir-opt/building/custom/operators.rs index db7a48317d928..91bdf2b9113cc 100644 --- a/tests/mir-opt/building/custom/operators.rs +++ b/tests/mir-opt/building/custom/operators.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: --crate-type=lib #![feature(custom_mir, core_intrinsics, inline_const)] use std::intrinsics::mir::*; diff --git a/tests/mir-opt/building/custom/projections.rs b/tests/mir-opt/building/custom/projections.rs index 3c155deae4b70..ac23fe59097f3 100644 --- a/tests/mir-opt/building/custom/projections.rs +++ b/tests/mir-opt/building/custom/projections.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/references.rs b/tests/mir-opt/building/custom/references.rs index f87f6664c7a5c..04afe6e6494bf 100644 --- a/tests/mir-opt/building/custom/references.rs +++ b/tests/mir-opt/building/custom/references.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/simple_assign.rs b/tests/mir-opt/building/custom/simple_assign.rs index db041aab239e3..8442272291e1b 100644 --- a/tests/mir-opt/building/custom/simple_assign.rs +++ b/tests/mir-opt/building/custom/simple_assign.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/terminators.rs b/tests/mir-opt/building/custom/terminators.rs index 123118f654e7b..9e442e0f98a94 100644 --- a/tests/mir-opt/building/custom/terminators.rs +++ b/tests/mir-opt/building/custom/terminators.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs index 431b5c708b929..df8e397c8fec5 100644 --- a/tests/mir-opt/building/enum_cast.rs +++ b/tests/mir-opt/building/enum_cast.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR enum_cast.foo.built.after.mir // EMIT_MIR enum_cast.bar.built.after.mir // EMIT_MIR enum_cast.boo.built.after.mir diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index 915c5ef112c39..fb60f0f0c2b27 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option -| 1: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option +| 0: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option +| 1: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/issue_101867.rs b/tests/mir-opt/building/issue_101867.rs index a32d8cb37142c..f8a531e8982d5 100644 --- a/tests/mir-opt/building/issue_101867.rs +++ b/tests/mir-opt/building/issue_101867.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR issue_101867.main.built.after.mir fn main() { let x: Option = Some(1); diff --git a/tests/mir-opt/building/issue_110508.rs b/tests/mir-opt/building/issue_110508.rs index bcbb1c2983090..e597cd5d06b32 100644 --- a/tests/mir-opt/building/issue_110508.rs +++ b/tests/mir-opt/building/issue_110508.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR issue_110508.{impl#0}-BAR.built.after.mir // EMIT_MIR issue_110508.{impl#0}-SELF_BAR.built.after.mir diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir index 5fc6d911af354..c3d28fae51833 100644 --- a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir +++ b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `::BAR` after built +// MIR for `::BAR` after built -const ::BAR: Foo = { +const ::BAR: Foo = { let mut _0: Foo; let mut _1: (); diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir index 1a8925599717e..177518c30af7f 100644 --- a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir +++ b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `::SELF_BAR` after built +// MIR for `::SELF_BAR` after built -const ::SELF_BAR: Foo = { +const ::SELF_BAR: Foo = { let mut _0: Foo; let mut _1: (); diff --git a/tests/mir-opt/building/issue_49232.rs b/tests/mir-opt/building/issue_49232.rs index 7e9f0de81f749..ac06e02778f0d 100644 --- a/tests/mir-opt/building/issue_49232.rs +++ b/tests/mir-opt/building/issue_49232.rs @@ -1,3 +1,4 @@ +// skip-filecheck // We must mark a variable whose initialization fails due to an // abort statement as StorageDead. diff --git a/tests/mir-opt/building/logical_or_in_conditional.rs b/tests/mir-opt/building/logical_or_in_conditional.rs index ae159f7e12239..00e666ed94f03 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.rs +++ b/tests/mir-opt/building/logical_or_in_conditional.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z validate-mir #![feature(let_chains)] struct Droppy(u8); diff --git a/tests/mir-opt/building/match_false_edges.rs b/tests/mir-opt/building/match_false_edges.rs index ddfcc14931918..839eda40c8540 100644 --- a/tests/mir-opt/building/match_false_edges.rs +++ b/tests/mir-opt/building/match_false_edges.rs @@ -1,3 +1,4 @@ +// skip-filecheck fn guard() -> bool { false } diff --git a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir index fed5e68c3c97d..e07c2b6fa9d1b 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir +++ b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir @@ -1,10 +1,10 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test -| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test -| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test -| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test +| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test +| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test +| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test +| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/receiver_ptr_mutability.rs b/tests/mir-opt/building/receiver_ptr_mutability.rs index 668530968fe51..4bb3b4cade560 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.rs +++ b/tests/mir-opt/building/receiver_ptr_mutability.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR receiver_ptr_mutability.main.built.after.mir #![feature(arbitrary_self_types)] diff --git a/tests/mir-opt/building/shifts.rs b/tests/mir-opt/building/shifts.rs index 4b63a00a304dc..c94a142d33622 100644 --- a/tests/mir-opt/building/shifts.rs +++ b/tests/mir-opt/building/shifts.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -C debug-assertions=yes // EMIT_MIR shifts.shift_signed.built.after.mir diff --git a/tests/mir-opt/building/simple_match.rs b/tests/mir-opt/building/simple_match.rs index 0ef97dde63631..4f0a3046a0618 100644 --- a/tests/mir-opt/building/simple_match.rs +++ b/tests/mir-opt/building/simple_match.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test that we don't generate unnecessarily large MIR for very simple matches diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.rs b/tests/mir-opt/building/storage_live_dead_in_statics.rs index 79f709148e304..1f5692118545a 100644 --- a/tests/mir-opt/building/storage_live_dead_in_statics.rs +++ b/tests/mir-opt/building/storage_live_dead_in_statics.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Check that when we compile the static `XXX` into MIR, we do not // generate `StorageStart` or `StorageEnd` statements. diff --git a/tests/mir-opt/building/uniform_array_move_out.rs b/tests/mir-opt/building/uniform_array_move_out.rs index 4ba107c870426..0682891611ddb 100644 --- a/tests/mir-opt/building/uniform_array_move_out.rs +++ b/tests/mir-opt/building/uniform_array_move_out.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(stmt_expr_attributes, rustc_attrs)] // EMIT_MIR uniform_array_move_out.move_out_from_end.built.after.mir diff --git a/tests/mir-opt/byte_slice.rs b/tests/mir-opt/byte_slice.rs index 48e9c48c12008..813d9ccfdc26f 100644 --- a/tests/mir-opt/byte_slice.rs +++ b/tests/mir-opt/byte_slice.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z mir-opt-level=0 // EMIT_MIR byte_slice.main.SimplifyCfg-elaborate-drops.after.mir diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs index 413b0e09d3fde..c154aeace0f01 100644 --- a/tests/mir-opt/casts.rs +++ b/tests/mir-opt/casts.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![crate_type = "lib"] // EMIT_MIR casts.redundant.InstSimplify.diff diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/combine_array_len.rs index e971ab4781eee..21485ee21b169 100644 --- a/tests/mir-opt/combine_array_len.rs +++ b/tests/mir-opt/combine_array_len.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: InstSimplify // EMIT_MIR combine_array_len.norm2.InstSimplify.diff diff --git a/tests/mir-opt/combine_clone_of_primitives.rs b/tests/mir-opt/combine_clone_of_primitives.rs index c19f9ee105ffe..1a8913eb8b141 100644 --- a/tests/mir-opt/combine_clone_of_primitives.rs +++ b/tests/mir-opt/combine_clone_of_primitives.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: InstSimplify // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff index 124c2dc7e4bbf..1a1ff5779400c 100644 --- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff +++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff @@ -1,7 +1,7 @@ -- // MIR for `::clone` before InstSimplify -+ // MIR for `::clone` after InstSimplify +- // MIR for `::clone` before InstSimplify ++ // MIR for `::clone` after InstSimplify - fn ::clone(_1: &MyThing) -> MyThing { + fn ::clone(_1: &MyThing) -> MyThing { debug self => _1; let mut _0: MyThing; let mut _2: T; diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff index f2b87221f2b98..4d851b532866d 100644 --- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff +++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff @@ -1,7 +1,7 @@ -- // MIR for `::clone` before InstSimplify -+ // MIR for `::clone` after InstSimplify +- // MIR for `::clone` before InstSimplify ++ // MIR for `::clone` after InstSimplify - fn ::clone(_1: &MyThing) -> MyThing { + fn ::clone(_1: &MyThing) -> MyThing { debug self => _1; let mut _0: MyThing; let mut _2: T; diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/combine_transmutes.rs index 403f9356ce210..89ec0a08a01d4 100644 --- a/tests/mir-opt/combine_transmutes.rs +++ b/tests/mir-opt/combine_transmutes.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: InstSimplify // compile-flags: -C panic=abort diff --git a/tests/mir-opt/const_allocation.rs b/tests/mir-opt/const_allocation.rs index 91a2455eb836a..577c61aeb7de9 100644 --- a/tests/mir-opt/const_allocation.rs +++ b/tests/mir-opt/const_allocation.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // ignore-endian-big // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_allocation2.rs b/tests/mir-opt/const_allocation2.rs index f2870aa47c563..0fcfaad842c9f 100644 --- a/tests/mir-opt/const_allocation2.rs +++ b/tests/mir-opt/const_allocation2.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // ignore-endian-big // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_allocation3.rs b/tests/mir-opt/const_allocation3.rs index da3fd089b026b..b8c9f50977e34 100644 --- a/tests/mir-opt/const_allocation3.rs +++ b/tests/mir-opt/const_allocation3.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // ignore-endian-big // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_debuginfo.rs b/tests/mir-opt/const_debuginfo.rs index a188da3852623..d8ae08a0723ce 100644 --- a/tests/mir-opt/const_debuginfo.rs +++ b/tests/mir-opt/const_debuginfo.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -C overflow-checks=no -Zunsound-mir-opts struct Point { diff --git a/tests/mir-opt/const_goto.rs b/tests/mir-opt/const_goto.rs index 6f84f186b3115..93cb71c3a0f82 100644 --- a/tests/mir-opt/const_goto.rs +++ b/tests/mir-opt/const_goto.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstGoto pub enum Foo { diff --git a/tests/mir-opt/const_goto_const_eval_fail.rs b/tests/mir-opt/const_goto_const_eval_fail.rs index b2357663a90c4..869f916001cd3 100644 --- a/tests/mir-opt/const_goto_const_eval_fail.rs +++ b/tests/mir-opt/const_goto_const_eval_fail.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(min_const_generics)] #![crate_type = "lib"] diff --git a/tests/mir-opt/const_goto_storage.rs b/tests/mir-opt/const_goto_storage.rs index 459599c73eb9c..9d43da23990bc 100644 --- a/tests/mir-opt/const_goto_storage.rs +++ b/tests/mir-opt/const_goto_storage.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstGoto // EMIT_MIR const_goto_storage.match_nested_if.ConstGoto.diff diff --git a/tests/mir-opt/const_promotion_extern_static.rs b/tests/mir-opt/const_promotion_extern_static.rs index e4261cfe50447..edc3a522338cd 100644 --- a/tests/mir-opt/const_promotion_extern_static.rs +++ b/tests/mir-opt/const_promotion_extern_static.rs @@ -1,3 +1,4 @@ +// skip-filecheck // ignore-endian-big extern "C" { static X: i32; diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs index 43dc9bae62534..169469a073917 100644 --- a/tests/mir-opt/const_prop/address_of_pair.rs +++ b/tests/mir-opt/const_prop/address_of_pair.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR address_of_pair.fn0.ConstProp.diff diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs index 62cd3dd688982..2e043af08bfe4 100644 --- a/tests/mir-opt/const_prop/aggregate.rs +++ b/tests/mir-opt/const_prop/aggregate.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // compile-flags: -O diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs index f85d23b9789eb..3bd2321653d3e 100644 --- a/tests/mir-opt/const_prop/array_index.rs +++ b/tests/mir-opt/const_prop/array_index.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs index 963084bf7e5bf..ab41f64a57329 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs index 9d7d2aa10443e..e747b21cf9b38 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs index d6b1a93f30499..38c97a4cf0ebe 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs index c7b609949cd15..781cce8c7dd7e 100644 --- a/tests/mir-opt/const_prop/boolean_identities.rs +++ b/tests/mir-opt/const_prop/boolean_identities.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // compile-flags: -O -Zmir-opt-level=4 diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs index 78599174b423b..c6807ece199ec 100644 --- a/tests/mir-opt/const_prop/boxes.rs +++ b/tests/mir-opt/const_prop/boxes.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // compile-flags: -O // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs index 984086eda48b0..3d543badace1e 100644 --- a/tests/mir-opt/const_prop/cast.rs +++ b/tests/mir-opt/const_prop/cast.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR cast.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs index fd40876cbc221..6a53aced09168 100644 --- a/tests/mir-opt/const_prop/checked_add.rs +++ b/tests/mir-opt/const_prop/checked_add.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // compile-flags: -C overflow-checks=on diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs index c92831f926d3c..5bd4731bf08d4 100644 --- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs +++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp #[inline(never)] diff --git a/tests/mir-opt/const_prop/control_flow_simplification.rs b/tests/mir-opt/const_prop/control_flow_simplification.rs index 21d727b3e50d9..5fc13e202751b 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.rs +++ b/tests/mir-opt/const_prop/control_flow_simplification.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // compile-flags: -Zmir-opt-level=1 diff --git a/tests/mir-opt/const_prop/discriminant.rs b/tests/mir-opt/const_prop/discriminant.rs index fdd67ca8ac44f..11405f38bdced 100644 --- a/tests/mir-opt/const_prop/discriminant.rs +++ b/tests/mir-opt/const_prop/discriminant.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // compile-flags: -O diff --git a/tests/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs index 72af6cd95b8db..0e6e1d78d1e37 100644 --- a/tests/mir-opt/const_prop/indirect.rs +++ b/tests/mir-opt/const_prop/indirect.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // compile-flags: -C overflow-checks=on diff --git a/tests/mir-opt/const_prop/inherit_overflow.rs b/tests/mir-opt/const_prop/inherit_overflow.rs index 6ebd364121ab7..41989462debb8 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.rs +++ b/tests/mir-opt/const_prop/inherit_overflow.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // compile-flags: -Zmir-enable-passes=+Inline diff --git a/tests/mir-opt/const_prop/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs index bdbc5a1990ea9..ff6b31a1ee214 100644 --- a/tests/mir-opt/const_prop/invalid_constant.rs +++ b/tests/mir-opt/const_prop/invalid_constant.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // compile-flags: -Zmir-enable-passes=+RemoveZsts // Verify that we can pretty print invalid constants. diff --git a/tests/mir-opt/const_prop/issue_66971.rs b/tests/mir-opt/const_prop/issue_66971.rs index a0242ec633f9e..386c95b5b69cc 100644 --- a/tests/mir-opt/const_prop/issue_66971.rs +++ b/tests/mir-opt/const_prop/issue_66971.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // compile-flags: -Z mir-opt-level=3 diff --git a/tests/mir-opt/const_prop/issue_67019.rs b/tests/mir-opt/const_prop/issue_67019.rs index 66b577f5b5f80..2f61298bb98d1 100644 --- a/tests/mir-opt/const_prop/issue_67019.rs +++ b/tests/mir-opt/const_prop/issue_67019.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // compile-flags: -Z mir-opt-level=3 diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs index d226bd5467165..d98d166ff7ccd 100644 --- a/tests/mir-opt/const_prop/large_array_index.rs +++ b/tests/mir-opt/const_prop/large_array_index.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs index 7bd30975a738c..47e15205ea905 100644 --- a/tests/mir-opt/const_prop/mult_by_zero.rs +++ b/tests/mir-opt/const_prop/mult_by_zero.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR mult_by_zero.test.ConstProp.diff diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs index 95987ef7fa9fa..175d63d46f5a3 100644 --- a/tests/mir-opt/const_prop/mutable_variable.rs +++ b/tests/mir-opt/const_prop/mutable_variable.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR mutable_variable.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs index a145c0354380c..f926771ae3899 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs index 3099e659f3fbb..a81aa7b49791b 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs index 30ea5714ae49a..54a5d9223210d 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs index e51c6223555d5..a7aeeccd8611c 100644 --- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp static mut STATIC: u32 = 0x42424242; diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs index 4e7c0597a29f3..6bdb136a94962 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp diff --git a/tests/mir-opt/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs index 164db59572b29..21911f8dbb5de 100644 --- a/tests/mir-opt/const_prop/offset_of.rs +++ b/tests/mir-opt/const_prop/offset_of.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs index fb8f9fe996a6d..a8d8cfacc7ce9 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.rs +++ b/tests/mir-opt/const_prop/read_immutable_static.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp static FOO: u8 = 2; diff --git a/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs index 76e56916af09a..f2fa024f72212 100644 --- a/tests/mir-opt/const_prop/ref_deref.rs +++ b/tests/mir-opt/const_prop/ref_deref.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR ref_deref.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs index 04fc7f8daa124..1b9e0acb2c054 100644 --- a/tests/mir-opt/const_prop/ref_deref_project.rs +++ b/tests/mir-opt/const_prop/ref_deref_project.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR ref_deref_project.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs index 5f63820669b30..da7de80c5f48a 100644 --- a/tests/mir-opt/const_prop/reify_fn_ptr.rs +++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR reify_fn_ptr.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs index fb8b825ee368b..92194d6bb5882 100644 --- a/tests/mir-opt/const_prop/repeat.rs +++ b/tests/mir-opt/const_prop/repeat.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs index 0576b02a84562..1263de7931f59 100644 --- a/tests/mir-opt/const_prop/return_place.rs +++ b/tests/mir-opt/const_prop/return_place.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -C overflow-checks=on diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs index dfe41e6145bdd..9dcddf7c770e3 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.rs +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR scalar_literal_propagation.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index e91724536f918..3b551b6b173c7 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: ConstProp // compile-flags: -Zmir-enable-passes=+InstSimplify diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs index bf708c8298e16..7ec56e11e85b0 100644 --- a/tests/mir-opt/const_prop/switch_int.rs +++ b/tests/mir-opt/const_prop/switch_int.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs index 762c421715ab5..8f9d1e77ab4ff 100644 --- a/tests/mir-opt/const_prop/transmute.rs +++ b/tests/mir-opt/const_prop/transmute.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // compile-flags: -O --crate-type=lib // ignore-endian-big diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.rs b/tests/mir-opt/const_prop/tuple_literal_propagation.rs index 5890a343f26c3..e0bc6e1be37e7 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.rs +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR tuple_literal_propagation.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/while_let_loops.rs b/tests/mir-opt/const_prop/while_let_loops.rs index 595a94b88be0e..39081c3550a81 100644 --- a/tests/mir-opt/const_prop/while_let_loops.rs +++ b/tests/mir-opt/const_prop/while_let_loops.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp // EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff diff --git a/tests/mir-opt/const_prop_miscompile.rs b/tests/mir-opt/const_prop_miscompile.rs index dbbe5ee08408f..00696535ac159 100644 --- a/tests/mir-opt/const_prop_miscompile.rs +++ b/tests/mir-opt/const_prop_miscompile.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ConstProp #![feature(raw_ref_op)] diff --git a/tests/mir-opt/copy-prop/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs index bf94dc57d3361..c6b8ad3571f3d 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.rs +++ b/tests/mir-opt/copy-prop/borrowed_local.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/branch.rs b/tests/mir-opt/copy-prop/branch.rs index c8af1aa7bf9f7..2785089579ffc 100644 --- a/tests/mir-opt/copy-prop/branch.rs +++ b/tests/mir-opt/copy-prop/branch.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that we bail out when there are multiple assignments to the same local. // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/calls.rs b/tests/mir-opt/copy-prop/calls.rs index c1f86f1f4128e..2970f5f0b8d42 100644 --- a/tests/mir-opt/copy-prop/calls.rs +++ b/tests/mir-opt/copy-prop/calls.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Check that CopyProp does propagate return values of call terminators. // unit-test: CopyProp // needs-unwind diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.rs b/tests/mir-opt/copy-prop/copy_propagation_arg.rs index 671860da50d25..83bbefe09ed51 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that CopyProp does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) diff --git a/tests/mir-opt/copy-prop/custom_move_arg.rs b/tests/mir-opt/copy-prop/custom_move_arg.rs index d1c5ffdff0dc9..2077874ee9a76 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.rs +++ b/tests/mir-opt/copy-prop/custom_move_arg.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/cycle.rs b/tests/mir-opt/copy-prop/cycle.rs index 56ec7539734fd..58e049fde4b58 100644 --- a/tests/mir-opt/copy-prop/cycle.rs +++ b/tests/mir-opt/copy-prop/cycle.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that cyclic assignments don't hang CopyProp, and result in reasonable code. // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.rs b/tests/mir-opt/copy-prop/dead_stores_79191.rs index 4260d35b19470..81306ab613a00 100644 --- a/tests/mir-opt/copy-prop/dead_stores_79191.rs +++ b/tests/mir-opt/copy-prop/dead_stores_79191.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/dead_stores_better.rs b/tests/mir-opt/copy-prop/dead_stores_better.rs index c5962db6a40de..7addf6af23bd7 100644 --- a/tests/mir-opt/copy-prop/dead_stores_better.rs +++ b/tests/mir-opt/copy-prop/dead_stores_better.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates // that that pass enables this one to do more optimizations. diff --git a/tests/mir-opt/copy-prop/issue_107511.rs b/tests/mir-opt/copy-prop/issue_107511.rs index ce6fcc17b5722..53fd9366276b0 100644 --- a/tests/mir-opt/copy-prop/issue_107511.rs +++ b/tests/mir-opt/copy-prop/issue_107511.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/move_arg.rs b/tests/mir-opt/copy-prop/move_arg.rs index a3a04e57bc1fa..fc2932a65dd60 100644 --- a/tests/mir-opt/copy-prop/move_arg.rs +++ b/tests/mir-opt/copy-prop/move_arg.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Test that we do not move multiple times from the same local. // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/move_projection.rs b/tests/mir-opt/copy-prop/move_projection.rs index f94addb5629c7..8629d535bcf75 100644 --- a/tests/mir-opt/copy-prop/move_projection.rs +++ b/tests/mir-opt/copy-prop/move_projection.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: CopyProp diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.rs b/tests/mir-opt/copy-prop/mutate_through_pointer.rs index 753787089b52a..e36a10846a625 100644 --- a/tests/mir-opt/copy-prop/mutate_through_pointer.rs +++ b/tests/mir-opt/copy-prop/mutate_through_pointer.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: CopyProp // // This attempts to mutate `a` via a pointer derived from `addr_of!(a)`. That is UB diff --git a/tests/mir-opt/copy-prop/non_dominate.rs b/tests/mir-opt/copy-prop/non_dominate.rs index c0ea838e1c885..c26ac444e5c68 100644 --- a/tests/mir-opt/copy-prop/non_dominate.rs +++ b/tests/mir-opt/copy-prop/non_dominate.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: CopyProp #![feature(custom_mir, core_intrinsics)] diff --git a/tests/mir-opt/copy-prop/partial_init.rs b/tests/mir-opt/copy-prop/partial_init.rs index f5ab9974f71e5..44cc203de0d4f 100644 --- a/tests/mir-opt/copy-prop/partial_init.rs +++ b/tests/mir-opt/copy-prop/partial_init.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: CopyProp // Verify that we do not ICE on partial initializations. diff --git a/tests/mir-opt/copy-prop/reborrow.rs b/tests/mir-opt/copy-prop/reborrow.rs index c37ba5e5c4ca2..57c4fb8ade9e4 100644 --- a/tests/mir-opt/copy-prop/reborrow.rs +++ b/tests/mir-opt/copy-prop/reborrow.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that CopyProp considers reborrows as not mutating the pointer. // unit-test: CopyProp diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs index ddb3646ca9b63..3d420f930076d 100644 --- a/tests/mir-opt/dataflow-const-prop/array_index.rs +++ b/tests/mir-opt/dataflow-const-prop/array_index.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs index 9e911e85b8825..2605c7019e6f4 100644 --- a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs +++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR boolean_identities.test.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/cast.rs b/tests/mir-opt/dataflow-const-prop/cast.rs index 484403f7f0ec4..c87872609dcf7 100644 --- a/tests/mir-opt/dataflow-const-prop/cast.rs +++ b/tests/mir-opt/dataflow-const-prop/cast.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR cast.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/checked.rs b/tests/mir-opt/dataflow-const-prop/checked.rs index 1c301460f5d6a..b41ac0b3d2af6 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.rs +++ b/tests/mir-opt/dataflow-const-prop/checked.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp // compile-flags: -Coverflow-checks=on diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs index dfeccd3eb94ee..1bb052736c05d 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // compile-flags: -Zmir-enable-passes=+ConstProp,+Inline // ignore-debug assertions change the output MIR diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs index 5a10e9e883d07..e35c0e6e85bed 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.rs +++ b/tests/mir-opt/dataflow-const-prop/enum.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/if.rs b/tests/mir-opt/dataflow-const-prop/if.rs index 34fc35790c17f..72aabbccf56c8 100644 --- a/tests/mir-opt/dataflow-const-prop/if.rs +++ b/tests/mir-opt/dataflow-const-prop/if.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR if.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs index 964c58966f009..664cbcb2c259f 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp // compile-flags: -Zmir-enable-passes=+Inline diff --git a/tests/mir-opt/dataflow-const-prop/issue_81605.rs b/tests/mir-opt/dataflow-const-prop/issue_81605.rs index d75e2a28bef6b..7c5eceb8a2b68 100644 --- a/tests/mir-opt/dataflow-const-prop/issue_81605.rs +++ b/tests/mir-opt/dataflow-const-prop/issue_81605.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR issue_81605.f.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs index af13c7d1020d6..d611a54ba71a2 100644 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.rs +++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs index dbea1480445f7..16a45c8e9fb59 100644 --- a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs +++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR mult_by_zero.test.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.rs b/tests/mir-opt/dataflow-const-prop/offset_of.rs index ccc90790e52c9..e71b3f59ecab3 100644 --- a/tests/mir-opt/dataflow-const-prop/offset_of.rs +++ b/tests/mir-opt/dataflow-const-prop/offset_of.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs index 4ac0a5b3298ac..2851c0590ad5f 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs index 9fa353e44c543..b824481948116 100644 --- a/tests/mir-opt/dataflow-const-prop/repeat.rs +++ b/tests/mir-opt/dataflow-const-prop/repeat.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs index 4ce0ca4dff46f..8cbed6fbb624d 100644 --- a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs +++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // The struct has scalar ABI, but is not a scalar type. diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.rs b/tests/mir-opt/dataflow-const-prop/self_assign.rs index 8de2195f93ba4..c5866c4a9fd98 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign.rs +++ b/tests/mir-opt/dataflow-const-prop/self_assign.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR self_assign.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs index e3282762459a0..cfe1458e44be7 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs +++ b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR self_assign_add.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs index 87842f347e48c..68aff528695d5 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // This attempts to modify `x.1` via a pointer derived from `addr_of_mut!(x.0)`. // According to Miri, that is UB. However, T-opsem has not finalized that diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs index 41367e48497bd..86266ef5d4e60 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.rs +++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp // compile-flags: -Zmir-enable-passes=+InstSimplify diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs index e92a1676d3f53..7b0646a535640 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.rs +++ b/tests/mir-opt/dataflow-const-prop/struct.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/terminator.rs b/tests/mir-opt/dataflow-const-prop/terminator.rs index 114dbeca5acf1..92a42f22c218f 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.rs +++ b/tests/mir-opt/dataflow-const-prop/terminator.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DataflowConstProp diff --git a/tests/mir-opt/dataflow-const-prop/transmute.rs b/tests/mir-opt/dataflow-const-prop/transmute.rs index c25e33ab0b637..16597b16083cb 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.rs +++ b/tests/mir-opt/dataflow-const-prop/transmute.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // compile-flags: -O --crate-type=lib // ignore-endian-big diff --git a/tests/mir-opt/dataflow-const-prop/tuple.rs b/tests/mir-opt/dataflow-const-prop/tuple.rs index 92c70eab0ff6f..c63ce8b140f87 100644 --- a/tests/mir-opt/dataflow-const-prop/tuple.rs +++ b/tests/mir-opt/dataflow-const-prop/tuple.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DataflowConstProp // EMIT_MIR tuple.main.DataflowConstProp.diff diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs index f09cdee14822e..dcd15fb2b09ec 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DeadStoreElimination // compile-flags: -Zmir-enable-passes=+CopyProp diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs index e3def2f65da17..8896f5ff345b2 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.rs +++ b/tests/mir-opt/dead-store-elimination/cycle.rs @@ -1,3 +1,4 @@ +// skip-filecheck // This example is interesting because the non-transitive version of `MaybeLiveLocals` would // report that *all* of these stores are live. // diff --git a/tests/mir-opt/dead-store-elimination/place_mention.rs b/tests/mir-opt/dead-store-elimination/place_mention.rs index 59dc74454a402..4813cf7ee2bd6 100644 --- a/tests/mir-opt/dead-store-elimination/place_mention.rs +++ b/tests/mir-opt/dead-store-elimination/place_mention.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DeadStoreElimination // compile-flags: -Zmir-keep-place-mention diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.rs b/tests/mir-opt/dead-store-elimination/provenance_soundness.rs index 11314e990982c..24ffbe980ebc6 100644 --- a/tests/mir-opt/dead-store-elimination/provenance_soundness.rs +++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: DeadStoreElimination // compile-flags: -Zmir-emit-retag diff --git a/tests/mir-opt/deduplicate_blocks.rs b/tests/mir-opt/deduplicate_blocks.rs index 0c38c7f215e0a..d3b89102f0ca8 100644 --- a/tests/mir-opt/deduplicate_blocks.rs +++ b/tests/mir-opt/deduplicate_blocks.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DeduplicateBlocks diff --git a/tests/mir-opt/deref-patterns/string.rs b/tests/mir-opt/deref-patterns/string.rs index 3a99c44aa0e18..0c8385b5c4837 100644 --- a/tests/mir-opt/deref-patterns/string.rs +++ b/tests/mir-opt/deref-patterns/string.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z mir-opt-level=0 -C panic=abort #![feature(string_deref_patterns)] diff --git a/tests/mir-opt/derefer_complex_case.rs b/tests/mir-opt/derefer_complex_case.rs index cc619879ef3a7..6097d8739fb51 100644 --- a/tests/mir-opt/derefer_complex_case.rs +++ b/tests/mir-opt/derefer_complex_case.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: Derefer // EMIT_MIR derefer_complex_case.main.Derefer.diff // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/derefer_inline_test.rs b/tests/mir-opt/derefer_inline_test.rs index 7ac330e51025e..713c051f44ad2 100644 --- a/tests/mir-opt/derefer_inline_test.rs +++ b/tests/mir-opt/derefer_inline_test.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: Derefer // EMIT_MIR derefer_inline_test.main.Derefer.diff // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/derefer_terminator_test.rs b/tests/mir-opt/derefer_terminator_test.rs index 164aa733a246c..3780ff5df7dfa 100644 --- a/tests/mir-opt/derefer_terminator_test.rs +++ b/tests/mir-opt/derefer_terminator_test.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: Derefer // EMIT_MIR derefer_terminator_test.main.Derefer.diff // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/derefer_test.rs b/tests/mir-opt/derefer_test.rs index fad0fe8eb6fc3..171925bb19dfc 100644 --- a/tests/mir-opt/derefer_test.rs +++ b/tests/mir-opt/derefer_test.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: Derefer // EMIT_MIR derefer_test.main.Derefer.diff fn main() { diff --git a/tests/mir-opt/derefer_test_multiple.rs b/tests/mir-opt/derefer_test_multiple.rs index 0b3888b07ab45..ac778a9c9b743 100644 --- a/tests/mir-opt/derefer_test_multiple.rs +++ b/tests/mir-opt/derefer_test_multiple.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: Derefer // EMIT_MIR derefer_test_multiple.main.Derefer.diff fn main () { diff --git a/tests/mir-opt/dest-prop/branch.rs b/tests/mir-opt/dest-prop/branch.rs index 5007aafb62f8c..d8c74a0aa91db 100644 --- a/tests/mir-opt/dest-prop/branch.rs +++ b/tests/mir-opt/dest-prop/branch.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that assignment in both branches of an `if` are eliminated. // unit-test: DestinationPropagation diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs index 1f8d588925c4e..435cf07ab0c0a 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that DestinationPropagation does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) diff --git a/tests/mir-opt/dest-prop/cycle.rs b/tests/mir-opt/dest-prop/cycle.rs index 9bc0cb05a3514..77cff062cc460 100644 --- a/tests/mir-opt/dest-prop/cycle.rs +++ b/tests/mir-opt/dest-prop/cycle.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code. // unit-test: DestinationPropagation diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs index 2f95ba0e326a4..a6fd542d3b58f 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.rs +++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: DestinationPropagation diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs index e67653c57e4d2..c9895f35cf1d1 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.rs +++ b/tests/mir-opt/dest-prop/dead_stores_better.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates // that that pass enables this one to do more optimizations. diff --git a/tests/mir-opt/dest-prop/simple.rs b/tests/mir-opt/dest-prop/simple.rs index 0bcb2924f1dd9..03d20962690e6 100644 --- a/tests/mir-opt/dest-prop/simple.rs +++ b/tests/mir-opt/dest-prop/simple.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too. // unit-test: DestinationPropagation diff --git a/tests/mir-opt/dest-prop/union.rs b/tests/mir-opt/dest-prop/union.rs index 4bc6f28c6c297..6d3e6d7fa7605 100644 --- a/tests/mir-opt/dest-prop/union.rs +++ b/tests/mir-opt/dest-prop/union.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that we can propagate into places that are projections into unions // compile-flags: -Zunsound-mir-opts diff --git a/tests/mir-opt/dest-prop/unreachable.rs b/tests/mir-opt/dest-prop/unreachable.rs index e950dbbf5c917..a47d2a0c8e248 100644 --- a/tests/mir-opt/dest-prop/unreachable.rs +++ b/tests/mir-opt/dest-prop/unreachable.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that unreachable code is removed after the destination propagation. // Regression test for issue #105428. diff --git a/tests/mir-opt/dont_inline_type_id.rs b/tests/mir-opt/dont_inline_type_id.rs index d8a5663609443..788c2f55dc02d 100644 --- a/tests/mir-opt/dont_inline_type_id.rs +++ b/tests/mir-opt/dont_inline_type_id.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: Inline // compile-flags: --crate-type=lib -C panic=abort diff --git a/tests/mir-opt/dont_yeet_assert.rs b/tests/mir-opt/dont_yeet_assert.rs index 38cc5a293e870..f61bfb8a46ff4 100644 --- a/tests/mir-opt/dont_yeet_assert.rs +++ b/tests/mir-opt/dont_yeet_assert.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: --crate-type=lib // unit-test: InstSimplify diff --git a/tests/mir-opt/early_otherwise_branch.rs b/tests/mir-opt/early_otherwise_branch.rs index 7be9fbd0326f6..b48516c5aa1bd 100644 --- a/tests/mir-opt/early_otherwise_branch.rs +++ b/tests/mir-opt/early_otherwise_branch.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: EarlyOtherwiseBranch // EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff fn opt1(x: Option, y: Option) -> u32 { diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs index 76055e1330fa7..2a0fba9bea415 100644 --- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs +++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: EarlyOtherwiseBranch // EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff diff --git a/tests/mir-opt/early_otherwise_branch_68867.rs b/tests/mir-opt/early_otherwise_branch_68867.rs index a6a56f3a95d18..f27527b96ab8d 100644 --- a/tests/mir-opt/early_otherwise_branch_68867.rs +++ b/tests/mir-opt/early_otherwise_branch_68867.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: EarlyOtherwiseBranch // FIXME: This test was broken by the derefer change. diff --git a/tests/mir-opt/early_otherwise_branch_noopt.rs b/tests/mir-opt/early_otherwise_branch_noopt.rs index ef766bbd4a651..351640c27c525 100644 --- a/tests/mir-opt/early_otherwise_branch_noopt.rs +++ b/tests/mir-opt/early_otherwise_branch_noopt.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: EarlyOtherwiseBranch // must not optimize as it does not follow the pattern of diff --git a/tests/mir-opt/early_otherwise_branch_soundness.rs b/tests/mir-opt/early_otherwise_branch_soundness.rs index cd45892324534..02c25a1bd598b 100644 --- a/tests/mir-opt/early_otherwise_branch_soundness.rs +++ b/tests/mir-opt/early_otherwise_branch_soundness.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: EarlyOtherwiseBranch // Tests various cases that the `early_otherwise_branch` opt should *not* optimize diff --git a/tests/mir-opt/enum_opt.rs b/tests/mir-opt/enum_opt.rs index 2768d70804926..7738c4310405e 100644 --- a/tests/mir-opt/enum_opt.rs +++ b/tests/mir-opt/enum_opt.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: EnumSizeOpt // EMIT_MIR_FOR_EACH_BIT_WIDTH // compile-flags: -Zunsound-mir-opts diff --git a/tests/mir-opt/equal_true.rs b/tests/mir-opt/equal_true.rs index fbb5d8d37db8d..8d7cfe73ffc74 100644 --- a/tests/mir-opt/equal_true.rs +++ b/tests/mir-opt/equal_true.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test InstSimplify // EMIT_MIR equal_true.opt.InstSimplify.diff diff --git a/tests/mir-opt/exponential_or.rs b/tests/mir-opt/exponential_or.rs index 0b8be8385dde4..89963b9bdf444 100644 --- a/tests/mir-opt/exponential_or.rs +++ b/tests/mir-opt/exponential_or.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test that simple or-patterns don't get expanded to exponentially large CFGs // EMIT_MIR exponential_or.match_tuple.SimplifyCfg-initial.after.mir diff --git a/tests/mir-opt/fn_ptr_shim.rs b/tests/mir-opt/fn_ptr_shim.rs index 64fbdc9ded139..c82260baefee3 100644 --- a/tests/mir-opt/fn_ptr_shim.rs +++ b/tests/mir-opt/fn_ptr_shim.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Zmir-opt-level=0 // Tests that the `` shim does not create a `Call` terminator with a `Self` callee diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs index 79fd9457ce1ec..14aad039946e1 100644 --- a/tests/mir-opt/funky_arms.rs +++ b/tests/mir-opt/funky_arms.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: --crate-type lib -Cdebug-assertions=no diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir index d8bea14204d50..524fbeb0fead7 100644 --- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir +++ b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir @@ -4,7 +4,7 @@ _0: GeneratorSavedTy { ty: std::string::String, source_info: SourceInfo { - span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0), + span: $DIR/generator_drop_cleanup.rs:12:13: 12:15 (#0), scope: scope[0], }, ignore_for_traits: false, @@ -21,7 +21,7 @@ }, } */ -fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17}) -> () { +fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:11:15: 11:17}) -> () { let mut _0: (); let mut _2: (); let _3: std::string::String; diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir index d8b27eda8f2d8..c3f61169bfbb0 100644 --- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir +++ b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir @@ -4,7 +4,7 @@ _0: GeneratorSavedTy { ty: std::string::String, source_info: SourceInfo { - span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0), + span: $DIR/generator_drop_cleanup.rs:12:13: 12:15 (#0), scope: scope[0], }, ignore_for_traits: false, @@ -21,7 +21,7 @@ }, } */ -fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17}) -> () { +fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:11:15: 11:17}) -> () { let mut _0: (); let mut _2: (); let _3: std::string::String; diff --git a/tests/mir-opt/generator_drop_cleanup.rs b/tests/mir-opt/generator_drop_cleanup.rs index 7e0d7bb59a5ad..fb67031f774b5 100644 --- a/tests/mir-opt/generator_drop_cleanup.rs +++ b/tests/mir-opt/generator_drop_cleanup.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(generators, generator_trait)] // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir index 4587282de93a7..169d817675e20 100644 --- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir +++ b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir @@ -1,6 +1,6 @@ // MIR for `main::{closure#0}` before StateTransform -fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18}, _2: ()) -> () +fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:23:16: 23:18}, _2: ()) -> () yields () { let mut _0: (); diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir index 38026f65bbd1e..45e9c01b931af 100644 --- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir +++ b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir @@ -1,6 +1,6 @@ // MIR for `main::{closure#0}` before StateTransform -fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18}, _2: ()) -> () +fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:23:16: 23:18}, _2: ()) -> () yields () { let mut _0: (); diff --git a/tests/mir-opt/generator_storage_dead_unwind.rs b/tests/mir-opt/generator_storage_dead_unwind.rs index 664f7ef67e323..91f3a20befd18 100644 --- a/tests/mir-opt/generator_storage_dead_unwind.rs +++ b/tests/mir-opt/generator_storage_dead_unwind.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Test that we generate StorageDead on unwind paths for generators. diff --git a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir index ac7549f93b121..7047a5baae586 100644 --- a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir @@ -4,7 +4,7 @@ _0: GeneratorSavedTy { ty: HasDrop, source_info: SourceInfo { - span: $DIR/generator_tiny.rs:20:13: 20:15 (#0), + span: $DIR/generator_tiny.rs:21:13: 21:15 (#0), scope: scope[0], }, ignore_for_traits: false, @@ -21,7 +21,7 @@ }, } */ -fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}>, _2: u8) -> GeneratorState<(), ()> { +fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:20:16: 20:24}>, _2: u8) -> GeneratorState<(), ()> { debug _x => _10; let mut _0: std::ops::GeneratorState<(), ()>; let _3: HasDrop; @@ -34,18 +34,18 @@ fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:19:16: 19:24 let _10: u8; let mut _11: u32; scope 1 { - debug _d => (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop); + debug _d => (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:20:16: 20:24})) as variant#3).0: HasDrop); } bb0: { - _11 = discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}))); + _11 = discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:20:16: 20:24}))); switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6]; } bb1: { _10 = move _2; nop; - (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop) = HasDrop; + (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:20:16: 20:24})) as variant#3).0: HasDrop) = HasDrop; StorageLive(_4); goto -> bb2; } @@ -55,7 +55,7 @@ fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:19:16: 19:24 StorageLive(_7); _7 = (); _0 = GeneratorState::<(), ()>::Yielded(move _7); - discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}))) = 3; + discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:20:16: 20:24}))) = 3; return; } diff --git a/tests/mir-opt/generator_tiny.rs b/tests/mir-opt/generator_tiny.rs index 7dad63a61d6d8..e5570d74bbb4f 100644 --- a/tests/mir-opt/generator_tiny.rs +++ b/tests/mir-opt/generator_tiny.rs @@ -1,3 +1,4 @@ +// skip-filecheck //! Tests that generators that cannot return or unwind don't have unnecessary //! panic branches. diff --git a/tests/mir-opt/graphviz.rs b/tests/mir-opt/graphviz.rs index 6906b86c2a5f4..61b5a2fb3d861 100644 --- a/tests/mir-opt/graphviz.rs +++ b/tests/mir-opt/graphviz.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test graphviz output // compile-flags: -Z dump-mir-graphviz diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index a85e2ae368b41..fd24edc676c4b 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: GVN // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/if_condition_int.rs b/tests/mir-opt/if_condition_int.rs index 398311e6bb8e2..a3dd74d9a3796 100644 --- a/tests/mir-opt/if_condition_int.rs +++ b/tests/mir-opt/if_condition_int.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: SimplifyComparisonIntegral // EMIT_MIR if_condition_int.opt_u32.SimplifyComparisonIntegral.diff // EMIT_MIR if_condition_int.opt_negative.SimplifyComparisonIntegral.diff diff --git a/tests/mir-opt/inline/asm_unwind.rs b/tests/mir-opt/inline/asm_unwind.rs index 573ae1ba68d4d..0cf21fda72fac 100644 --- a/tests/mir-opt/inline/asm_unwind.rs +++ b/tests/mir-opt/inline/asm_unwind.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Tests inlining of `may_unwind` inline assembly. // // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/inline/caller_with_trivial_bound.rs b/tests/mir-opt/inline/caller_with_trivial_bound.rs index a8f101d488cae..3829cbdd30240 100644 --- a/tests/mir-opt/inline/caller_with_trivial_bound.rs +++ b/tests/mir-opt/inline/caller_with_trivial_bound.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // needs-unwind diff --git a/tests/mir-opt/inline/cycle.rs b/tests/mir-opt/inline/cycle.rs index 1b74d818451e7..3e4f06834358e 100644 --- a/tests/mir-opt/inline/cycle.rs +++ b/tests/mir-opt/inline/cycle.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -Zinline-mir-hint-threshold=1000 diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs index 971223c72ca23..4147325ec44b9 100644 --- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -Zmir-enable-passes=+Inline --crate-type=lib diff --git a/tests/mir-opt/inline/dyn_trait.rs b/tests/mir-opt/inline/dyn_trait.rs index 0faeec0bbab27..7b41b1e1171e2 100644 --- a/tests/mir-opt/inline/dyn_trait.rs +++ b/tests/mir-opt/inline/dyn_trait.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/inline/exponential_runtime.rs b/tests/mir-opt/inline/exponential_runtime.rs index cfa9ff210f846..6d3af8b9c572a 100644 --- a/tests/mir-opt/inline/exponential_runtime.rs +++ b/tests/mir-opt/inline/exponential_runtime.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Checks that code with exponential runtime does not have exponential behavior in inlining. diff --git a/tests/mir-opt/inline/inline_any_operand.rs b/tests/mir-opt/inline/inline_any_operand.rs index fb0de020f73a2..e131cd6ef7ee8 100644 --- a/tests/mir-opt/inline/inline_any_operand.rs +++ b/tests/mir-opt/inline/inline_any_operand.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z span_free_formats // Tests that MIR inliner works for any operand diff --git a/tests/mir-opt/inline/inline_async.rs b/tests/mir-opt/inline/inline_async.rs index 5c838159b986c..932dc5635f0d7 100644 --- a/tests/mir-opt/inline/inline_async.rs +++ b/tests/mir-opt/inline/inline_async.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Checks that inliner doesn't introduce cycles when optimizing generators. // The outcome of optimization is not verfied, just the absence of the cycle. // Regression test for #76181. diff --git a/tests/mir-opt/inline/inline_box_fn.rs b/tests/mir-opt/inline/inline_box_fn.rs index 348f0e77f92a4..f6a90b92c9118 100644 --- a/tests/mir-opt/inline/inline_box_fn.rs +++ b/tests/mir-opt/inline/inline_box_fn.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: Inline // compile-flags: --crate-type=lib diff --git a/tests/mir-opt/inline/inline_closure.rs b/tests/mir-opt/inline/inline_closure.rs index 715fd0138a743..bd4c84ff0ca29 100644 --- a/tests/mir-opt/inline/inline_closure.rs +++ b/tests/mir-opt/inline/inline_closure.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z span_free_formats // Tests that MIR inliner can handle closure arguments. (#45894) diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.rs b/tests/mir-opt/inline/inline_closure_borrows_arg.rs index d76bc33f52e7d..a5cc7d1036530 100644 --- a/tests/mir-opt/inline/inline_closure_borrows_arg.rs +++ b/tests/mir-opt/inline/inline_closure_borrows_arg.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z span_free_formats -Zunsound-mir-opts // Tests that MIR inliner can handle closure arguments, diff --git a/tests/mir-opt/inline/inline_closure_captures.rs b/tests/mir-opt/inline/inline_closure_captures.rs index 52b6817e401c1..0d95564e5ddee 100644 --- a/tests/mir-opt/inline/inline_closure_captures.rs +++ b/tests/mir-opt/inline/inline_closure_captures.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z span_free_formats // Tests that MIR inliner can handle closure captures. diff --git a/tests/mir-opt/inline/inline_compatibility.rs b/tests/mir-opt/inline/inline_compatibility.rs index 1527fea1c93c1..52f4debf5dbad 100644 --- a/tests/mir-opt/inline/inline_compatibility.rs +++ b/tests/mir-opt/inline/inline_compatibility.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Checks that only functions with compatible attributes are inlined. // // only-x86_64 diff --git a/tests/mir-opt/inline/inline_cycle.rs b/tests/mir-opt/inline/inline_cycle.rs index 42a6914c96516..e3dd082556b95 100644 --- a/tests/mir-opt/inline/inline_cycle.rs +++ b/tests/mir-opt/inline/inline_cycle.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that inliner handles various forms of recursion and doesn't fall into // an infinite inlining cycle. The particular outcome of inlining is not diff --git a/tests/mir-opt/inline/inline_cycle_generic.rs b/tests/mir-opt/inline/inline_cycle_generic.rs index ef261b04c8085..667bf7f9254df 100644 --- a/tests/mir-opt/inline/inline_cycle_generic.rs +++ b/tests/mir-opt/inline/inline_cycle_generic.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that inliner handles various forms of recursion and doesn't fall into // an infinite inlining cycle. The particular outcome of inlining is not diff --git a/tests/mir-opt/inline/inline_diverging.rs b/tests/mir-opt/inline/inline_diverging.rs index e01c4c1dd0214..9e50b1ead2bc0 100644 --- a/tests/mir-opt/inline/inline_diverging.rs +++ b/tests/mir-opt/inline/inline_diverging.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Tests inlining of diverging calls. // // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff index 06ee8c464d5ba..48d908fad8890 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff @@ -4,26 +4,26 @@ fn main() -> () { let mut _0: (); let _1: std::ops::GeneratorState; - let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>; - let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}; - let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8}; + let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}>; + let mut _3: &mut {generator@$DIR/inline_generator.rs:17:5: 17:8}; + let mut _4: {generator@$DIR/inline_generator.rs:17:5: 17:8}; + let mut _5: bool; scope 1 { debug _r => _1; } + scope 2 (inlined g) { + } -+ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) { ++ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}>::new) { + debug pointer => _3; + scope 4 { -+ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) { ++ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}>::new_unchecked) { + debug pointer => _3; + } + } + } + scope 6 (inlined g::{closure#0}) { + debug a => _5; -+ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}; ++ let mut _6: &mut {generator@$DIR/inline_generator.rs:17:5: 17:8}; + let mut _7: u32; + let mut _8: i32; + } @@ -34,22 +34,22 @@ StorageLive(_3); StorageLive(_4); - _4 = g() -> [return: bb1, unwind unreachable]; -+ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)}; ++ _4 = {generator@$DIR/inline_generator.rs:17:5: 17:8 (#0)}; + _3 = &mut _4; -+ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 }; ++ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}> { pointer: move _3 }; + StorageDead(_3); + StorageLive(_5); + _5 = const false; + StorageLive(_6); + StorageLive(_7); -+ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}); ++ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:17:5: 17:8}); + _7 = discriminant((*_6)); + switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9]; } bb1: { - _3 = &mut _4; -- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable]; +- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}>::new(move _3) -> [return: bb2, unwind unreachable]; + StorageDead(_7); + StorageDead(_6); + StorageDead(_5); @@ -59,7 +59,7 @@ bb2: { - StorageDead(_3); -- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind unreachable]; +- _1 = <{generator@$DIR/inline_generator.rs:17:5: 17:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind unreachable]; + StorageDead(_4); + _0 = const (); + StorageDead(_1); diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff index da29ba5f50d73..9cb84b314de94 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff @@ -4,26 +4,26 @@ fn main() -> () { let mut _0: (); let _1: std::ops::GeneratorState; - let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>; - let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}; - let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8}; + let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}>; + let mut _3: &mut {generator@$DIR/inline_generator.rs:17:5: 17:8}; + let mut _4: {generator@$DIR/inline_generator.rs:17:5: 17:8}; + let mut _5: bool; scope 1 { debug _r => _1; } + scope 2 (inlined g) { + } -+ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) { ++ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}>::new) { + debug pointer => _3; + scope 4 { -+ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) { ++ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}>::new_unchecked) { + debug pointer => _3; + } + } + } + scope 6 (inlined g::{closure#0}) { + debug a => _5; -+ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}; ++ let mut _6: &mut {generator@$DIR/inline_generator.rs:17:5: 17:8}; + let mut _7: u32; + let mut _8: i32; + } @@ -37,20 +37,20 @@ - } - - bb1: { -+ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)}; ++ _4 = {generator@$DIR/inline_generator.rs:17:5: 17:8 (#0)}; _3 = &mut _4; -- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb5]; +- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}>::new(move _3) -> [return: bb2, unwind: bb5]; - } - - bb2: { -+ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 }; ++ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:17:5: 17:8}> { pointer: move _3 }; StorageDead(_3); -- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind: bb5]; +- _1 = <{generator@$DIR/inline_generator.rs:17:5: 17:8} as Generator>::resume(move _2, const false) -> [return: bb3, unwind: bb5]; + StorageLive(_5); + _5 = const false; + StorageLive(_6); + StorageLive(_7); -+ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8}); ++ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:17:5: 17:8}); + _7 = discriminant((*_6)); + switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11]; } diff --git a/tests/mir-opt/inline/inline_generator.rs b/tests/mir-opt/inline/inline_generator.rs index 2d71458c1741a..d96d1f98f149e 100644 --- a/tests/mir-opt/inline/inline_generator.rs +++ b/tests/mir-opt/inline/inline_generator.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -Zinline-mir-hint-threshold=1000 #![feature(generators, generator_trait)] diff --git a/tests/mir-opt/inline/inline_instruction_set.rs b/tests/mir-opt/inline/inline_instruction_set.rs index 5dfb04943e39f..4ac4d462f82de 100644 --- a/tests/mir-opt/inline/inline_instruction_set.rs +++ b/tests/mir-opt/inline/inline_instruction_set.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Checks that only functions with the compatible instruction_set attributes are inlined. // // A function is "compatible" when the *callee* has the same attribute or no attribute. diff --git a/tests/mir-opt/inline/inline_into_box_place.rs b/tests/mir-opt/inline/inline_into_box_place.rs index 56f174e515b31..b755692afc214 100644 --- a/tests/mir-opt/inline/inline_into_box_place.rs +++ b/tests/mir-opt/inline/inline_into_box_place.rs @@ -1,3 +1,4 @@ +// skip-filecheck // ignore-endian-big // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // ignore-debug MIR alignment checks in std alter the diff, breaking the test diff --git a/tests/mir-opt/inline/inline_options.rs b/tests/mir-opt/inline/inline_options.rs index b247ecd0bc0a1..394a8c4945cdd 100644 --- a/tests/mir-opt/inline/inline_options.rs +++ b/tests/mir-opt/inline/inline_options.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Checks that inlining threshold can be controlled with // inline-mir-threshold and inline-hint-threshold options. diff --git a/tests/mir-opt/inline/inline_retag.rs b/tests/mir-opt/inline/inline_retag.rs index c6950f2692522..f695b9f22e616 100644 --- a/tests/mir-opt/inline/inline_retag.rs +++ b/tests/mir-opt/inline/inline_retag.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z span_free_formats -Z mir-emit-retag // Tests that MIR inliner fixes up `Retag`'s `fn_entry` flag diff --git a/tests/mir-opt/inline/inline_shims.rs b/tests/mir-opt/inline/inline_shims.rs index eafbb962efb73..37b0d8ed88b93 100644 --- a/tests/mir-opt/inline/inline_shims.rs +++ b/tests/mir-opt/inline/inline_shims.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/inline/inline_specialization.rs b/tests/mir-opt/inline/inline_specialization.rs index 0311531dc3fa2..eb0cf891dad01 100644 --- a/tests/mir-opt/inline/inline_specialization.rs +++ b/tests/mir-opt/inline/inline_specialization.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![feature(specialization)] diff --git a/tests/mir-opt/inline/inline_trait_method.rs b/tests/mir-opt/inline/inline_trait_method.rs index a9d2168c2ec15..8a95adf3713e2 100644 --- a/tests/mir-opt/inline/inline_trait_method.rs +++ b/tests/mir-opt/inline/inline_trait_method.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -Z span_free_formats diff --git a/tests/mir-opt/inline/inline_trait_method_2.rs b/tests/mir-opt/inline/inline_trait_method_2.rs index 62ec7ebde6a99..e87609a8c7e00 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.rs +++ b/tests/mir-opt/inline/inline_trait_method_2.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -Z span_free_formats -Z mir-opt-level=4 diff --git a/tests/mir-opt/inline/issue_106141.rs b/tests/mir-opt/inline/issue_106141.rs index e442f8a7522fb..6702e7b4420c0 100644 --- a/tests/mir-opt/inline/issue_106141.rs +++ b/tests/mir-opt/inline/issue_106141.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY pub fn outer() -> usize { inner() diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs index 94f926d39648f..da779fed76fb5 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR issue_58867_inline_as_ref_as_mut.a.Inline.after.mir pub fn a(x: &mut [T]) -> &mut [T] { x.as_mut() diff --git a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir index 4d170c41f9719..d28c0441f63c3 100644 --- a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir +++ b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir @@ -2,8 +2,8 @@ fn main() -> () { let mut _0: (); - let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16}; - let mut _2: &{closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16}; + let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs:6:13: 6:16}; + let mut _2: &{closure@$DIR/issue_76997_inline_scopes_parenting.rs:6:13: 6:16}; let mut _3: ((),); let mut _4: (); let mut _5: (); @@ -19,7 +19,7 @@ fn main() -> () { bb0: { StorageLive(_1); - _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16}; + _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:6:13: 6:16}; StorageLive(_2); _2 = &_1; StorageLive(_3); diff --git a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs index 76d806acc6349..c7147d42df996 100644 --- a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs +++ b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Tests that MIR inliner can handle `SourceScopeData` parenting correctly. (#76997) // EMIT_MIR issue_76997_inline_scopes_parenting.main.Inline.after.mir diff --git a/tests/mir-opt/inline/issue_78442.rs b/tests/mir-opt/inline/issue_78442.rs index d956e62414ccf..f83ed70d0db32 100644 --- a/tests/mir-opt/inline/issue_78442.rs +++ b/tests/mir-opt/inline/issue_78442.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z mir-opt-level=3 -Z inline-mir // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/inline/polymorphic_recursion.rs b/tests/mir-opt/inline/polymorphic_recursion.rs index 7388722b77633..f71e382e867f5 100644 --- a/tests/mir-opt/inline/polymorphic_recursion.rs +++ b/tests/mir-opt/inline/polymorphic_recursion.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Make sure that the MIR inliner does not loop indefinitely on polymorphic recursion. // compile-flags: --crate-type lib diff --git a/tests/mir-opt/inline/unchecked_shifts.rs b/tests/mir-opt/inline/unchecked_shifts.rs index 22f84e44a6411..67666f2f713f2 100644 --- a/tests/mir-opt/inline/unchecked_shifts.rs +++ b/tests/mir-opt/inline/unchecked_shifts.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] #![feature(unchecked_math)] diff --git a/tests/mir-opt/inline/unsized_argument.rs b/tests/mir-opt/inline/unsized_argument.rs index b2c51407fd536..22c88b83f9b1b 100644 --- a/tests/mir-opt/inline/unsized_argument.rs +++ b/tests/mir-opt/inline/unsized_argument.rs @@ -1,3 +1,4 @@ +// skip-filecheck // needs-unwind #![feature(unsized_fn_params)] diff --git a/tests/mir-opt/inline/unwrap_unchecked.rs b/tests/mir-opt/inline/unwrap_unchecked.rs index f28aef7a808a8..f8964eba227a4 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.rs +++ b/tests/mir-opt/inline/unwrap_unchecked.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![crate_type = "lib"] // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/inline_generically_if_sized.rs b/tests/mir-opt/inline_generically_if_sized.rs index 1acfff7a56b7c..1a7512a4b8d12 100644 --- a/tests/mir-opt/inline_generically_if_sized.rs +++ b/tests/mir-opt/inline_generically_if_sized.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: Inline // compile-flags: --crate-type=lib -C panic=abort diff --git a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff index 13ff1e284d9a5..1ef6b69ef5b0c 100644 --- a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff +++ b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff @@ -4,7 +4,7 @@ fn bar() -> bool { let mut _0: bool; -+ coverage Counter(0) => /the/src/instrument_coverage.rs:20:1 - 22:2; ++ coverage Counter(0) => /the/src/instrument_coverage.rs:21:1 - 23:2; + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff index f5c59c84693f8..14b4833a515b6 100644 --- a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff @@ -9,11 +9,11 @@ + coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Add, rhs: Counter(1) }; + coverage ExpressionId(1) => Expression { lhs: Expression(0), op: Subtract, rhs: Counter(1) }; -+ coverage Counter(0) => /the/src/instrument_coverage.rs:11:1 - 11:11; -+ coverage Expression(0) => /the/src/instrument_coverage.rs:12:5 - 13:17; -+ coverage Expression(1) => /the/src/instrument_coverage.rs:14:13 - 14:18; -+ coverage Expression(1) => /the/src/instrument_coverage.rs:17:1 - 17:2; -+ coverage Counter(1) => /the/src/instrument_coverage.rs:15:10 - 15:11; ++ coverage Counter(0) => /the/src/instrument_coverage.rs:12:1 - 12:11; ++ coverage Expression(0) => /the/src/instrument_coverage.rs:13:5 - 14:17; ++ coverage Expression(1) => /the/src/instrument_coverage.rs:15:13 - 15:18; ++ coverage Expression(1) => /the/src/instrument_coverage.rs:18:1 - 18:2; ++ coverage Counter(1) => /the/src/instrument_coverage.rs:16:10 - 16:11; + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/instrument_coverage.rs b/tests/mir-opt/instrument_coverage.rs index 7f6a0a0eb094a..f131fc0a3241d 100644 --- a/tests/mir-opt/instrument_coverage.rs +++ b/tests/mir-opt/instrument_coverage.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test that `-C instrument-coverage` injects Coverage statements. The Coverage Counter statements // are later converted into LLVM instrprof.increment intrinsics, during codegen. diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs index 3e280a40fda3a..db98bb400b95e 100644 --- a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs +++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] #![crate_type = "lib"] diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/intrinsic_asserts.rs index 302d4bda188a6..d627644474db7 100644 --- a/tests/mir-opt/intrinsic_asserts.rs +++ b/tests/mir-opt/intrinsic_asserts.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/mir-opt/issue_101973.rs b/tests/mir-opt/issue_101973.rs index 01b342f4dc3a5..3de325bc170b5 100644 --- a/tests/mir-opt/issue_101973.rs +++ b/tests/mir-opt/issue_101973.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -O -C debug-assertions=on // This needs inlining followed by ConstProp to reproduce, so we cannot use "unit-test". diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.rs b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs index 54112627e4ef0..cd068f1223674 100644 --- a/tests/mir-opt/issue_104451_unwindable_intrinsics.rs +++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Check that `UnwindAction::Unreachable` is not generated for unwindable intrinsics. // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![feature(core_intrinsics)] diff --git a/tests/mir-opt/issue_38669.rs b/tests/mir-opt/issue_38669.rs index db3f89472c982..9da4c89bb1218 100644 --- a/tests/mir-opt/issue_38669.rs +++ b/tests/mir-opt/issue_38669.rs @@ -1,3 +1,4 @@ +// skip-filecheck // check that we don't StorageDead booleans before they are used // EMIT_MIR issue_38669.main.SimplifyCfg-initial.after.mir diff --git a/tests/mir-opt/issue_41110.rs b/tests/mir-opt/issue_41110.rs index d8665b23d265c..38602d5eaef42 100644 --- a/tests/mir-opt/issue_41110.rs +++ b/tests/mir-opt/issue_41110.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // check that we don't emit multiple drop flags when they are not needed. diff --git a/tests/mir-opt/issue_41697.rs b/tests/mir-opt/issue_41697.rs index cbd8633a345c7..92d382c39407a 100644 --- a/tests/mir-opt/issue_41697.rs +++ b/tests/mir-opt/issue_41697.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Regression test for #41697. Using dump-mir was triggering // artificial cycles: during type-checking, we had to get the MIR for // the constant expressions in `[u8; 2]`, which in turn would trigger diff --git a/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir b/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir index 0b48e58dabde7..7dafeabaacc74 100644 --- a/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir +++ b/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir @@ -1,6 +1,6 @@ -// MIR for `::{constant#0}` after SimplifyCfg-promote-consts +// MIR for `::{constant#0}` after SimplifyCfg-promote-consts -::{constant#0}: usize = { +::{constant#0}: usize = { let mut _0: usize; let mut _1: (usize, bool); diff --git a/tests/mir-opt/issue_41888.rs b/tests/mir-opt/issue_41888.rs index 9b16caf92fed4..70b2021863360 100644 --- a/tests/mir-opt/issue_41888.rs +++ b/tests/mir-opt/issue_41888.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // check that we clear the "ADT master drop flag" even when there are // no fields to be dropped. diff --git a/tests/mir-opt/issue_62289.rs b/tests/mir-opt/issue_62289.rs index fece6bb7cf528..40e8352cff410 100644 --- a/tests/mir-opt/issue_62289.rs +++ b/tests/mir-opt/issue_62289.rs @@ -1,3 +1,4 @@ +// skip-filecheck // check that we don't forget to drop the Box if we early return before // initializing it // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/issue_72181.rs b/tests/mir-opt/issue_72181.rs index 6a32d4bbee2f7..226709bab2feb 100644 --- a/tests/mir-opt/issue_72181.rs +++ b/tests/mir-opt/issue_72181.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z mir-opt-level=1 // Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags. diff --git a/tests/mir-opt/issue_72181_1.main.built.after.mir b/tests/mir-opt/issue_72181_1.main.built.after.mir index f5ab5b526df6e..d35aada95f889 100644 --- a/tests/mir-opt/issue_72181_1.main.built.after.mir +++ b/tests/mir-opt/issue_72181_1.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void -| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void +| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:17:12: 17:16, inferred_ty: Void +| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:17:12: 17:16, inferred_ty: Void | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/issue_72181_1.rs b/tests/mir-opt/issue_72181_1.rs index 8ae2599ec73f8..f9ee33ef991de 100644 --- a/tests/mir-opt/issue_72181_1.rs +++ b/tests/mir-opt/issue_72181_1.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z mir-opt-level=1 // Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags. diff --git a/tests/mir-opt/issue_76432.rs b/tests/mir-opt/issue_76432.rs index 2a8e1283b0cf9..f0f12c535c5b0 100644 --- a/tests/mir-opt/issue_76432.rs +++ b/tests/mir-opt/issue_76432.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -Zmir-enable-passes=-NormalizeArrayLen // Check that we do not insert StorageDead at each target if StorageDead was never seen diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs index 95142a3e46332..b08c3615e8b1a 100644 --- a/tests/mir-opt/issue_78192.rs +++ b/tests/mir-opt/issue_78192.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Zmir-opt-level=1 -Zinline-mir pub fn f(a: &T) -> *const T { let b: &*const T = &(a as *const T); diff --git a/tests/mir-opt/issue_91633.rs b/tests/mir-opt/issue_91633.rs index 9127cacc97c5d..047a0cd9bdbdb 100644 --- a/tests/mir-opt/issue_91633.rs +++ b/tests/mir-opt/issue_91633.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z mir-opt-level=0 // EMIT_MIR issue_91633.hey.built.after.mir fn hey (it: &[T]) diff --git a/tests/mir-opt/issue_99325.main.built.after.32bit.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir index f8ac75513baee..188b53d28d7a4 100644 --- a/tests/mir-opt/issue_99325.main.built.after.32bit.mir +++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} -| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:14:16: 14:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/issue_99325.main.built.after.64bit.mir b/tests/mir-opt/issue_99325.main.built.after.64bit.mir index f8ac75513baee..188b53d28d7a4 100644 --- a/tests/mir-opt/issue_99325.main.built.after.64bit.mir +++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} -| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:14:16: 14:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/issue_99325.rs b/tests/mir-opt/issue_99325.rs index 3603228a502e9..2638b69e2ee5b 100644 --- a/tests/mir-opt/issue_99325.rs +++ b/tests/mir-opt/issue_99325.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_BIT_WIDTH #![feature(adt_const_params)] diff --git a/tests/mir-opt/issues/issue_59352.rs b/tests/mir-opt/issues/issue_59352.rs index 7cadf8f227ff5..1cbeaec28bb2d 100644 --- a/tests/mir-opt/issues/issue_59352.rs +++ b/tests/mir-opt/issues/issue_59352.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // This test is a mirror of codegen/issue-59352.rs. // The LLVM inliner doesn't inline `char::method::is_digit()` and so it doesn't recognize this case diff --git a/tests/mir-opt/issues/issue_75439.rs b/tests/mir-opt/issues/issue_75439.rs index 4c749a150c091..0ab496e474d85 100644 --- a/tests/mir-opt/issues/issue_75439.rs +++ b/tests/mir-opt/issues/issue_75439.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff // ignore-endian-big diff --git a/tests/mir-opt/loop_test.rs b/tests/mir-opt/loop_test.rs index 7ded5b5757f55..81a0d9df0a0ae 100644 --- a/tests/mir-opt/loop_test.rs +++ b/tests/mir-opt/loop_test.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z identify_regions // Tests to make sure we correctly generate falseUnwind edges in loops diff --git a/tests/mir-opt/lower_array_len.rs b/tests/mir-opt/lower_array_len.rs index 7d69e175921c9..bfe0d8e9c3249 100644 --- a/tests/mir-opt/lower_array_len.rs +++ b/tests/mir-opt/lower_array_len.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: NormalizeArrayLen // compile-flags: -Zmir-enable-passes=+LowerSliceLenCalls diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 0758e9b775b9d..3f6bb916394d9 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: LowerIntrinsics // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/lower_slice_len.rs b/tests/mir-opt/lower_slice_len.rs index b0c512aec89d2..88492154d23ec 100644 --- a/tests/mir-opt/lower_slice_len.rs +++ b/tests/mir-opt/lower_slice_len.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: LowerSliceLenCalls diff --git a/tests/mir-opt/match_arm_scopes.rs b/tests/mir-opt/match_arm_scopes.rs index e0249de860135..43746e993985f 100644 --- a/tests/mir-opt/match_arm_scopes.rs +++ b/tests/mir-opt/match_arm_scopes.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Test that StorageDead and Drops are generated properly for bindings in // matches: diff --git a/tests/mir-opt/match_test.rs b/tests/mir-opt/match_test.rs index 3a21077905b96..e465289e427f4 100644 --- a/tests/mir-opt/match_test.rs +++ b/tests/mir-opt/match_test.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Make sure redundant testing paths in `match` expressions are sorted out. #![feature(exclusive_range_pattern)] diff --git a/tests/mir-opt/matches_reduce_branches.rs b/tests/mir-opt/matches_reduce_branches.rs index a81d5f7b4e8bc..13db797341435 100644 --- a/tests/mir-opt/matches_reduce_branches.rs +++ b/tests/mir-opt/matches_reduce_branches.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: MatchBranchSimplification diff --git a/tests/mir-opt/matches_u8.rs b/tests/mir-opt/matches_u8.rs index 422c3a95e8efa..47c4ffee0246a 100644 --- a/tests/mir-opt/matches_u8.rs +++ b/tests/mir-opt/matches_u8.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: MatchBranchSimplification diff --git a/tests/mir-opt/multiple_return_terminators.rs b/tests/mir-opt/multiple_return_terminators.rs index a2b902d148363..f33243ecf730d 100644 --- a/tests/mir-opt/multiple_return_terminators.rs +++ b/tests/mir-opt/multiple_return_terminators.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z mir-opt-level=4 // EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff diff --git a/tests/mir-opt/nll/named_lifetimes_basic.rs b/tests/mir-opt/nll/named_lifetimes_basic.rs index 843716033ca41..5a9312de284c1 100644 --- a/tests/mir-opt/nll/named_lifetimes_basic.rs +++ b/tests/mir-opt/nll/named_lifetimes_basic.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Basic test for named lifetime translation. Check that we // instantiate the types that appear in function arguments with // suitable variables and that we setup the outlives relationship diff --git a/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir b/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir index 1d6b830739019..49f0a43295a88 100644 --- a/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir +++ b/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir @@ -24,14 +24,14 @@ | '?2 live at {bb0[0..=1]} | '?3 live at {bb0[0..=1]} | '?4 live at {bb0[0..=1]} -| '?1: '?5 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0) -| '?1: '?7 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0) -| '?2: '?6 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0) -| '?3: '?8 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0) -| '?5: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0) -| '?6: '?2 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0) -| '?7: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0) -| '?8: '?3 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0) +| '?1: '?5 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:26: 13:27) ($DIR/named_lifetimes_basic.rs:13:26: 13:27 (#0) +| '?1: '?7 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:54: 13:55) ($DIR/named_lifetimes_basic.rs:13:54: 13:55 (#0) +| '?2: '?6 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:42: 13:43) ($DIR/named_lifetimes_basic.rs:13:42: 13:43 (#0) +| '?3: '?8 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:66: 13:67) ($DIR/named_lifetimes_basic.rs:13:66: 13:67 (#0) +| '?5: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:26: 13:27) ($DIR/named_lifetimes_basic.rs:13:26: 13:27 (#0) +| '?6: '?2 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:42: 13:43) ($DIR/named_lifetimes_basic.rs:13:42: 13:43 (#0) +| '?7: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:54: 13:55) ($DIR/named_lifetimes_basic.rs:13:54: 13:55 (#0) +| '?8: '?3 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:66: 13:67) ($DIR/named_lifetimes_basic.rs:13:66: 13:67 (#0) | fn use_x(_1: &'?5 mut i32, _2: &'?6 u32, _3: &'?7 u32, _4: &'?8 u32) -> bool { debug w => _1; diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index c581d0f8471f9..ad456600b0ab6 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -17,8 +17,8 @@ | '?2 live at {bb1[0]} | '?3 live at {bb1[1..=3]} | '?4 live at {bb1[4..=7], bb2[0..=2]} -| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0) -| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0) +| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:19:13: 19:18 (#0) +| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:20:13: 20:14 (#0) | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index 48243e34d0825..a15d47cd66fef 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -17,8 +17,8 @@ | '?2 live at {bb1[0]} | '?3 live at {bb1[1..=3]} | '?4 live at {bb1[4..=7], bb2[0..=2]} -| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0) -| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0) +| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:19:13: 19:18 (#0) +| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:20:13: 20:14 (#0) | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/nll/region_subtyping_basic.rs b/tests/mir-opt/nll/region_subtyping_basic.rs index 64332f302e82e..83f756acdc3c7 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.rs +++ b/tests/mir-opt/nll/region_subtyping_basic.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Basic test for liveness constraints: the region (`R1`) that appears // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. diff --git a/tests/mir-opt/no_drop_for_inactive_variant.rs b/tests/mir-opt/no_drop_for_inactive_variant.rs index adbd1f353fcf9..dd20e4a548eb1 100644 --- a/tests/mir-opt/no_drop_for_inactive_variant.rs +++ b/tests/mir-opt/no_drop_for_inactive_variant.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Ensure that there are no drop terminators in `unwrap` (except the one along the cleanup diff --git a/tests/mir-opt/no_spurious_drop_after_call.rs b/tests/mir-opt/no_spurious_drop_after_call.rs index 71f050502cbab..cd7b8fb79425a 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.rs +++ b/tests/mir-opt/no_spurious_drop_after_call.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Test that after the call to `std::mem::drop` we do not generate a diff --git a/tests/mir-opt/not_equal_false.rs b/tests/mir-opt/not_equal_false.rs index e056073290005..8008df79ceb5f 100644 --- a/tests/mir-opt/not_equal_false.rs +++ b/tests/mir-opt/not_equal_false.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: InstSimplify // EMIT_MIR not_equal_false.opt.InstSimplify.diff diff --git a/tests/mir-opt/nrvo_miscompile_111005.rs b/tests/mir-opt/nrvo_miscompile_111005.rs index a9f391b79d532..aff037ae4f297 100644 --- a/tests/mir-opt/nrvo_miscompile_111005.rs +++ b/tests/mir-opt/nrvo_miscompile_111005.rs @@ -1,3 +1,4 @@ +// skip-filecheck // This is a miscompilation, #111005 to track // unit-test: RenameReturnPlace diff --git a/tests/mir-opt/nrvo_simple.rs b/tests/mir-opt/nrvo_simple.rs index 9e822ed51d419..5b403c560a7e1 100644 --- a/tests/mir-opt/nrvo_simple.rs +++ b/tests/mir-opt/nrvo_simple.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: RenameReturnPlace diff --git a/tests/mir-opt/packed_struct_drop_aligned.rs b/tests/mir-opt/packed_struct_drop_aligned.rs index f88a683535c12..079c4e68f50ca 100644 --- a/tests/mir-opt/packed_struct_drop_aligned.rs +++ b/tests/mir-opt/packed_struct_drop_aligned.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs index 4303004198372..d1d400af22f4f 100644 --- a/tests/mir-opt/pre-codegen/chained_comparison.rs +++ b/tests/mir-opt/pre-codegen/chained_comparison.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs index 23d78e9877774..d386219f4a6b6 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.rs +++ b/tests/mir-opt/pre-codegen/checked_ops.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 // needs-unwind // only-x86_64 diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs index d8af6b14dad43..b1a00d293725f 100644 --- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs +++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0 // ignore-debug: standard library debug assertions add a panic that breaks this optimization diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs index e32e04384c4bd..565bd89e57160 100644 --- a/tests/mir-opt/pre-codegen/intrinsics.rs +++ b/tests/mir-opt/pre-codegen/intrinsics.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 // only-64bit diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs index f3ba409229d6e..7f9c26f4fffdd 100644 --- a/tests/mir-opt/pre-codegen/loops.rs +++ b/tests/mir-opt/pre-codegen/loops.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -Zmir-opt-level=2 -g // needs-unwind diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs index a139848bab26c..18c4653d4c6ea 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.rs +++ b/tests/mir-opt/pre-codegen/mem_replace.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 // only-64bit // ignore-debug the standard library debug assertions leak into this test diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs index 704f8f887e3ea..bb089ea445544 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -C overflow-checks=on diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs index 9552144787d10..80b1a5b2fa5ea 100644 --- a/tests/mir-opt/pre-codegen/range_iter.rs +++ b/tests/mir-opt/pre-codegen/range_iter.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 // only-64bit // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir index 80a470c948248..af5d385a979bb 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir @@ -3,9 +3,9 @@ fn ezmap(_1: Option) -> Option { debug x => _1; let mut _0: std::option::Option; - scope 1 (inlined map::) { + scope 1 (inlined map::) { debug slf => _1; - debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:17:12: 17:15}; + debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:18:12: 18:15}; let mut _2: isize; let _3: i32; let mut _4: i32; diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs index d4f28dda6c627..35f9ab3e154ca 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.rs +++ b/tests/mir-opt/pre-codegen/simple_option_map.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 // only-64bit diff --git a/tests/mir-opt/pre-codegen/slice_filter.rs b/tests/mir-opt/pre-codegen/slice_filter.rs index aba951acdd08d..483e5876615f1 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.rs +++ b/tests/mir-opt/pre-codegen/slice_filter.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 // ignore-debug: standard library debug assertions add a panic that breaks this optimization diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index b35d3a105ba1d..548767dca0d0a 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -1,6 +1,6 @@ // MIR for `variant_a::{closure#0}` after PreCodegen -fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool { +fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2: &&(usize, usize, usize, usize)) -> bool { let mut _0: bool; let mut _3: &(usize, usize, usize, usize); let _4: &usize; diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir index 80c8cebff45c8..e2ed1d101dcbc 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir @@ -1,6 +1,6 @@ // MIR for `variant_b::{closure#0}` after PreCodegen -fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, _2: &&(usize, usize, usize, usize)) -> bool { +fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, _2: &&(usize, usize, usize, usize)) -> bool { let mut _0: bool; let mut _3: &(usize, usize, usize, usize); let _4: usize; diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs index 57ffb07e2947b..5225fc5c6e185 100644 --- a/tests/mir-opt/pre-codegen/slice_index.rs +++ b/tests/mir-opt/pre-codegen/slice_index.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 // only-64bit // ignore-debug the standard library debug assertions leak into this test diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs index 1790056369cdb..10a5c3070d890 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.rs +++ b/tests/mir-opt/pre-codegen/slice_iter.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 // only-64bit // ignore-debug the standard library debug assertions leak into this test diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir index 7af69e08ca1b8..485dc9179cef0 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir @@ -1,18 +1,18 @@ // MIR for `outer` after PreCodegen fn outer(_1: u8) -> u8 { - debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15 - let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26 - let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13 - scope 1 (inlined inner) { // at $DIR/spans.rs:10:5: 10:14 - debug x => _2; // in scope 1 at $DIR/spans.rs:13:14: 13:15 + debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 + let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 + let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14 + debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15 } bb0: { - StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13 - _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13 - _0 = _1; // scope 1 at $DIR/spans.rs:14:5: 14:7 - StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14 - return; // scope 0 at $DIR/spans.rs:11:2: 11:2 + StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 + _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 + _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 + StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 + return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir index 7af69e08ca1b8..485dc9179cef0 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir @@ -1,18 +1,18 @@ // MIR for `outer` after PreCodegen fn outer(_1: u8) -> u8 { - debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15 - let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26 - let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13 - scope 1 (inlined inner) { // at $DIR/spans.rs:10:5: 10:14 - debug x => _2; // in scope 1 at $DIR/spans.rs:13:14: 13:15 + debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 + let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 + let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14 + debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15 } bb0: { - StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13 - _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13 - _0 = _1; // scope 1 at $DIR/spans.rs:14:5: 14:7 - StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14 - return; // scope 0 at $DIR/spans.rs:11:2: 11:2 + StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 + _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 + _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 + StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 + return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/spans.rs b/tests/mir-opt/pre-codegen/spans.rs index 295eb0476db20..aa36648ce395b 100644 --- a/tests/mir-opt/pre-codegen/spans.rs +++ b/tests/mir-opt/pre-codegen/spans.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test that the comments we emit in MIR opts are accurate. // // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs index a227c82d6a30e..b6e4eaad7e1da 100644 --- a/tests/mir-opt/pre-codegen/try_identity.rs +++ b/tests/mir-opt/pre-codegen/try_identity.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 // only-64bit diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index 610660131b191..bae053e0b3479 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ReferencePropagation // needs-unwind diff --git a/tests/mir-opt/remove_fake_borrows.rs b/tests/mir-opt/remove_fake_borrows.rs index f0ee98f777c61..21c7b46ee1a35 100644 --- a/tests/mir-opt/remove_fake_borrows.rs +++ b/tests/mir-opt/remove_fake_borrows.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test that the fake borrows for matches are removed after borrow checking. // EMIT_MIR_FOR_EACH_PANIC_STRATEGY diff --git a/tests/mir-opt/remove_never_const.rs b/tests/mir-opt/remove_never_const.rs index 160cc955534c2..c144edaffafb6 100644 --- a/tests/mir-opt/remove_never_const.rs +++ b/tests/mir-opt/remove_never_const.rs @@ -1,3 +1,4 @@ +// skip-filecheck // This was originally a regression test for #66975 - ensure that we do not generate never typed // consts in codegen. We also have tests for this that catches the error, see // tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs. diff --git a/tests/mir-opt/remove_storage_markers.rs b/tests/mir-opt/remove_storage_markers.rs index 330264461d7cc..6666ff3b7263b 100644 --- a/tests/mir-opt/remove_storage_markers.rs +++ b/tests/mir-opt/remove_storage_markers.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: RemoveStorageMarkers diff --git a/tests/mir-opt/remove_unneeded_drops.rs b/tests/mir-opt/remove_unneeded_drops.rs index 178d0924c5e0c..cad79e0aa0cbc 100644 --- a/tests/mir-opt/remove_unneeded_drops.rs +++ b/tests/mir-opt/remove_unneeded_drops.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR remove_unneeded_drops.opt.RemoveUnneededDrops.diff fn opt(x: bool) { diff --git a/tests/mir-opt/remove_zsts.rs b/tests/mir-opt/remove_zsts.rs index 1cf7ad6e3667c..e33a272fe16b9 100644 --- a/tests/mir-opt/remove_zsts.rs +++ b/tests/mir-opt/remove_zsts.rs @@ -1,3 +1,4 @@ +// skip-filecheck union Foo { x: (), y: u64, diff --git a/tests/mir-opt/retag.rs b/tests/mir-opt/retag.rs index e0696de4df379..1e4b017dad5fa 100644 --- a/tests/mir-opt/retag.rs +++ b/tests/mir-opt/retag.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: AddRetag // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // ignore-tidy-linelength diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir index d724774407495..285db435f5a0a 100644 --- a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir +++ b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -1,6 +1,6 @@ -// MIR for `::foo` after SimplifyCfg-elaborate-drops +// MIR for `::foo` after SimplifyCfg-elaborate-drops -fn ::foo(_1: &Test, _2: &mut i32) -> &mut i32 { +fn ::foo(_1: &Test, _2: &mut i32) -> &mut i32 { debug self => _1; debug x => _2; let mut _0: &mut i32; diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir index d724774407495..285db435f5a0a 100644 --- a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir +++ b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -1,6 +1,6 @@ -// MIR for `::foo` after SimplifyCfg-elaborate-drops +// MIR for `::foo` after SimplifyCfg-elaborate-drops -fn ::foo(_1: &Test, _2: &mut i32) -> &mut i32 { +fn ::foo(_1: &Test, _2: &mut i32) -> &mut i32 { debug self => _1; debug x => _2; let mut _0: &mut i32; diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir index de3eb0d52cf72..9ad607b2fe291 100644 --- a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir +++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -1,6 +1,6 @@ -// MIR for `::foo_shr` after SimplifyCfg-elaborate-drops +// MIR for `::foo_shr` after SimplifyCfg-elaborate-drops -fn ::foo_shr(_1: &Test, _2: &i32) -> &i32 { +fn ::foo_shr(_1: &Test, _2: &i32) -> &i32 { debug self => _1; debug x => _2; let mut _0: &i32; diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir index de3eb0d52cf72..9ad607b2fe291 100644 --- a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir +++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -1,6 +1,6 @@ -// MIR for `::foo_shr` after SimplifyCfg-elaborate-drops +// MIR for `::foo_shr` after SimplifyCfg-elaborate-drops -fn ::foo_shr(_1: &Test, _2: &i32) -> &i32 { +fn ::foo_shr(_1: &Test, _2: &i32) -> &i32 { debug self => _1; debug x => _2; let mut _0: &i32; diff --git a/tests/mir-opt/return_an_array.rs b/tests/mir-opt/return_an_array.rs index bea3c317c892f..09146a824fcdd 100644 --- a/tests/mir-opt/return_an_array.rs +++ b/tests/mir-opt/return_an_array.rs @@ -1,3 +1,4 @@ +// skip-filecheck // this tests move up progration, which is not yet implemented fn foo() -> [u8; 1024] { diff --git a/tests/mir-opt/separate_const_switch.rs b/tests/mir-opt/separate_const_switch.rs index d333d4b6be2cb..3f43cdf4350b7 100644 --- a/tests/mir-opt/separate_const_switch.rs +++ b/tests/mir-opt/separate_const_switch.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(control_flow_enum)] #![feature(try_trait_v2)] diff --git a/tests/mir-opt/simplify_arm.rs b/tests/mir-opt/simplify_arm.rs index 4c471ce046835..e933cb987d87a 100644 --- a/tests/mir-opt/simplify_arm.rs +++ b/tests/mir-opt/simplify_arm.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts // EMIT_MIR simplify_arm.id.SimplifyArmIdentity.diff // EMIT_MIR simplify_arm.id.SimplifyBranchSame.diff diff --git a/tests/mir-opt/simplify_arm_identity.rs b/tests/mir-opt/simplify_arm_identity.rs index e122cd50e0016..1b546c3938eaf 100644 --- a/tests/mir-opt/simplify_arm_identity.rs +++ b/tests/mir-opt/simplify_arm_identity.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Checks that `SimplifyArmIdentity` is not applied if enums have incompatible layouts. // Regression test for issue #66856. // diff --git a/tests/mir-opt/simplify_cfg.rs b/tests/mir-opt/simplify_cfg.rs index cf7eac4403a28..a87aaca544cee 100644 --- a/tests/mir-opt/simplify_cfg.rs +++ b/tests/mir-opt/simplify_cfg.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test that the goto chain starting from bb0 is collapsed. // compile-flags: -Cpanic=abort // no-prefer-dynamic diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs index e2578407fea9d..5c4277898cd05 100644 --- a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs +++ b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] #![crate_type = "lib"] diff --git a/tests/mir-opt/simplify_if.rs b/tests/mir-opt/simplify_if.rs index fff23b3ce7f2a..19b5806f72094 100644 --- a/tests/mir-opt/simplify_if.rs +++ b/tests/mir-opt/simplify_if.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #[inline(never)] fn noop() {} diff --git a/tests/mir-opt/simplify_locals.rs b/tests/mir-opt/simplify_locals.rs index 7bbc0481c68a4..d4052e521dead 100644 --- a/tests/mir-opt/simplify_locals.rs +++ b/tests/mir-opt/simplify_locals.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: SimplifyLocals-before-const-prop diff --git a/tests/mir-opt/simplify_locals_fixedpoint.rs b/tests/mir-opt/simplify_locals_fixedpoint.rs index 4da18b7fe58a6..b0c6e2d8eb594 100644 --- a/tests/mir-opt/simplify_locals_fixedpoint.rs +++ b/tests/mir-opt/simplify_locals_fixedpoint.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // compile-flags: -Zmir-opt-level=1 diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.rs b/tests/mir-opt/simplify_locals_removes_unused_consts.rs index 1e404c3a48c57..42879254d7146 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_consts.rs +++ b/tests/mir-opt/simplify_locals_removes_unused_consts.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: SimplifyLocals-before-const-prop // compile-flags: -C overflow-checks=no diff --git a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs index de65857412cfc..615b972209c39 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs +++ b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: SimplifyLocals-before-const-prop fn map(x: Option>) -> Option> { diff --git a/tests/mir-opt/simplify_match.rs b/tests/mir-opt/simplify_match.rs index 5d8e94b093568..eb385005cd996 100644 --- a/tests/mir-opt/simplify_match.rs +++ b/tests/mir-opt/simplify_match.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #[inline(never)] fn noop() {} diff --git a/tests/mir-opt/simplify_try_if_let.rs b/tests/mir-opt/simplify_try_if_let.rs index fba67de4033d9..3a59d78500ce1 100644 --- a/tests/mir-opt/simplify_try_if_let.rs +++ b/tests/mir-opt/simplify_try_if_let.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Zmir-opt-level=1 -Zunsound-mir-opts // ignore-test // FIXME: the pass is unsound and causes ICEs in the MIR validator diff --git a/tests/mir-opt/slice_drop_shim.rs b/tests/mir-opt/slice_drop_shim.rs index 344c1af2c9134..cac0a349128c3 100644 --- a/tests/mir-opt/slice_drop_shim.rs +++ b/tests/mir-opt/slice_drop_shim.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Zmir-opt-level=0 diff --git a/tests/mir-opt/spanview_block.main.built.after.html b/tests/mir-opt/spanview_block.main.built.after.html index 56f4e4f93706e..54ef00f56f3b8 100644 --- a/tests/mir-opt/spanview_block.main.built.after.html +++ b/tests/mir-opt/spanview_block.main.built.after.html @@ -60,8 +60,8 @@ -
fn main() 0⦊{}⦉0
+
fn main() 0⦊{}⦉0
diff --git a/tests/mir-opt/spanview_block.rs b/tests/mir-opt/spanview_block.rs index 0ecf35ad6a2e8..e8bc3d16348a2 100644 --- a/tests/mir-opt/spanview_block.rs +++ b/tests/mir-opt/spanview_block.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test spanview block output // compile-flags: -Z dump-mir-spanview=block diff --git a/tests/mir-opt/spanview_statement.main.built.after.html b/tests/mir-opt/spanview_statement.main.built.after.html index 91af08d80a811..5e782b05f3b79 100644 --- a/tests/mir-opt/spanview_statement.main.built.after.html +++ b/tests/mir-opt/spanview_statement.main.built.after.html @@ -60,8 +60,8 @@ -
fn main() 0[0]⦊{}⦉0[0]0:Return⦊‸⦉0:Return
+
fn main() 0[0]⦊{}⦉0[0]0:Return⦊‸⦉0:Return
diff --git a/tests/mir-opt/spanview_statement.rs b/tests/mir-opt/spanview_statement.rs index 457052617b788..d547e6cb1e0b0 100644 --- a/tests/mir-opt/spanview_statement.rs +++ b/tests/mir-opt/spanview_statement.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test spanview output (the default value for `-Z dump-mir-spanview` is "statement") // compile-flags: -Z dump-mir-spanview diff --git a/tests/mir-opt/spanview_terminator.main.built.after.html b/tests/mir-opt/spanview_terminator.main.built.after.html index 1f42faedd1e6d..2a651489e235f 100644 --- a/tests/mir-opt/spanview_terminator.main.built.after.html +++ b/tests/mir-opt/spanview_terminator.main.built.after.html @@ -60,7 +60,7 @@ -
fn main() {}0:Return⦊‸⦉0:Return
+
fn main() {}0:Return⦊‸⦉0:Return
diff --git a/tests/mir-opt/spanview_terminator.rs b/tests/mir-opt/spanview_terminator.rs index 76fced188f1db..a2c68b98ef55b 100644 --- a/tests/mir-opt/spanview_terminator.rs +++ b/tests/mir-opt/spanview_terminator.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test spanview terminator output // compile-flags: -Z dump-mir-spanview=terminator diff --git a/tests/mir-opt/sroa/lifetimes.rs b/tests/mir-opt/sroa/lifetimes.rs index 2356d212f3fb4..cc5c0c9bbcdb5 100644 --- a/tests/mir-opt/sroa/lifetimes.rs +++ b/tests/mir-opt/sroa/lifetimes.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ScalarReplacementOfAggregates // compile-flags: -Cpanic=abort // no-prefer-dynamic diff --git a/tests/mir-opt/sroa/structs.rs b/tests/mir-opt/sroa/structs.rs index 7946eeaeae4e9..73563e12c94fc 100644 --- a/tests/mir-opt/sroa/structs.rs +++ b/tests/mir-opt/sroa/structs.rs @@ -1,3 +1,4 @@ +// skip-filecheck // unit-test: ScalarReplacementOfAggregates // compile-flags: -Cpanic=abort // no-prefer-dynamic diff --git a/tests/mir-opt/ssa_unreachable_116212.rs b/tests/mir-opt/ssa_unreachable_116212.rs index f588665876c87..9f1cf223e2635 100644 --- a/tests/mir-opt/ssa_unreachable_116212.rs +++ b/tests/mir-opt/ssa_unreachable_116212.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Regression test for issue #116212. #![feature(never_type)] diff --git a/tests/mir-opt/storage_ranges.main.nll.0.mir b/tests/mir-opt/storage_ranges.main.nll.0.mir index 13732daa7ad7e..782efd5acc625 100644 --- a/tests/mir-opt/storage_ranges.main.nll.0.mir +++ b/tests/mir-opt/storage_ranges.main.nll.0.mir @@ -15,7 +15,7 @@ | '?1 live at {bb0[0..=22]} | '?2 live at {bb0[10]} | '?3 live at {bb0[11]} -| '?2: '?3 due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:6:17: 6:25 (#0) +| '?2: '?3 due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:7:17: 7:25 (#0) | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/storage_ranges.rs b/tests/mir-opt/storage_ranges.rs index 996051a294111..5a68d56846540 100644 --- a/tests/mir-opt/storage_ranges.rs +++ b/tests/mir-opt/storage_ranges.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR storage_ranges.main.nll.0.mir fn main() { diff --git a/tests/mir-opt/switch_to_self.rs b/tests/mir-opt/switch_to_self.rs index 6678e4b3bd2e3..fc270fd33cf84 100644 --- a/tests/mir-opt/switch_to_self.rs +++ b/tests/mir-opt/switch_to_self.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test that MatchBranchSimplification doesn't ICE on a SwitchInt where // one of the targets is the block that the SwitchInt terminates. #![crate_type = "lib"] diff --git a/tests/mir-opt/tls_access.rs b/tests/mir-opt/tls_access.rs index 19344c8686212..450dd9b473029 100644 --- a/tests/mir-opt/tls_access.rs +++ b/tests/mir-opt/tls_access.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR tls_access.main.PreCodegen.after.mir // compile-flags: -Zmir-opt-level=0 diff --git a/tests/mir-opt/uninhabited_enum.rs b/tests/mir-opt/uninhabited_enum.rs index 19db548157a66..8816f31f9dfa1 100644 --- a/tests/mir-opt/uninhabited_enum.rs +++ b/tests/mir-opt/uninhabited_enum.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(never_type)] pub enum Void {} diff --git a/tests/mir-opt/uninhabited_enum_branching.rs b/tests/mir-opt/uninhabited_enum_branching.rs index 0ef604c308836..96ae84eca5093 100644 --- a/tests/mir-opt/uninhabited_enum_branching.rs +++ b/tests/mir-opt/uninhabited_enum_branching.rs @@ -1,3 +1,4 @@ +// skip-filecheck enum Empty { } // test matching an enum with uninhabited variants diff --git a/tests/mir-opt/uninhabited_enum_branching2.rs b/tests/mir-opt/uninhabited_enum_branching2.rs index e22e94314d986..751f2ae01f8ba 100644 --- a/tests/mir-opt/uninhabited_enum_branching2.rs +++ b/tests/mir-opt/uninhabited_enum_branching2.rs @@ -1,3 +1,4 @@ +// skip-filecheck enum Empty { } // test matching an enum with uninhabited variants diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.rs b/tests/mir-opt/uninhabited_fallthrough_elimination.rs index 0853883f8b841..7dd41aea5ed11 100644 --- a/tests/mir-opt/uninhabited_fallthrough_elimination.rs +++ b/tests/mir-opt/uninhabited_fallthrough_elimination.rs @@ -1,3 +1,4 @@ +// skip-filecheck enum Empty {} enum S { diff --git a/tests/mir-opt/unreachable.rs b/tests/mir-opt/unreachable.rs index 23fad4737fe9a..5c0df09b752ea 100644 --- a/tests/mir-opt/unreachable.rs +++ b/tests/mir-opt/unreachable.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY enum Empty {} diff --git a/tests/mir-opt/unreachable_diverging.rs b/tests/mir-opt/unreachable_diverging.rs index b7d308b863060..3713bcaea1694 100644 --- a/tests/mir-opt/unreachable_diverging.rs +++ b/tests/mir-opt/unreachable_diverging.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY pub enum Empty {} diff --git a/tests/mir-opt/unusual_item_types.rs b/tests/mir-opt/unusual_item_types.rs index 6dad636416f22..49b663b4f8298 100644 --- a/tests/mir-opt/unusual_item_types.rs +++ b/tests/mir-opt/unusual_item_types.rs @@ -1,3 +1,4 @@ +// skip-filecheck // 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 diff --git a/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir b/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir index e2edbfcd4fa31..a5121ae550d6d 100644 --- a/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir +++ b/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `::ASSOCIATED_CONSTANT` after built +// MIR for `::ASSOCIATED_CONSTANT` after built -const ::ASSOCIATED_CONSTANT: i32 = { +const ::ASSOCIATED_CONSTANT: i32 = { let mut _0: i32; bb0: { diff --git a/tests/mir-opt/while_storage.rs b/tests/mir-opt/while_storage.rs index d4fb54da5758b..3a3d451ee8d71 100644 --- a/tests/mir-opt/while_storage.rs +++ b/tests/mir-opt/while_storage.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Test that we correctly generate StorageDead statements for while loop // conditions on all branches From 8daf14f0461bd3116c43a550eb19f009640d3dc2 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 17:38:37 +0000 Subject: [PATCH 02/21] Run filecheck on reference_prop.rs --- tests/mir-opt/reference_prop.rs | 334 ++++++++++++++++++++++++++++++-- 1 file changed, 318 insertions(+), 16 deletions(-) diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index bae053e0b3479..36134e019ad06 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -1,4 +1,3 @@ -// skip-filecheck // unit-test: ReferencePropagation // needs-unwind @@ -9,16 +8,31 @@ fn opaque(_: impl Sized) {} fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { + // CHECK-LABEL: fn reference_propagation( + // Propagation through a reference. { + // CHECK: bb0: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &[[a]]; + // CHECK: [[c:_.*]] = [[a]]; + let a = 5_usize; let b = &a; // This borrow is only used once. let c = *b; // This should be optimized. opaque(()); // We use opaque to separate cases into basic blocks in the MIR. } - // Propagation through a two references. + // Propagation through two references. { + // CHECK: bb1: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[a2:_.*]] = const 7_usize; + // CHECK: [[b:_.*]] = &[[a]]; + // CHECK: [[btmp:_.*]] = &[[a2]]; + // CHECK: [[b]] = move [[btmp]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let a2 = 7_usize; let mut b = &a; @@ -30,6 +44,12 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // Propagation through a borrowed reference. { + // CHECK: bb2: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &[[a]]; + // CHECK: [[d:_.*]] = &[[b]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let b = &a; let d = &b; @@ -37,8 +57,14 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { opaque(d); // prevent `d` from being removed. } - // Propagation through a borrowed reference. + // Propagation through a mutably borrowed reference. { + // CHECK: bb3: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &[[a]]; + // CHECK: [[d:_.*]] = &raw mut [[b]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let mut b = &a; let d = &raw mut b; @@ -48,6 +74,11 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // Propagation through an escaping borrow. { + // CHECK: bb4: { + // CHECK: [[a:_.*]] = const 7_usize; + // CHECK: [[b:_.*]] = &[[a]]; + // CHECK: [[c:_.*]] = [[a]]; + let a = 7_usize; let b = &a; let c = *b; @@ -56,6 +87,14 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // Propagation through a transitively escaping borrow. { + // CHECK: bb5: { + // CHECK: [[a:_.*]] = const 7_usize; + // CHECK: [[b1:_.*]] = &[[a]]; + // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[b2:_.*]] = [[b1]]; + // CHECK: [[c2:_.*]] = [[a]]; + // CHECK: [[b3:_.*]] = [[b2]]; + let a = 7_usize; let b1 = &a; let c = *b1; @@ -69,6 +108,10 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // Propagation a reborrow of an argument. { + // CHECK: bb6: { + // CHECK-NOT: {{_.*}} = &(*_1); + // CHECK: [[b:_.*]] = (*_1); + let a = &*single; let b = *a; // This should be optimized as `*single`. opaque(()); @@ -76,6 +119,12 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // Propagation a reborrow of a mutated argument. { + // CHECK: bb7: { + // CHECK: [[a:_.*]] = &(*_2); + // CHECK: [[tmp:_.*]] = &(*_1); + // CHECK: _2 = move [[tmp]]; + // CHECK: [[b:_.*]] = (*[[a]]); + let a = &*multiple; multiple = &*single; let b = *a; // This should not be optimized. @@ -84,6 +133,13 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // Fixed-point propagation through a borrowed reference. { + // CHECK: bb8: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &[[a]]; + // CHECK: [[d:_.*]] = &[[b]]; + // FIXME this could be [[a]] + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let b = &a; let d = &b; // first round promotes debuginfo for `d` @@ -91,8 +147,15 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { opaque(()); } - // Fixed-point propagation through a borrowed reference. + // Fixed-point propagation through a mutably borrowed reference. { + // CHECK: bb9: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &[[a]]; + // CHECK: [[d:_.*]] = &mut [[b]]; + // FIXME this could be [[a]] + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let mut b = &a; let d = &mut b; // first round promotes debuginfo for `d` @@ -102,16 +165,31 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { } fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a mut T) { + // CHECK-LABEL: fn reference_propagation_mut( + // Propagation through a reference. { + // CHECK: bb0: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &mut [[a]]; + // CHECK: [[c:_.*]] = [[a]]; + let mut a = 5_usize; let b = &mut a; // This borrow is only used once. let c = *b; // This should be optimized. opaque(()); } - // Propagation through a two references. + // Propagation through two references. { + // CHECK: bb1: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[a2:_.*]] = const 7_usize; + // CHECK: [[b:_.*]] = &mut [[a]]; + // CHECK: [[btmp:_.*]] = &mut [[a2]]; + // CHECK: [[b]] = move [[btmp]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let mut a2 = 7_usize; let mut b = &mut a; @@ -123,6 +201,12 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // Propagation through a borrowed reference. { + // CHECK: bb2: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &mut [[a]]; + // CHECK: [[d:_.*]] = &[[b]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let b = &mut a; let d = &b; @@ -130,8 +214,14 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m opaque(d); // prevent `d` from being removed. } - // Propagation through a borrowed reference. + // Propagation through a mutably borrowed reference. { + // CHECK: bb3: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &mut [[a]]; + // CHECK: [[d:_.*]] = &raw mut [[b]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let mut b = &mut a; let d = &raw mut b; @@ -141,6 +231,11 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // Propagation through an escaping borrow. { + // CHECK: bb4: { + // CHECK: [[a:_.*]] = const 7_usize; + // CHECK: [[b:_.*]] = &mut [[a]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 7_usize; let b = &mut a; let c = *b; @@ -149,6 +244,14 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // Propagation through a transitively escaping borrow. { + // CHECK: bb5: { + // CHECK: [[a:_.*]] = const 7_usize; + // CHECK: [[b1:_.*]] = &mut [[a]]; + // CHECK: [[c:_.*]] = (*[[b1]]); + // CHECK: [[b2:_.*]] = move [[b1]]; + // CHECK: [[c2:_.*]] = (*[[b2]]); + // CHECK: [[b3:_.*]] = move [[b2]]; + let mut a = 7_usize; let b1 = &mut a; let c = *b1; @@ -162,6 +265,10 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // Propagation a reborrow of an argument. { + // CHECK: bb6: { + // CHECK-NOT: {{_.*}} = &(*_1); + // CHECK: [[b:_.*]] = (*_1); + let a = &mut *single; let b = *a; // This should be optimized as `*single`. opaque(()); @@ -169,6 +276,12 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // Propagation a reborrow of a mutated argument. { + // CHECK: bb7: { + // CHECK: [[a:_.*]] = &mut (*_2); + // CHECK: [[tmp:_.*]] = &mut (*_1); + // CHECK: _2 = move [[tmp]]; + // CHECK: [[b:_.*]] = (*[[a]]); + let a = &mut *multiple; multiple = &mut *single; let b = *a; // This should not be optimized. @@ -177,6 +290,13 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // Fixed-point propagation through a borrowed reference. { + // CHECK: bb8: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &mut [[a]]; + // CHECK: [[d:_.*]] = &[[b]]; + // FIXME this could be [[a]] + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let b = &mut a; let d = &b; // first round promotes debuginfo for `d` @@ -184,8 +304,15 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m opaque(()); } - // Fixed-point propagation through a borrowed reference. + // Fixed-point propagation through a mutably borrowed reference. { + // CHECK: bb9: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &mut [[a]]; + // CHECK: [[d:_.*]] = &mut [[b]]; + // FIXME this could be [[a]] + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let mut b = &mut a; let d = &mut b; // first round promotes debuginfo for `d` @@ -195,16 +322,31 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m } fn reference_propagation_const_ptr(single: *const T, mut multiple: *const T) { + // CHECK-LABEL: fn reference_propagation_const_ptr( + // Propagation through a reference. unsafe { + // CHECK: bb0: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK: [[c:_.*]] = [[a]]; + let a = 5_usize; let b = &raw const a; // This borrow is only used once. let c = *b; // This should be optimized. opaque(()); } - // Propagation through a two references. + // Propagation through two references. unsafe { + // CHECK: bb1: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[a2:_.*]] = const 7_usize; + // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK: [[btmp:_.*]] = &raw const [[a2]]; + // CHECK: [[b]] = move [[btmp]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let a2 = 7_usize; let mut b = &raw const a; @@ -216,6 +358,12 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // Propagation through a borrowed reference. unsafe { + // CHECK: bb2: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK: [[d:_.*]] = &[[b]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let b = &raw const a; let d = &b; @@ -223,8 +371,14 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con opaque(d); // prevent `d` from being removed. } - // Propagation through a borrowed reference. + // Propagation through a mutably borrowed reference. unsafe { + // CHECK: bb3: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK: [[d:_.*]] = &raw mut [[b]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let mut b = &raw const a; let d = &raw mut b; @@ -234,6 +388,11 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // Propagation through an escaping borrow. unsafe { + // CHECK: bb4: { + // CHECK: [[a:_.*]] = const 7_usize; + // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK: [[c:_.*]] = [[a]]; + let a = 7_usize; let b = &raw const a; let c = *b; @@ -242,6 +401,14 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // Propagation through a transitively escaping borrow. unsafe { + // CHECK: bb5: { + // CHECK: [[a:_.*]] = const 7_usize; + // CHECK: [[b1:_.*]] = &raw const [[a]]; + // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[b2:_.*]] = [[b1]]; + // CHECK: [[c2:_.*]] = [[a]]; + // CHECK: [[b3:_.*]] = [[b2]]; + let a = 7_usize; let b1 = &raw const a; let c = *b1; @@ -255,6 +422,10 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // Propagation a reborrow of an argument. unsafe { + // CHECK: bb6: { + // CHECK-NOT: {{_.*}} = &(*_1); + // CHECK: [[b:_.*]] = (*_1); + let a = &raw const *single; let b = *a; // This should be optimized as `*single`. opaque(()); @@ -262,6 +433,12 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // Propagation a reborrow of a mutated argument. unsafe { + // CHECK: bb7: { + // CHECK: [[a:_.*]] = &raw const (*_2); + // CHECK: [[tmp:_.*]] = &raw const (*_1); + // CHECK: _2 = move [[tmp]]; + // CHECK: [[b:_.*]] = (*[[a]]); + let a = &raw const *multiple; multiple = &raw const *single; let b = *a; // This should not be optimized. @@ -270,6 +447,12 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // Propagation through a reborrow. unsafe { + // CHECK: bb8: { + // CHECK: [[a:_.*]] = const 13_usize; + // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK: [[d:_.*]] = &raw const [[a]]; + // CHECK: [[c:_.*]] = [[a]]; + let a = 13_usize; let b = &raw const a; let c = &raw const *b; @@ -279,6 +462,13 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // Fixed-point propagation through a borrowed reference. unsafe { + // CHECK: bb9: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK: [[d:_.*]] = &[[b]]; + // FIXME this could be [[a]] + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let b = &raw const a; let d = &b; // first round promotes debuginfo for `d` @@ -288,6 +478,13 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // Fixed-point propagation through a borrowed reference. unsafe { + // CHECK: bb10: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw const [[a]]; + // CHECK: [[d:_.*]] = &mut [[b]]; + // FIXME this could be [[a]] + // CHECK: [[c:_.*]] = (*[[b]]); + let a = 5_usize; let mut b = &raw const a; let d = &mut b; // first round promotes debuginfo for `d` @@ -297,16 +494,31 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con } fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) { + // CHECK-LABEL: fn reference_propagation_mut_ptr( + // Propagation through a reference. unsafe { + // CHECK: bb0: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw mut [[a]]; + // CHECK: [[c:_.*]] = [[a]]; + let mut a = 5_usize; let b = &raw mut a; // This borrow is only used once. let c = *b; // This should be optimized. opaque(()); } - // Propagation through a two references. + // Propagation through two references. unsafe { + // CHECK: bb1: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[a2:_.*]] = const 7_usize; + // CHECK: [[b:_.*]] = &raw mut [[a]]; + // CHECK: [[btmp:_.*]] = &raw mut [[a2]]; + // CHECK: [[b]] = move [[btmp]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let mut a2 = 7_usize; let mut b = &raw mut a; @@ -318,6 +530,12 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // Propagation through a borrowed reference. unsafe { + // CHECK: bb2: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw mut [[a]]; + // CHECK: [[d:_.*]] = &[[b]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let b = &raw mut a; let d = &b; @@ -325,8 +543,14 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) opaque(d); // prevent `d` from being removed. } - // Propagation through a borrowed reference. + // Propagation through a mutably borrowed reference. unsafe { + // CHECK: bb3: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw mut [[a]]; + // CHECK: [[d:_.*]] = &raw mut [[b]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let mut b = &raw mut a; let d = &raw mut b; @@ -336,6 +560,11 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // Propagation through an escaping borrow. unsafe { + // CHECK: bb4: { + // CHECK: [[a:_.*]] = const 7_usize; + // CHECK: [[b:_.*]] = &raw mut [[a]]; + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 7_usize; let b = &raw mut a; let c = *b; @@ -344,6 +573,14 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // Propagation through a transitively escaping borrow. unsafe { + // CHECK: bb5: { + // CHECK: [[a:_.*]] = const 7_usize; + // CHECK: [[b1:_.*]] = &raw mut [[a]]; + // CHECK: [[c:_.*]] = (*[[b1]]); + // CHECK: [[b2:_.*]] = [[b1]]; + // CHECK: [[c2:_.*]] = (*[[b2]]); + // CHECK: [[b3:_.*]] = [[b2]]; + let mut a = 7_usize; let b1 = &raw mut a; let c = *b1; @@ -357,6 +594,10 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // Propagation a reborrow of an argument. unsafe { + // CHECK: bb6: { + // CHECK-NOT: {{_.*}} = &(*_1); + // CHECK: [[b:_.*]] = (*_1); + let a = &raw mut *single; let b = *a; // This should be optimized as `*single`. opaque(()); @@ -364,6 +605,12 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // Propagation a reborrow of a mutated argument. unsafe { + // CHECK: bb7: { + // CHECK: [[a:_.*]] = &raw mut (*_2); + // CHECK: [[tmp:_.*]] = &raw mut (*_1); + // CHECK: _2 = move [[tmp]]; + // CHECK: [[b:_.*]] = (*[[a]]); + let a = &raw mut *multiple; multiple = &raw mut *single; let b = *a; // This should not be optimized. @@ -372,6 +619,13 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // Fixed-point propagation through a borrowed reference. unsafe { + // CHECK: bb8: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw mut [[a]]; + // CHECK: [[d:_.*]] = &[[b]]; + // FIXME this could be [[a]] + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let b = &raw mut a; let d = &b; // first round promotes debuginfo for `d` @@ -379,8 +633,15 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) opaque(()); } - // Fixed-point propagation through a borrowed reference. + // Fixed-point propagation through a mutably borrowed reference. unsafe { + // CHECK: bb9: { + // CHECK: [[a:_.*]] = const 5_usize; + // CHECK: [[b:_.*]] = &raw mut [[a]]; + // CHECK: [[d:_.*]] = &mut [[b]]; + // FIXME this could be [[a]] + // CHECK: [[c:_.*]] = (*[[b]]); + let mut a = 5_usize; let mut b = &raw mut a; let d = &mut b; // first round promotes debuginfo for `d` @@ -391,8 +652,13 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn read_through_raw(x: &mut usize) -> usize { - use std::intrinsics::mir::*; + // CHECK-LABEL: read_through_raw + // CHECK: bb0: { + // CHECK-NEXT: _0 = (*_1); + // CHECK-NEXT: _0 = (*_1); + // CHECK-NEXT: return; + use std::intrinsics::mir::*; mir!( let r1: &mut usize; let r2: &mut usize; @@ -414,8 +680,10 @@ fn read_through_raw(x: &mut usize) -> usize { #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn multiple_storage() { - use std::intrinsics::mir::*; + // CHECK-LABEL: multiple_storage + // CHECK: _3 = (*_2); + use std::intrinsics::mir::*; mir!( let x: i32; { @@ -438,8 +706,10 @@ fn multiple_storage() { #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn dominate_storage() { - use std::intrinsics::mir::*; + // CHECK-LABEL: dominate_storage + // CHECK: _5 = (*_2); + use std::intrinsics::mir::*; mir!( let x: i32; let r: &i32; @@ -466,8 +736,10 @@ fn dominate_storage() { #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn maybe_dead(m: bool) { - use std::intrinsics::mir::*; + // CHECK-LABEL: fn maybe_dead( + // CHECK: (*_5) = const 7_i32; + use std::intrinsics::mir::*; mir!( let x: i32; let y: i32; @@ -507,6 +779,9 @@ fn maybe_dead(m: bool) { } fn mut_raw_then_mut_shr() -> (i32, i32) { + // CHECK-LABEL: fn mut_raw_then_mut_shr( + // CHECK-NOT: (*{{_.*}}) + let mut x = 2; let xref = &mut x; let xraw = &mut *xref as *mut _; @@ -518,6 +793,18 @@ fn mut_raw_then_mut_shr() -> (i32, i32) { } fn unique_with_copies() { + // CHECK-LABEL: fn unique_with_copies( + // CHECK: [[a:_.*]] = const 0_i32; + // CHECK: [[x:_.*]] = &raw mut [[a]]; + // CHECK-NOT: [[a]] + // CHECK: [[tmp:_.*]] = (*[[x]]); + // CHECK-NEXT: opaque::(move [[tmp]]) + // CHECK-NOT: [[a]] + // CHECK: StorageDead([[a]]); + // CHECK-NOT: [[a]] + // CHECK: [[tmp:_.*]] = (*[[x]]); + // CHECK-NEXT: opaque::(move [[tmp]]) + let y = { let mut a = 0; let x = &raw mut a; @@ -530,6 +817,17 @@ fn unique_with_copies() { } fn debuginfo() { + // CHECK-LABEL: fn debuginfo( + // FIXME: This features waits for DWARF implicit pointers in LLVM. + // CHECK: debug ref_mut_u8 => _{{.*}}; + // CHECK: debug field => _{{.*}}; + // CHECK: debug reborrow => _{{.*}}; + // CHECK: debug variant_field => _{{.*}}; + // CHECK: debug constant_index => _{{.*}}; + // CHECK: debug subslice => _{{.*}}; + // CHECK: debug constant_index_from_end => _{{.*}}; + // CHECK: debug multiple_borrow => _{{.*}}; + struct T(u8); let ref_mut_u8 = &mut 5_u8; @@ -552,6 +850,10 @@ fn debuginfo() { } fn many_debuginfo() { + // CHECK-LABEL: fn many_debuginfo( + // FIXME: This features waits for DWARF implicit pointers in LLVM. + // CHECK: debug many_borrow => _{{.*}}; + let a = 0; // Verify that we do not ICE on deeply nested borrows. From 47fa01d2b86ab4a60d944a5d9501cfbed9cd5e80 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 18:01:42 +0000 Subject: [PATCH 03/21] FileCheck array_index_is_temporary.rs --- tests/mir-opt/array_index_is_temporary.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/mir-opt/array_index_is_temporary.rs b/tests/mir-opt/array_index_is_temporary.rs index 08db63a82bbf7..f5edc68905b64 100644 --- a/tests/mir-opt/array_index_is_temporary.rs +++ b/tests/mir-opt/array_index_is_temporary.rs @@ -1,4 +1,4 @@ -// skip-filecheck +// unit-test: SimplifyCfg-elaborate-drops // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Retagging (from Stacked Borrows) relies on the array index being a fresh // temporary, so that side-effects cannot change it. @@ -12,6 +12,12 @@ unsafe fn foo(z: *mut usize) -> u32 { // EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir fn main() { + // CHECK-LABEL: fn main( + // CHECK: debug x => [[x:_.*]]; + // CHECK: debug y => [[y:_.*]]; + // CHECK: [[y]] = const 1_usize; + // CHECK: [[tmp:_.*]] = [[y]]; + // CHECK: [[x]][[[tmp]]] = let mut x = [42, 43, 44]; let mut y = 1; let z: *mut usize = &mut y; From 00a7958e7945c4ed4070b999435909da94233942 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 18:02:18 +0000 Subject: [PATCH 04/21] FileCheck asm_unwind_panic_abort.rs --- tests/mir-opt/asm_unwind_panic_abort.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/mir-opt/asm_unwind_panic_abort.rs b/tests/mir-opt/asm_unwind_panic_abort.rs index 873a8b28f5e0e..a80dcb385b33e 100644 --- a/tests/mir-opt/asm_unwind_panic_abort.rs +++ b/tests/mir-opt/asm_unwind_panic_abort.rs @@ -1,4 +1,3 @@ -// skip-filecheck //! Tests that unwinding from an asm block is caught and forced to abort //! when `-C panic=abort`. @@ -10,6 +9,9 @@ // EMIT_MIR asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir fn main() { + // CHECK-LABEL: fn main( + // CHECK: asm!( + // CHECK-SAME: unwind terminate(abi) unsafe { std::arch::asm!("", options(may_unwind)); } From f65eb1f7522bc41d86bf3361111c27f8979063c5 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 18:03:02 +0000 Subject: [PATCH 05/21] FileCheck basic_assignment.rs. --- ...ignment.main.SimplifyCfg-initial.after.mir | 4 ++-- tests/mir-opt/basic_assignment.rs | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir index 99b51a4e92f82..5df6633880eb0 100644 --- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after SimplifyCfg-initial | User Type Annotations -| 0: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:21:17: 21:33, inferred_ty: std::option::Option> -| 1: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:21:17: 21:33, inferred_ty: std::option::Option> +| 0: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:38:17: 38:33, inferred_ty: std::option::Option> +| 1: user_ty: Canonical { value: Ty(std::option::Option>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:38:17: 38:33, inferred_ty: std::option::Option> | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/basic_assignment.rs b/tests/mir-opt/basic_assignment.rs index 87e01932cb155..30a4109888854 100644 --- a/tests/mir-opt/basic_assignment.rs +++ b/tests/mir-opt/basic_assignment.rs @@ -1,4 +1,4 @@ -// skip-filecheck +// unit-test: ElaborateDrops // needs-unwind // this tests move up progration, which is not yet implemented @@ -11,6 +11,23 @@ // destruction. fn main() { + // CHECK-LABEL: fn main( + // CHECK: debug nodrop_x => [[nodrop_x:_.*]]; + // CHECK: debug nodrop_y => [[nodrop_y:_.*]]; + // CHECK: debug drop_x => [[drop_x:_.*]]; + // CHECK: debug drop_y => [[drop_y:_.*]]; + // CHECK-NOT: drop([[nodrop_x]]) + // CHECK-NOT: drop([[nodrop_y]]) + // CHECK-NOT: drop([[drop_x]]) + // CHECK: [[drop_tmp:_.*]] = move [[drop_x]]; + // CHECK-NOT: drop([[drop_x]]) + // CHECK-NOT: drop([[drop_tmp]]) + // CHECK: [[drop_y]] = move [[drop_tmp]]; + // CHECK-NOT: drop([[drop_x]]) + // CHECK-NOT: drop([[drop_tmp]]) + // CHECK: drop([[drop_y]]) + // CHECK-NOT: drop([[drop_x]]) + // CHECK-NOT: drop([[drop_tmp]]) let nodrop_x = false; let nodrop_y; From 38bf66077173e7d1e030d0f808be96d2b16e8e70 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 18:04:10 +0000 Subject: [PATCH 06/21] FileCheck box_expr.rs This check is made `needs-unwind`, as the panic=abort case is a strictly simpler version. --- ...main.ElaborateDrops.before.panic-abort.mir | 71 --------------- ...ain.ElaborateDrops.before.panic-unwind.mir | 71 --------------- .../mir-opt/box_expr.main.ElaborateDrops.diff | 89 +++++++++++++++++++ tests/mir-opt/box_expr.rs | 18 +++- 4 files changed, 104 insertions(+), 145 deletions(-) delete mode 100644 tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir delete mode 100644 tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir create mode 100644 tests/mir-opt/box_expr.main.ElaborateDrops.diff diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir deleted file mode 100644 index 1c7ef7f83456c..0000000000000 --- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir +++ /dev/null @@ -1,71 +0,0 @@ -// MIR for `main` before ElaborateDrops - -fn main() -> () { - let mut _0: (); - let _1: std::boxed::Box; - let mut _2: usize; - let mut _3: usize; - let mut _4: *mut u8; - let mut _5: std::boxed::Box; - let _6: (); - let mut _7: std::boxed::Box; - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); - _2 = SizeOf(S); - _3 = AlignOf(S); - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind: bb9]; - } - - bb1: { - StorageLive(_5); - _5 = ShallowInitBox(move _4, S); - (*_5) = S::new() -> [return: bb2, unwind: bb8]; - } - - bb2: { - _1 = move _5; - drop(_5) -> [return: bb3, unwind: bb9]; - } - - bb3: { - StorageDead(_5); - StorageLive(_6); - StorageLive(_7); - _7 = move _1; - _6 = std::mem::drop::>(move _7) -> [return: bb4, unwind: bb6]; - } - - bb4: { - StorageDead(_7); - StorageDead(_6); - _0 = const (); - drop(_1) -> [return: bb5, unwind: bb9]; - } - - bb5: { - StorageDead(_1); - return; - } - - bb6 (cleanup): { - drop(_7) -> [return: bb7, unwind terminate(cleanup)]; - } - - bb7 (cleanup): { - drop(_1) -> [return: bb9, unwind terminate(cleanup)]; - } - - bb8 (cleanup): { - drop(_5) -> [return: bb9, unwind terminate(cleanup)]; - } - - bb9 (cleanup): { - resume; - } -} diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir deleted file mode 100644 index 4ad1c2de12987..0000000000000 --- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir +++ /dev/null @@ -1,71 +0,0 @@ -// MIR for `main` before ElaborateDrops - -fn main() -> () { - let mut _0: (); - let _1: std::boxed::Box; - let mut _2: usize; - let mut _3: usize; - let mut _4: *mut u8; - let mut _5: std::boxed::Box; - let _6: (); - let mut _7: std::boxed::Box; - scope 1 { - debug x => _1; - } - scope 2 { - } - - bb0: { - StorageLive(_1); - _2 = SizeOf(S); - _3 = AlignOf(S); - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue]; - } - - bb1: { - StorageLive(_5); - _5 = ShallowInitBox(move _4, S); - (*_5) = S::new() -> [return: bb2, unwind: bb8]; - } - - bb2: { - _1 = move _5; - drop(_5) -> [return: bb3, unwind continue]; - } - - bb3: { - StorageDead(_5); - StorageLive(_6); - StorageLive(_7); - _7 = move _1; - _6 = std::mem::drop::>(move _7) -> [return: bb4, unwind: bb6]; - } - - bb4: { - StorageDead(_7); - StorageDead(_6); - _0 = const (); - drop(_1) -> [return: bb5, unwind continue]; - } - - bb5: { - StorageDead(_1); - return; - } - - bb6 (cleanup): { - drop(_7) -> [return: bb7, unwind terminate(cleanup)]; - } - - bb7 (cleanup): { - drop(_1) -> [return: bb9, unwind terminate(cleanup)]; - } - - bb8 (cleanup): { - drop(_5) -> [return: bb9, unwind terminate(cleanup)]; - } - - bb9 (cleanup): { - resume; - } -} diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.diff b/tests/mir-opt/box_expr.main.ElaborateDrops.diff new file mode 100644 index 0000000000000..88b12f19e64df --- /dev/null +++ b/tests/mir-opt/box_expr.main.ElaborateDrops.diff @@ -0,0 +1,89 @@ +- // MIR for `main` before ElaborateDrops ++ // MIR for `main` after ElaborateDrops + + fn main() -> () { + let mut _0: (); + let _1: std::boxed::Box; + let mut _2: usize; + let mut _3: usize; + let mut _4: *mut u8; + let mut _5: std::boxed::Box; + let _6: (); + let mut _7: std::boxed::Box; ++ let mut _8: &mut std::boxed::Box; ++ let mut _9: (); + scope 1 { + debug x => _1; + } + scope 2 { + } + + bb0: { + StorageLive(_1); + _2 = SizeOf(S); + _3 = AlignOf(S); + _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue]; + } + + bb1: { + StorageLive(_5); + _5 = ShallowInitBox(move _4, S); + (*_5) = S::new() -> [return: bb2, unwind: bb8]; + } + + bb2: { + _1 = move _5; +- drop(_5) -> [return: bb3, unwind continue]; ++ goto -> bb3; + } + + bb3: { + StorageDead(_5); + StorageLive(_6); + StorageLive(_7); + _7 = move _1; + _6 = std::mem::drop::>(move _7) -> [return: bb4, unwind: bb6]; + } + + bb4: { + StorageDead(_7); + StorageDead(_6); + _0 = const (); +- drop(_1) -> [return: bb5, unwind continue]; ++ goto -> bb5; + } + + bb5: { + StorageDead(_1); + return; + } + + bb6 (cleanup): { +- drop(_7) -> [return: bb7, unwind terminate(cleanup)]; ++ goto -> bb7; + } + + bb7 (cleanup): { +- drop(_1) -> [return: bb9, unwind terminate(cleanup)]; ++ goto -> bb9; + } + + bb8 (cleanup): { +- drop(_5) -> [return: bb9, unwind terminate(cleanup)]; ++ goto -> bb11; + } + + bb9 (cleanup): { + resume; ++ } ++ ++ bb10 (cleanup): { ++ _8 = &mut _5; ++ _9 = as Drop>::drop(move _8) -> [return: bb9, unwind terminate(cleanup)]; ++ } ++ ++ bb11 (cleanup): { ++ goto -> bb10; + } + } + diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs index 30969a1704d00..0421e232ae4a5 100644 --- a/tests/mir-opt/box_expr.rs +++ b/tests/mir-opt/box_expr.rs @@ -1,10 +1,22 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// unit-test: ElaborateDrops +// needs-unwind #![feature(rustc_attrs, stmt_expr_attributes)] -// EMIT_MIR box_expr.main.ElaborateDrops.before.mir +// EMIT_MIR box_expr.main.ElaborateDrops.diff fn main() { + // CHECK-LABEL: fn main( + // CHECK: [[box:_.*]] = ShallowInitBox( + // CHECK: [[ptr:_.*]] = ((([[box]].0: std::ptr::Unique).0: std::ptr::NonNull).0: *const S); + // CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]]; + // CHECK: [[ret]]: { + // CHECK: [[box2:_.*]] = move [[box]]; + // CHECK: [[box3:_.*]] = move [[box2]]; + // CHECK: std::mem::drop::>(move [[box3]]) + // CHECK: [[unwind]] (cleanup): { + // CHECK: [[boxref:_.*]] = &mut [[box]]; + // CHECK: as Drop>::drop(move [[boxref]]) + let x = #[rustc_box] Box::new(S::new()); drop(x); From d6f4bd5a8d321bd29ebe711fa9fa3d1dfa298e26 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 19:14:24 +0000 Subject: [PATCH 07/21] Add README. --- tests/mir-opt/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/mir-opt/README.md b/tests/mir-opt/README.md index 0721d9f7019bc..cd039bc7e0595 100644 --- a/tests/mir-opt/README.md +++ b/tests/mir-opt/README.md @@ -49,3 +49,19 @@ This exists mainly for completeness and is rarely useful. ``` // EMIT_MIR $file_name_of_some_mir_dump.before.mir ``` + +# FileCheck directives + +The LLVM FileCheck tool is used to verify the contents of output MIR against `CHECK` directives +present in the test file. This works on the runtime MIR, generated by `--emit=mir`, and not +on the output of a individual passes. + +To check MIR for function `foo`, start with a `// CHECK-LABEL fn foo(` directive. + +`{{regex}}` syntax allows to match `regex`. + +`[[name:regex]]` syntax allows to bind `name` to a string matching `regex`, and refer to it +as `[[name]]` in later directives, `regex` should be written not to match a leading space. +Use `[[my_local:_.*]]` to name a local, and `[[my_bb:bb.*]]` to name a block. + +Documentation for FileCheck is available here: https://www.llvm.org/docs/CommandGuide/FileCheck.html From f0690d52321696a74b48b7c80b3e47d634ba85ed Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 19:19:51 +0000 Subject: [PATCH 08/21] FileCheck combine_array_len. --- .../combine_array_len.norm2.InstSimplify.panic-abort.diff | 0 .../combine_array_len.norm2.InstSimplify.panic-unwind.diff | 0 tests/mir-opt/{ => instsimplify}/combine_array_len.rs | 5 +++-- 3 files changed, 3 insertions(+), 2 deletions(-) rename tests/mir-opt/{ => instsimplify}/combine_array_len.norm2.InstSimplify.panic-abort.diff (100%) rename tests/mir-opt/{ => instsimplify}/combine_array_len.norm2.InstSimplify.panic-unwind.diff (100%) rename tests/mir-opt/{ => instsimplify}/combine_array_len.rs (83%) diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff similarity index 100% rename from tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff rename to tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff similarity index 100% rename from tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff rename to tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/instsimplify/combine_array_len.rs similarity index 83% rename from tests/mir-opt/combine_array_len.rs rename to tests/mir-opt/instsimplify/combine_array_len.rs index 21485ee21b169..3b6795bc94300 100644 --- a/tests/mir-opt/combine_array_len.rs +++ b/tests/mir-opt/instsimplify/combine_array_len.rs @@ -1,9 +1,10 @@ -// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: InstSimplify -// EMIT_MIR combine_array_len.norm2.InstSimplify.diff +// EMIT_MIR combine_array_len.norm2.InstSimplify.diff fn norm2(x: [f32; 2]) -> f32 { + // CHECK-LABEL: fn norm2( + // CHECK-NOT: Len( let a = x[0]; let b = x[1]; a*a + b*b From 5453a4f056e2f5c3da85bebca1de95be32177385 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 19:23:08 +0000 Subject: [PATCH 09/21] FileCheck bool_compare. --- tests/mir-opt/bool_compare.rs | 29 -------- .../mir-opt/equal_true.opt.InstSimplify.diff | 36 ---------- tests/mir-opt/equal_true.rs | 12 ---- .../bool_compare.eq_false.InstSimplify.diff} | 6 +- .../bool_compare.eq_true.InstSimplify.diff | 36 ++++++++++ .../bool_compare.false_eq.InstSimplify.diff} | 6 +- .../bool_compare.false_ne.InstSimplify.diff | 36 ++++++++++ .../bool_compare.ne_false.InstSimplify.diff} | 6 +- .../bool_compare.ne_true.InstSimplify.diff} | 6 +- tests/mir-opt/instsimplify/bool_compare.rs | 68 +++++++++++++++++++ .../bool_compare.true_eq.InstSimplify.diff | 36 ++++++++++ .../bool_compare.true_ne.InstSimplify.diff} | 6 +- tests/mir-opt/not_equal_false.rs | 11 --- 13 files changed, 191 insertions(+), 103 deletions(-) delete mode 100644 tests/mir-opt/bool_compare.rs delete mode 100644 tests/mir-opt/equal_true.opt.InstSimplify.diff delete mode 100644 tests/mir-opt/equal_true.rs rename tests/mir-opt/{bool_compare.opt3.InstSimplify.diff => instsimplify/bool_compare.eq_false.InstSimplify.diff} (83%) create mode 100644 tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff rename tests/mir-opt/{bool_compare.opt4.InstSimplify.diff => instsimplify/bool_compare.false_eq.InstSimplify.diff} (83%) create mode 100644 tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff rename tests/mir-opt/{not_equal_false.opt.InstSimplify.diff => instsimplify/bool_compare.ne_false.InstSimplify.diff} (83%) rename tests/mir-opt/{bool_compare.opt1.InstSimplify.diff => instsimplify/bool_compare.ne_true.InstSimplify.diff} (83%) create mode 100644 tests/mir-opt/instsimplify/bool_compare.rs create mode 100644 tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff rename tests/mir-opt/{bool_compare.opt2.InstSimplify.diff => instsimplify/bool_compare.true_ne.InstSimplify.diff} (83%) delete mode 100644 tests/mir-opt/not_equal_false.rs diff --git a/tests/mir-opt/bool_compare.rs b/tests/mir-opt/bool_compare.rs deleted file mode 100644 index 3de3fb93d15ef..0000000000000 --- a/tests/mir-opt/bool_compare.rs +++ /dev/null @@ -1,29 +0,0 @@ -// skip-filecheck -// unit-test: InstSimplify - -// EMIT_MIR bool_compare.opt1.InstSimplify.diff -fn opt1(x: bool) -> u32 { - if x != true { 0 } else { 1 } -} - -// EMIT_MIR bool_compare.opt2.InstSimplify.diff -fn opt2(x: bool) -> u32 { - if true != x { 0 } else { 1 } -} - -// EMIT_MIR bool_compare.opt3.InstSimplify.diff -fn opt3(x: bool) -> u32 { - if x == false { 0 } else { 1 } -} - -// EMIT_MIR bool_compare.opt4.InstSimplify.diff -fn opt4(x: bool) -> u32 { - if false == x { 0 } else { 1 } -} - -fn main() { - opt1(false); - opt2(false); - opt3(false); - opt4(false); -} diff --git a/tests/mir-opt/equal_true.opt.InstSimplify.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff deleted file mode 100644 index 88a51000c9331..0000000000000 --- a/tests/mir-opt/equal_true.opt.InstSimplify.diff +++ /dev/null @@ -1,36 +0,0 @@ -- // MIR for `opt` before InstSimplify -+ // MIR for `opt` after InstSimplify - - fn opt(_1: bool) -> i32 { - debug x => _1; - let mut _0: i32; - let mut _2: bool; - let mut _3: bool; - - bb0: { - StorageLive(_2); - StorageLive(_3); - _3 = _1; -- _2 = Eq(move _3, const true); -+ _2 = move _3; - switchInt(move _2) -> [0: bb2, otherwise: bb1]; - } - - bb1: { - StorageDead(_3); - _0 = const 0_i32; - goto -> bb3; - } - - bb2: { - StorageDead(_3); - _0 = const 1_i32; - goto -> bb3; - } - - bb3: { - StorageDead(_2); - return; - } - } - diff --git a/tests/mir-opt/equal_true.rs b/tests/mir-opt/equal_true.rs deleted file mode 100644 index 8d7cfe73ffc74..0000000000000 --- a/tests/mir-opt/equal_true.rs +++ /dev/null @@ -1,12 +0,0 @@ -// skip-filecheck -// unit-test InstSimplify - -// EMIT_MIR equal_true.opt.InstSimplify.diff - -fn opt(x: bool) -> i32 { - if x == true { 0 } else { 1 } -} - -fn main() { - opt(true); -} diff --git a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff similarity index 83% rename from tests/mir-opt/bool_compare.opt3.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff index 034d5e44013cf..5c09963d43344 100644 --- a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff @@ -1,7 +1,7 @@ -- // MIR for `opt3` before InstSimplify -+ // MIR for `opt3` after InstSimplify +- // MIR for `eq_false` before InstSimplify ++ // MIR for `eq_false` after InstSimplify - fn opt3(_1: bool) -> u32 { + fn eq_false(_1: bool) -> u32 { debug x => _1; let mut _0: u32; let mut _2: bool; diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff new file mode 100644 index 0000000000000..a80133b0eb097 --- /dev/null +++ b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff @@ -0,0 +1,36 @@ +- // MIR for `eq_true` before InstSimplify ++ // MIR for `eq_true` after InstSimplify + + fn eq_true(_1: bool) -> u32 { + debug x => _1; + let mut _0: u32; + let mut _2: bool; + let mut _3: bool; + + bb0: { + StorageLive(_2); + StorageLive(_3); + _3 = _1; +- _2 = Eq(move _3, const true); ++ _2 = move _3; + switchInt(move _2) -> [0: bb2, otherwise: bb1]; + } + + bb1: { + StorageDead(_3); + _0 = const 0_u32; + goto -> bb3; + } + + bb2: { + StorageDead(_3); + _0 = const 1_u32; + goto -> bb3; + } + + bb3: { + StorageDead(_2); + return; + } + } + diff --git a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff similarity index 83% rename from tests/mir-opt/bool_compare.opt4.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff index d3096da6c5a2f..8235d5263bb1b 100644 --- a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff @@ -1,7 +1,7 @@ -- // MIR for `opt4` before InstSimplify -+ // MIR for `opt4` after InstSimplify +- // MIR for `false_eq` before InstSimplify ++ // MIR for `false_eq` after InstSimplify - fn opt4(_1: bool) -> u32 { + fn false_eq(_1: bool) -> u32 { debug x => _1; let mut _0: u32; let mut _2: bool; diff --git a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff new file mode 100644 index 0000000000000..77d076c6c14e3 --- /dev/null +++ b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff @@ -0,0 +1,36 @@ +- // MIR for `false_ne` before InstSimplify ++ // MIR for `false_ne` after InstSimplify + + fn false_ne(_1: bool) -> u32 { + debug x => _1; + let mut _0: u32; + let mut _2: bool; + let mut _3: bool; + + bb0: { + StorageLive(_2); + StorageLive(_3); + _3 = _1; +- _2 = Ne(const false, move _3); ++ _2 = move _3; + switchInt(move _2) -> [0: bb2, otherwise: bb1]; + } + + bb1: { + StorageDead(_3); + _0 = const 0_u32; + goto -> bb3; + } + + bb2: { + StorageDead(_3); + _0 = const 1_u32; + goto -> bb3; + } + + bb3: { + StorageDead(_2); + return; + } + } + diff --git a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff similarity index 83% rename from tests/mir-opt/not_equal_false.opt.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff index 1342966aa15e5..2362b11297ea6 100644 --- a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff @@ -1,7 +1,7 @@ -- // MIR for `opt` before InstSimplify -+ // MIR for `opt` after InstSimplify +- // MIR for `ne_false` before InstSimplify ++ // MIR for `ne_false` after InstSimplify - fn opt(_1: bool) -> u32 { + fn ne_false(_1: bool) -> u32 { debug x => _1; let mut _0: u32; let mut _2: bool; diff --git a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff similarity index 83% rename from tests/mir-opt/bool_compare.opt1.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff index 657c11516a172..6ccbd2fb7a1f0 100644 --- a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff @@ -1,7 +1,7 @@ -- // MIR for `opt1` before InstSimplify -+ // MIR for `opt1` after InstSimplify +- // MIR for `ne_true` before InstSimplify ++ // MIR for `ne_true` after InstSimplify - fn opt1(_1: bool) -> u32 { + fn ne_true(_1: bool) -> u32 { debug x => _1; let mut _0: u32; let mut _2: bool; diff --git a/tests/mir-opt/instsimplify/bool_compare.rs b/tests/mir-opt/instsimplify/bool_compare.rs new file mode 100644 index 0000000000000..77f427b0d7c83 --- /dev/null +++ b/tests/mir-opt/instsimplify/bool_compare.rs @@ -0,0 +1,68 @@ +// unit-test: InstSimplify + +// EMIT_MIR bool_compare.eq_true.InstSimplify.diff +fn eq_true(x: bool) -> u32 { + // CHECK-LABEL: fn eq_true( + // CHECK-NOT: Eq( + if x == true { 0 } else { 1 } +} + +// EMIT_MIR bool_compare.true_eq.InstSimplify.diff +fn true_eq(x: bool) -> u32 { + // CHECK-LABEL: fn true_eq( + // CHECK-NOT: Eq( + if true == x { 0 } else { 1 } +} + +// EMIT_MIR bool_compare.ne_true.InstSimplify.diff +fn ne_true(x: bool) -> u32 { + // CHECK-LABEL: fn ne_true( + // CHECK: Not( + if x != true { 0 } else { 1 } +} + +// EMIT_MIR bool_compare.true_ne.InstSimplify.diff +fn true_ne(x: bool) -> u32 { + // CHECK-LABEL: fn true_ne( + // CHECK: Not( + if true != x { 0 } else { 1 } +} + +// EMIT_MIR bool_compare.eq_false.InstSimplify.diff +fn eq_false(x: bool) -> u32 { + // CHECK-LABEL: fn eq_false( + // CHECK: Not( + if x == false { 0 } else { 1 } +} + +// EMIT_MIR bool_compare.false_eq.InstSimplify.diff +fn false_eq(x: bool) -> u32 { + // CHECK-LABEL: fn false_eq( + // CHECK: Not( + if false == x { 0 } else { 1 } +} + +// EMIT_MIR bool_compare.ne_false.InstSimplify.diff +fn ne_false(x: bool) -> u32 { + // CHECK-LABEL: fn ne_false( + // CHECK-NOT: Ne( + if x != false { 0 } else { 1 } +} + +// EMIT_MIR bool_compare.false_ne.InstSimplify.diff +fn false_ne(x: bool) -> u32 { + // CHECK-LABEL: fn false_ne( + // CHECK-NOT: Ne( + if false != x { 0 } else { 1 } +} + +fn main() { + eq_true(false); + true_eq(false); + ne_true(false); + true_ne(false); + eq_false(false); + false_eq(false); + ne_false(false); + false_ne(false); +} diff --git a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff new file mode 100644 index 0000000000000..18675329a2eed --- /dev/null +++ b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff @@ -0,0 +1,36 @@ +- // MIR for `true_eq` before InstSimplify ++ // MIR for `true_eq` after InstSimplify + + fn true_eq(_1: bool) -> u32 { + debug x => _1; + let mut _0: u32; + let mut _2: bool; + let mut _3: bool; + + bb0: { + StorageLive(_2); + StorageLive(_3); + _3 = _1; +- _2 = Eq(const true, move _3); ++ _2 = move _3; + switchInt(move _2) -> [0: bb2, otherwise: bb1]; + } + + bb1: { + StorageDead(_3); + _0 = const 0_u32; + goto -> bb3; + } + + bb2: { + StorageDead(_3); + _0 = const 1_u32; + goto -> bb3; + } + + bb3: { + StorageDead(_2); + return; + } + } + diff --git a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff similarity index 83% rename from tests/mir-opt/bool_compare.opt2.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff index bc8be62bd49d6..dc91cf8a5c41e 100644 --- a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff @@ -1,7 +1,7 @@ -- // MIR for `opt2` before InstSimplify -+ // MIR for `opt2` after InstSimplify +- // MIR for `true_ne` before InstSimplify ++ // MIR for `true_ne` after InstSimplify - fn opt2(_1: bool) -> u32 { + fn true_ne(_1: bool) -> u32 { debug x => _1; let mut _0: u32; let mut _2: bool; diff --git a/tests/mir-opt/not_equal_false.rs b/tests/mir-opt/not_equal_false.rs deleted file mode 100644 index 8008df79ceb5f..0000000000000 --- a/tests/mir-opt/not_equal_false.rs +++ /dev/null @@ -1,11 +0,0 @@ -// skip-filecheck -// unit-test: InstSimplify -// EMIT_MIR not_equal_false.opt.InstSimplify.diff - -fn opt(x: bool) -> u32 { - if x != false { 0 } else { 1 } -} - -fn main() { - opt(false); -} From ddc328c2f1ba2fb90206f9eecf39fa8b78bc140f Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 19:26:04 +0000 Subject: [PATCH 10/21] FileCheck combine_clone_of_primitives. --- .../{ => instsimplify}/combine_clone_of_primitives.rs | 7 +++++-- ...primitives.{impl#0}-clone.InstSimplify.panic-abort.diff | 6 +++--- ...rimitives.{impl#0}-clone.InstSimplify.panic-unwind.diff | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) rename tests/mir-opt/{ => instsimplify}/combine_clone_of_primitives.rs (74%) rename tests/mir-opt/{ => instsimplify}/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff (85%) rename tests/mir-opt/{ => instsimplify}/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff (86%) diff --git a/tests/mir-opt/combine_clone_of_primitives.rs b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs similarity index 74% rename from tests/mir-opt/combine_clone_of_primitives.rs rename to tests/mir-opt/instsimplify/combine_clone_of_primitives.rs index 1a8913eb8b141..2adbe778d232b 100644 --- a/tests/mir-opt/combine_clone_of_primitives.rs +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs @@ -1,9 +1,7 @@ -// skip-filecheck // unit-test: InstSimplify // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff - #[derive(Clone)] struct MyThing { v: T, @@ -11,6 +9,11 @@ struct MyThing { a: [f32; 3], } +// CHECK-LABEL: ::clone( +// CHECK: ::clone( +// CHECK-NOT: ::clone( +// CHECK-NOT: <[f32; 3] as Clone>::clone( + fn main() { let x = MyThing:: { v: 2, i: 3, a: [0.0; 3] }; let y = x.clone(); diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff similarity index 85% rename from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff rename to tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff index 1a1ff5779400c..48586f8b3349a 100644 --- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff @@ -1,7 +1,7 @@ -- // MIR for `::clone` before InstSimplify -+ // MIR for `::clone` after InstSimplify +- // MIR for `::clone` before InstSimplify ++ // MIR for `::clone` after InstSimplify - fn ::clone(_1: &MyThing) -> MyThing { + fn ::clone(_1: &MyThing) -> MyThing { debug self => _1; let mut _0: MyThing; let mut _2: T; diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff similarity index 86% rename from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff rename to tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff index 4d851b532866d..a57266e9c1226 100644 --- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff @@ -1,7 +1,7 @@ -- // MIR for `::clone` before InstSimplify -+ // MIR for `::clone` after InstSimplify +- // MIR for `::clone` before InstSimplify ++ // MIR for `::clone` after InstSimplify - fn ::clone(_1: &MyThing) -> MyThing { + fn ::clone(_1: &MyThing) -> MyThing { debug self => _1; let mut _0: MyThing; let mut _2: T; From f856247cc94dd3c3fcffb5222c54a22e6521160f Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 19:30:09 +0000 Subject: [PATCH 11/21] FileCheck intrinsic_asserts. --- tests/mir-opt/dont_yeet_assert.rs | 12 ---------- ...ntrinsic_asserts.generic.InstSimplify.diff | 14 +++++------ ...sic_asserts.generic_ref.InstSimplify.diff} | 6 ++--- ...intrinsic_asserts.panics.InstSimplify.diff | 14 +++++------ ...rinsic_asserts.removable.InstSimplify.diff | 14 +++++------ .../{ => instsimplify}/intrinsic_asserts.rs | 23 ++++++++++++++++++- 6 files changed, 46 insertions(+), 37 deletions(-) delete mode 100644 tests/mir-opt/dont_yeet_assert.rs rename tests/mir-opt/{ => instsimplify}/intrinsic_asserts.generic.InstSimplify.diff (74%) rename tests/mir-opt/{dont_yeet_assert.generic.InstSimplify.diff => instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff} (70%) rename tests/mir-opt/{ => instsimplify}/intrinsic_asserts.panics.InstSimplify.diff (80%) rename tests/mir-opt/{ => instsimplify}/intrinsic_asserts.removable.InstSimplify.diff (77%) rename tests/mir-opt/{ => instsimplify}/intrinsic_asserts.rs (52%) diff --git a/tests/mir-opt/dont_yeet_assert.rs b/tests/mir-opt/dont_yeet_assert.rs deleted file mode 100644 index f61bfb8a46ff4..0000000000000 --- a/tests/mir-opt/dont_yeet_assert.rs +++ /dev/null @@ -1,12 +0,0 @@ -// skip-filecheck -// compile-flags: --crate-type=lib -// 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.InstSimplify.diff -pub fn generic() { - core::intrinsics::assert_mem_uninitialized_valid::<&T>(); -} diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff similarity index 74% rename from tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff rename to tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff index efa52798e6509..2ecacb5e39f47 100644 --- a/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff @@ -8,25 +8,25 @@ let _3: (); bb0: { - nop; + StorageLive(_1); _1 = assert_inhabited::() -> [return: bb1, unwind unreachable]; } bb1: { - nop; - nop; + StorageDead(_1); + StorageLive(_2); _2 = assert_zero_valid::() -> [return: bb2, unwind unreachable]; } bb2: { - nop; - nop; + StorageDead(_2); + StorageLive(_3); _3 = assert_mem_uninitialized_valid::() -> [return: bb3, unwind unreachable]; } bb3: { - nop; - nop; + StorageDead(_3); + _0 = const (); return; } } diff --git a/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff similarity index 70% rename from tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff rename to tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff index 98d9d24af3497..d29af0945f7dc 100644 --- a/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff @@ -1,7 +1,7 @@ -- // MIR for `generic` before InstSimplify -+ // MIR for `generic` after InstSimplify +- // MIR for `generic_ref` before InstSimplify ++ // MIR for `generic_ref` after InstSimplify - fn generic() -> () { + fn generic_ref() -> () { let mut _0: (); let _1: (); diff --git a/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff similarity index 80% rename from tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff rename to tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff index 46e0533780976..1be386acfccab 100644 --- a/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff @@ -8,28 +8,28 @@ let _3: (); bb0: { - nop; + StorageLive(_1); - _1 = assert_inhabited::() -> [return: bb1, unwind unreachable]; + _1 = assert_inhabited::() -> unwind unreachable; } bb1: { - nop; - nop; + StorageDead(_1); + StorageLive(_2); - _2 = assert_zero_valid::<&u8>() -> [return: bb2, unwind unreachable]; + _2 = assert_zero_valid::<&u8>() -> unwind unreachable; } bb2: { - nop; - nop; + StorageDead(_2); + StorageLive(_3); - _3 = assert_mem_uninitialized_valid::<&u8>() -> [return: bb3, unwind unreachable]; + _3 = assert_mem_uninitialized_valid::<&u8>() -> unwind unreachable; } bb3: { - nop; - nop; + StorageDead(_3); + _0 = const (); return; } } diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff similarity index 77% rename from tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff rename to tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff index 70c3e8830f4ad..f2e6978384205 100644 --- a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff @@ -8,28 +8,28 @@ let _3: (); bb0: { - nop; + StorageLive(_1); - _1 = assert_inhabited::<()>() -> [return: bb1, unwind unreachable]; + goto -> bb1; } bb1: { - nop; - nop; + StorageDead(_1); + StorageLive(_2); - _2 = assert_zero_valid::() -> [return: bb2, unwind unreachable]; + goto -> bb2; } bb2: { - nop; - nop; + StorageDead(_2); + StorageLive(_3); - _3 = assert_mem_uninitialized_valid::() -> [return: bb3, unwind unreachable]; + goto -> bb3; } bb3: { - nop; - nop; + StorageDead(_3); + _0 = const (); return; } } diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/instsimplify/intrinsic_asserts.rs similarity index 52% rename from tests/mir-opt/intrinsic_asserts.rs rename to tests/mir-opt/instsimplify/intrinsic_asserts.rs index d627644474db7..43998b2dbf02c 100644 --- a/tests/mir-opt/intrinsic_asserts.rs +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.rs @@ -1,10 +1,15 @@ -// skip-filecheck +// unit-test: InstSimplify + #![crate_type = "lib"] #![feature(core_intrinsics)] // All these assertions pass, so all the intrinsic calls should be deleted. // EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff pub fn removable() { + // CHECK-LABEL: fn removable( + // CHECK-NOT: assert_inhabited + // CHECK-NOT: assert_zero_valid + // CHECK-NOT: assert_mem_uninitialized_valid core::intrinsics::assert_inhabited::<()>(); core::intrinsics::assert_zero_valid::(); core::intrinsics::assert_mem_uninitialized_valid::(); @@ -15,6 +20,10 @@ enum Never {} // These assertions all diverge, so their target blocks should become None. // EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff pub fn panics() { + // CHECK-LABEL: fn panics( + // CHECK: assert_inhabited::() -> unwind + // CHECK: assert_zero_valid::<&u8>() -> unwind + // CHECK: assert_mem_uninitialized_valid::<&u8>() -> unwind core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::<&u8>(); core::intrinsics::assert_mem_uninitialized_valid::<&u8>(); @@ -23,7 +32,19 @@ pub fn panics() { // Whether or not these asserts pass isn't known, so they shouldn't be modified. // EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff pub fn generic() { + // CHECK-LABEL: fn generic( + // CHECK: assert_inhabited::() -> [return: + // CHECK: assert_zero_valid::() -> [return: + // CHECK: assert_mem_uninitialized_valid::() -> [return: core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::(); core::intrinsics::assert_mem_uninitialized_valid::(); } + +// Whether or not these asserts pass isn't known, so they shouldn't be modified. +// EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify.diff +pub fn generic_ref() { + // CHECK-LABEL: fn generic_ref( + // CHECK: assert_mem_uninitialized_valid::<&T>() -> [return: + core::intrinsics::assert_mem_uninitialized_valid::<&T>(); +} From 386fff34f79be519d0a5ef023f5fea367a5e16f8 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 19:39:34 +0000 Subject: [PATCH 12/21] FileCheck duplicate_switch_targets. --- ...plicate_switch_targets.assert_zero.InstSimplify.diff} | 0 .../duplicate_switch_targets.rs} | 9 +++++---- 2 files changed, 5 insertions(+), 4 deletions(-) rename tests/mir-opt/{instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff => instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff} (100%) rename tests/mir-opt/{instsimplify_duplicate_switch_targets.rs => instsimplify/duplicate_switch_targets.rs} (75%) diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff similarity index 100% rename from tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff rename to tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs similarity index 75% rename from tests/mir-opt/instsimplify_duplicate_switch_targets.rs rename to tests/mir-opt/instsimplify/duplicate_switch_targets.rs index db98bb400b95e..e40bc7edaac7f 100644 --- a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs +++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs @@ -1,14 +1,15 @@ -// skip-filecheck +// unit-test: InstSimplify + #![feature(custom_mir, core_intrinsics)] #![crate_type = "lib"] use std::intrinsics::mir::*; -// unit-test: InstSimplify - -// EMIT_MIR instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff +// EMIT_MIR duplicate_switch_targets.assert_zero.InstSimplify.diff #[custom_mir(dialect = "runtime", phase = "post-cleanup")] pub unsafe fn assert_zero(x: u8) -> u8 { + // CHECK-LABEL: fn assert_zero( + // CHECK: switchInt({{.*}}) -> [0: {{bb.*}}, otherwise: {{bb.*}}] mir!( { match x { From 68c409f8f64316b9a917d04e1ce4d4a2ee70b85d Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 19:50:54 +0000 Subject: [PATCH 13/21] FileCheck combine_transmutes. --- ...ransmutes.adt_transmutes.InstSimplify.diff | 0 ...utes.identity_transmutes.InstSimplify.diff | 0 ...mutes.integer_transmutes.InstSimplify.diff | 0 .../{ => instsimplify}/combine_transmutes.rs | 23 ++++++++++++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) rename tests/mir-opt/{ => instsimplify}/combine_transmutes.adt_transmutes.InstSimplify.diff (100%) rename tests/mir-opt/{ => instsimplify}/combine_transmutes.identity_transmutes.InstSimplify.diff (100%) rename tests/mir-opt/{ => instsimplify}/combine_transmutes.integer_transmutes.InstSimplify.diff (100%) rename tests/mir-opt/{ => instsimplify}/combine_transmutes.rs (65%) diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff similarity index 100% rename from tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff rename to tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff similarity index 100% rename from tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff rename to tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff similarity index 100% rename from tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff rename to tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs similarity index 65% rename from tests/mir-opt/combine_transmutes.rs rename to tests/mir-opt/instsimplify/combine_transmutes.rs index 89ec0a08a01d4..b8e15da905bda 100644 --- a/tests/mir-opt/combine_transmutes.rs +++ b/tests/mir-opt/instsimplify/combine_transmutes.rs @@ -1,4 +1,3 @@ -// skip-filecheck // unit-test: InstSimplify // compile-flags: -C panic=abort @@ -11,6 +10,10 @@ use std::mem::{MaybeUninit, ManuallyDrop, transmute}; // EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff pub unsafe fn identity_transmutes() { + // CHECK-LABEL: fn identity_transmutes( + // CHECK-NOT: as i32 (Transmute); + // CHECK-NOT: as Vec (Transmute); + // These are nops and should be removed let _a = transmute::(1); let _a = transmute::, Vec>(Vec::new()); @@ -19,6 +22,16 @@ pub unsafe fn identity_transmutes() { #[custom_mir(dialect = "runtime", phase = "initial")] // EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff pub unsafe fn integer_transmutes() { + // CHECK-LABEL: fn integer_transmutes( + // CHECK-NOT: _i32 as u32 (Transmute); + // CHECK: _i32 as u32 (IntToInt); + // CHECK: _i32 as i64 (Transmute); + // CHECK-NOT: _u64 as i64 (Transmute); + // CHECK: _u64 as i64 (IntToInt); + // CHECK: _u64 as u32 (Transmute); + // CHECK-NOT: _isize as usize (Transmute); + // CHECK: _isize as usize (IntToInt); + mir! { { let A = CastTransmute::(1); // Can be a cast @@ -33,6 +46,14 @@ pub unsafe fn integer_transmutes() { // EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff pub unsafe fn adt_transmutes() { + // CHECK-LABEL: fn adt_transmutes( + // CHECK: as u8 (Transmute); + // CHECK: ({{_.*}}.0: i16); + // CHECK: as u16 (Transmute); + // CHECK: as u32 (Transmute); + // CHECK: as i32 (Transmute); + // CHECK: ({{_.*}}.1: std::mem::ManuallyDrop); + let _a: u8 = transmute(Some(std::num::NonZeroU8::MAX)); let _a: i16 = transmute(std::num::Wrapping(0_i16)); let _a: u16 = transmute(std::num::Wrapping(0_i16)); From d8cffda66a2d865adf098c4f079fafdb73bcf1ba Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 19:58:20 +0000 Subject: [PATCH 14/21] FileCheck casts. --- .../casts.redundant.PreCodegen.after.mir | 14 ----------- .../casts.roundtrip.PreCodegen.after.mir | 15 ----------- tests/mir-opt/casts.rs | 18 ------------- .../casts.redundant.InstSimplify.diff | 10 +++++--- .../casts.roundtrip.InstSimplify.diff | 21 ++++++++++++++++ tests/mir-opt/instsimplify/casts.rs | 25 +++++++++++++++++++ 6 files changed, 53 insertions(+), 50 deletions(-) delete mode 100644 tests/mir-opt/casts.redundant.PreCodegen.after.mir delete mode 100644 tests/mir-opt/casts.roundtrip.PreCodegen.after.mir delete mode 100644 tests/mir-opt/casts.rs rename tests/mir-opt/{ => instsimplify}/casts.redundant.InstSimplify.diff (71%) create mode 100644 tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff create mode 100644 tests/mir-opt/instsimplify/casts.rs diff --git a/tests/mir-opt/casts.redundant.PreCodegen.after.mir b/tests/mir-opt/casts.redundant.PreCodegen.after.mir deleted file mode 100644 index 2084f44f24861..0000000000000 --- a/tests/mir-opt/casts.redundant.PreCodegen.after.mir +++ /dev/null @@ -1,14 +0,0 @@ -// MIR for `redundant` after PreCodegen - -fn redundant(_1: *const &u8) -> *const &u8 { - debug x => _1; - let mut _0: *const &u8; - scope 1 (inlined generic_cast::<&u8, &u8>) { - debug x => _1; - } - - bb0: { - _0 = _1; - return; - } -} diff --git a/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir b/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir deleted file mode 100644 index f0c35fe9782cb..0000000000000 --- a/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir +++ /dev/null @@ -1,15 +0,0 @@ -// MIR for `roundtrip` after PreCodegen - -fn roundtrip(_1: *const u8) -> *const u8 { - debug x => _1; - let mut _0: *const u8; - let mut _2: *mut u8; - - bb0: { - StorageLive(_2); - _2 = _1 as *mut u8 (PtrToPtr); - _0 = move _2 as *const u8 (PointerCoercion(MutToConstPointer)); - StorageDead(_2); - return; - } -} diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs deleted file mode 100644 index c154aeace0f01..0000000000000 --- a/tests/mir-opt/casts.rs +++ /dev/null @@ -1,18 +0,0 @@ -// skip-filecheck -#![crate_type = "lib"] - -// 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 -} - -#[inline] -fn generic_cast(x: *const T) -> *const U { - x as *const U -} - -// EMIT_MIR casts.roundtrip.PreCodegen.after.mir -pub fn roundtrip(x: *const u8) -> *const u8 { - x as *mut u8 as *const u8 -} diff --git a/tests/mir-opt/casts.redundant.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff similarity index 71% rename from tests/mir-opt/casts.redundant.InstSimplify.diff rename to tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff index f5ea78aecbe0b..1c417d4346d04 100644 --- a/tests/mir-opt/casts.redundant.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff @@ -7,15 +7,19 @@ let mut _2: *const &u8; let mut _3: *const &u8; scope 1 (inlined generic_cast::<&u8, &u8>) { - debug x => _1; + debug x => _3; + let mut _4: *const &u8; } bb0: { StorageLive(_2); StorageLive(_3); _3 = _1; -- _2 = _3 as *const &u8 (PtrToPtr); -+ _2 = _3; + StorageLive(_4); + _4 = _3; +- _2 = move _4 as *const &u8 (PtrToPtr); ++ _2 = move _4; + StorageDead(_4); StorageDead(_3); _0 = _2; StorageDead(_2); diff --git a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff new file mode 100644 index 0000000000000..1ae9d45e66c2a --- /dev/null +++ b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff @@ -0,0 +1,21 @@ +- // MIR for `roundtrip` before InstSimplify ++ // MIR for `roundtrip` after InstSimplify + + fn roundtrip(_1: *const u8) -> *const u8 { + debug x => _1; + let mut _0: *const u8; + let mut _2: *mut u8; + let mut _3: *const u8; + + bb0: { + StorageLive(_2); + StorageLive(_3); + _3 = _1; + _2 = move _3 as *mut u8 (PtrToPtr); + _0 = move _2 as *const u8 (PointerCoercion(MutToConstPointer)); + StorageDead(_3); + StorageDead(_2); + return; + } + } + diff --git a/tests/mir-opt/instsimplify/casts.rs b/tests/mir-opt/instsimplify/casts.rs new file mode 100644 index 0000000000000..18bab524c64bc --- /dev/null +++ b/tests/mir-opt/instsimplify/casts.rs @@ -0,0 +1,25 @@ +// unit-test: InstSimplify +// compile-flags: -Zinline-mir +#![crate_type = "lib"] + +#[inline(always)] +fn generic_cast(x: *const T) -> *const U { + x as *const U +} + +// EMIT_MIR casts.redundant.InstSimplify.diff +pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { + // CHECK-LABEL: fn redundant( + // CHECK: inlined generic_cast + // CHECK-NOT: as + generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8 +} + +// EMIT_MIR casts.roundtrip.InstSimplify.diff +pub fn roundtrip(x: *const u8) -> *const u8 { + // CHECK-LABEL: fn roundtrip( + // CHECK: _3 = _1; + // CHECK: _2 = move _3 as *mut u8 (PtrToPtr); + // CHECK: _0 = move _2 as *const u8 (PointerCoercion(MutToConstPointer)); + x as *mut u8 as *const u8 +} From 4bae8479694bbafe15f51ae918554bb43ec47e9e Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 20:00:43 +0000 Subject: [PATCH 15/21] FileCheck lower_intrinsics. --- tests/mir-opt/lower_intrinsics.rs | 88 ++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 3f6bb916394d9..913605cc2b2b6 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -1,4 +1,3 @@ -// skip-filecheck // unit-test: LowerIntrinsics // EMIT_MIR_FOR_EACH_PANIC_STRATEGY @@ -7,6 +6,10 @@ // EMIT_MIR lower_intrinsics.wrapping.LowerIntrinsics.diff pub fn wrapping(a: i32, b: i32) { + // CHECK-LABEL: fn wrapping( + // CHECK: {{_.*}} = Add( + // CHECK: {{_.*}} = Sub( + // CHECK: {{_.*}} = Mul( let _x = core::intrinsics::wrapping_add(a, b); let _y = core::intrinsics::wrapping_sub(a, b); let _z = core::intrinsics::wrapping_mul(a, b); @@ -14,6 +17,14 @@ pub fn wrapping(a: i32, b: i32) { // EMIT_MIR lower_intrinsics.unchecked.LowerIntrinsics.diff pub unsafe fn unchecked(a: i32, b: i32) { + // CHECK-LABEL: fn unchecked( + // CHECK: {{_.*}} = AddUnchecked( + // CHECK: {{_.*}} = SubUnchecked( + // CHECK: {{_.*}} = MulUnchecked( + // CHECK: {{_.*}} = Div( + // CHECK: {{_.*}} = Rem( + // CHECK: {{_.*}} = ShlUnchecked( + // CHECK: {{_.*}} = ShrUnchecked( let _a = core::intrinsics::unchecked_add(a, b); let _b = core::intrinsics::unchecked_sub(a, b); let _c = core::intrinsics::unchecked_mul(a, b); @@ -25,26 +36,39 @@ pub unsafe fn unchecked(a: i32, b: i32) { // EMIT_MIR lower_intrinsics.size_of.LowerIntrinsics.diff pub fn size_of() -> usize { + // CHECK-LABEL: fn size_of( + // CHECK: {{_.*}} = SizeOf(T); core::intrinsics::size_of::() } // EMIT_MIR lower_intrinsics.align_of.LowerIntrinsics.diff pub fn align_of() -> usize { + // CHECK-LABEL: fn align_of( + // CHECK: {{_.*}} = AlignOf(T); core::intrinsics::min_align_of::() } // EMIT_MIR lower_intrinsics.forget.LowerIntrinsics.diff pub fn forget(t: T) { + // CHECK-LABEL: fn forget( + // CHECK-NOT: Drop( + // CHECK: return; + // CHECK-NOT: Drop( core::intrinsics::forget(t) } // EMIT_MIR lower_intrinsics.unreachable.LowerIntrinsics.diff pub fn unreachable() -> ! { + // CHECK-LABEL: fn unreachable( + // CHECK: unreachable; unsafe { core::intrinsics::unreachable() }; } // EMIT_MIR lower_intrinsics.non_const.LowerIntrinsics.diff pub fn non_const() -> usize { + // CHECK-LABEL: fn non_const( + // CHECK: SizeOf(T); + // Check that lowering works with non-const operand as a func. let size_of_t = core::intrinsics::size_of::; size_of_t() @@ -52,33 +76,55 @@ pub fn non_const() -> usize { // EMIT_MIR lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff pub fn transmute_inhabited(c: std::cmp::Ordering) -> i8 { + // CHECK-LABEL: fn transmute_inhabited( + // CHECK: {{_.*}} = {{.*}} as i8 (Transmute); + unsafe { std::mem::transmute(c) } } // EMIT_MIR lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff pub unsafe fn transmute_uninhabited(u: ()) -> Never { + // CHECK-LABEL: fn transmute_uninhabited( + // CHECK: {{_.*}} = {{.*}} as Never (Transmute); + // CHECK: unreachable; + unsafe { std::mem::transmute::<(), Never>(u) } } // EMIT_MIR lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff pub unsafe fn transmute_ref_dst(u: &T) -> *const T { + // CHECK-LABEL: fn transmute_ref_dst( + // CHECK: {{_.*}} = {{.*}} as *const T (Transmute); + unsafe { std::mem::transmute(u) } } // EMIT_MIR lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff pub unsafe fn transmute_to_ref_uninhabited() -> ! { + // CHECK-LABEL: fn transmute_to_ref_uninhabited( + // CHECK: {{_.*}} = {{.*}} as &Never (Transmute); + // CHECK: unreachable; + let x: &Never = std::mem::transmute(1usize); match *x {} } // EMIT_MIR lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff pub unsafe fn transmute_to_mut_uninhabited() -> ! { + // CHECK-LABEL: fn transmute_to_mut_uninhabited( + // CHECK: {{_.*}} = {{.*}} as &mut Never (Transmute); + // CHECK: unreachable; + let x: &mut Never = std::mem::transmute(1usize); match *x {} } // EMIT_MIR lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff pub unsafe fn transmute_to_box_uninhabited() -> ! { + // CHECK-LABEL: fn transmute_to_box_uninhabited( + // CHECK: {{_.*}} = {{.*}} as std::boxed::Box (Transmute); + // CHECK: unreachable; + let x: Box = std::mem::transmute(1usize); match *x {} } @@ -91,6 +137,12 @@ pub enum E { // EMIT_MIR lower_intrinsics.discriminant.LowerIntrinsics.diff pub fn discriminant(t: T) { + // CHECK-LABEL: fn discriminant( + // CHECK: {{_.*}} = discriminant( + // CHECK: {{_.*}} = discriminant( + // CHECK: {{_.*}} = discriminant( + // CHECK: {{_.*}} = discriminant( + core::intrinsics::discriminant_value(&t); core::intrinsics::discriminant_value(&0); core::intrinsics::discriminant_value(&()); @@ -105,6 +157,9 @@ extern "rust-intrinsic" { // EMIT_MIR lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff pub fn f_copy_nonoverlapping() { + // CHECK-LABEL: fn f_copy_nonoverlapping( + // CHECK: copy_nonoverlapping({{.*}}); + let src = (); let mut dst = (); unsafe { @@ -114,6 +169,9 @@ pub fn f_copy_nonoverlapping() { // EMIT_MIR lower_intrinsics.assume.LowerIntrinsics.diff pub fn assume() { + // CHECK-LABEL: fn assume( + // CHECK: assume({{.*}}); + unsafe { std::intrinsics::assume(true); } @@ -121,6 +179,11 @@ pub fn assume() { // EMIT_MIR lower_intrinsics.with_overflow.LowerIntrinsics.diff pub fn with_overflow(a: i32, b: i32) { + // CHECK-LABEL: fn with_overflow( + // CHECK: CheckedAdd( + // CHECK: CheckedSub( + // CHECK: CheckedMul( + let _x = core::intrinsics::add_with_overflow(a, b); let _y = core::intrinsics::sub_with_overflow(a, b); let _z = core::intrinsics::mul_with_overflow(a, b); @@ -128,16 +191,32 @@ pub fn with_overflow(a: i32, b: i32) { // EMIT_MIR lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff pub fn read_via_copy_primitive(r: &i32) -> i32 { + // CHECK-LABEL: fn read_via_copy_primitive( + // CHECK: [[tmp:_.*]] = &raw const (*_1); + // CHECK: _0 = (*[[tmp]]); + // CHECK: return; + unsafe { core::intrinsics::read_via_copy(r) } } // EMIT_MIR lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff pub fn read_via_copy_uninhabited(r: &Never) -> Never { + // CHECK-LABEL: fn read_via_copy_uninhabited( + // CHECK: [[tmp:_.*]] = &raw const (*_1); + // CHECK: _0 = (*[[tmp]]); + // CHECK: unreachable; + unsafe { core::intrinsics::read_via_copy(r) } } // EMIT_MIR lower_intrinsics.write_via_move_string.LowerIntrinsics.diff pub fn write_via_move_string(r: &mut String, v: String) { + // CHECK-LABEL: fn write_via_move_string( + // CHECK: [[ptr:_.*]] = &raw mut (*_1); + // CHECK: [[tmp:_.*]] = move _2; + // CHECK: (*[[ptr]]) = move [[tmp]]; + // CHECK: return; + unsafe { core::intrinsics::write_via_move(r, v) } } @@ -145,6 +224,10 @@ pub enum Never {} // EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff pub fn option_payload(o: &Option, p: &Option) { + // CHECK-LABEL: fn option_payload( + // CHECK: {{_.*}} = &raw const (((*{{_.*}}) as Some).0: usize); + // CHECK: {{_.*}} = &raw const (((*{{_.*}}) as Some).0: std::string::String); + unsafe { let _x = core::intrinsics::option_payload_ptr(o); let _y = core::intrinsics::option_payload_ptr(p); @@ -153,5 +236,8 @@ pub fn option_payload(o: &Option, p: &Option) { // EMIT_MIR lower_intrinsics.ptr_offset.LowerIntrinsics.diff pub unsafe fn ptr_offset(p: *const i32, d: isize) -> *const i32 { + // CHECK-LABEL: fn ptr_offset( + // CHECK: _0 = Offset( + core::intrinsics::offset(p, d) } From ad057d43975e8ccdb55cc01d43837ce6f811b4b4 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 20:01:58 +0000 Subject: [PATCH 16/21] FileCheck lower_array_len. --- tests/mir-opt/lower_array_len.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/mir-opt/lower_array_len.rs b/tests/mir-opt/lower_array_len.rs index bfe0d8e9c3249..effd83b6af035 100644 --- a/tests/mir-opt/lower_array_len.rs +++ b/tests/mir-opt/lower_array_len.rs @@ -1,10 +1,12 @@ -// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: NormalizeArrayLen // compile-flags: -Zmir-enable-passes=+LowerSliceLenCalls // EMIT_MIR lower_array_len.array_bound.NormalizeArrayLen.diff pub fn array_bound(index: usize, slice: &[u8; N]) -> u8 { + // CHECK-LABEL: fn array_bound( + // CHECK: [[len:_.*]] = const N; + // CHECK: Lt(move {{_.*}}, move [[len]]); if index < slice.len() { slice[index] } else { @@ -14,6 +16,9 @@ pub fn array_bound(index: usize, slice: &[u8; N]) -> u8 { // EMIT_MIR lower_array_len.array_bound_mut.NormalizeArrayLen.diff pub fn array_bound_mut(index: usize, slice: &mut [u8; N]) -> u8 { + // CHECK-LABEL: fn array_bound_mut( + // CHECK: [[len:_.*]] = const N; + // CHECK: Lt(move {{_.*}}, move [[len]]); if index < slice.len() { slice[index] } else { @@ -25,16 +30,22 @@ pub fn array_bound_mut(index: usize, slice: &mut [u8; N]) -> u8 // EMIT_MIR lower_array_len.array_len.NormalizeArrayLen.diff pub fn array_len(arr: &[u8; N]) -> usize { + // CHECK-LABEL: fn array_len( + // CHECK: _0 = const N; arr.len() } // EMIT_MIR lower_array_len.array_len_by_value.NormalizeArrayLen.diff pub fn array_len_by_value(arr: [u8; N]) -> usize { + // CHECK-LABEL: fn array_len_by_value( + // CHECK: _0 = const N; arr.len() } // EMIT_MIR lower_array_len.array_len_reborrow.NormalizeArrayLen.diff pub fn array_len_reborrow(mut arr: [u8; N]) -> usize { + // CHECK-LABEL: fn array_len_reborrow( + // CHECK: _0 = const N; let arr: &mut [_] = &mut arr; let arr = &*arr; arr.len() @@ -42,6 +53,8 @@ pub fn array_len_reborrow(mut arr: [u8; N]) -> usize { // EMIT_MIR lower_array_len.array_len_raw.NormalizeArrayLen.diff pub fn array_len_raw(arr: [u8; N]) -> usize { + // CHECK-LABEL: fn array_len_raw( + // CHECK: _0 = const N; let arr: &[_] = &arr; let arr = std::ptr::addr_of!(*arr); unsafe { &*arr }.len() From d24e44a07eae5bf8f8f86b15fe85f4405889008b Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 20:03:43 +0000 Subject: [PATCH 17/21] FileCheck lower_slice_len. --- tests/mir-opt/lower_slice_len.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/mir-opt/lower_slice_len.rs b/tests/mir-opt/lower_slice_len.rs index 88492154d23ec..7b967a16588c3 100644 --- a/tests/mir-opt/lower_slice_len.rs +++ b/tests/mir-opt/lower_slice_len.rs @@ -1,9 +1,10 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // unit-test: LowerSliceLenCalls +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff pub fn bound(index: usize, slice: &[u8]) -> u8 { + // CHECK-LABEL: fn bound( + // CHECK-NOT: ::len( if index < slice.len() { slice[index] } else { From c679b208d29ea31dfed7e145e2cbaa7fba026c20 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 20:17:45 +0000 Subject: [PATCH 18/21] Mention skip in README. --- tests/mir-opt/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/mir-opt/README.md b/tests/mir-opt/README.md index cd039bc7e0595..39a7b5aea123d 100644 --- a/tests/mir-opt/README.md +++ b/tests/mir-opt/README.md @@ -56,6 +56,8 @@ The LLVM FileCheck tool is used to verify the contents of output MIR against `CH present in the test file. This works on the runtime MIR, generated by `--emit=mir`, and not on the output of a individual passes. +Use `// skip-filecheck` to prevent FileCheck from running. + To check MIR for function `foo`, start with a `// CHECK-LABEL fn foo(` directive. `{{regex}}` syntax allows to match `regex`. From 13683554ed0a274d42d53b2cf0ed97942c4b6aea Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 20:28:28 +0000 Subject: [PATCH 19/21] FileCheck issue_106141. --- tests/mir-opt/inline/issue_106141.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/mir-opt/inline/issue_106141.rs b/tests/mir-opt/inline/issue_106141.rs index 6702e7b4420c0..592b4d9b72377 100644 --- a/tests/mir-opt/inline/issue_106141.rs +++ b/tests/mir-opt/inline/issue_106141.rs @@ -1,6 +1,9 @@ -// skip-filecheck +// Verify that we do not ICE inlining a function which uses _0 as an index. // EMIT_MIR_FOR_EACH_PANIC_STRATEGY + pub fn outer() -> usize { + // CHECK-LABEL: fn outer( + // CHECK: = {{.*}}[_0]; inner() } @@ -11,6 +14,8 @@ fn index() -> usize { #[inline] fn inner() -> usize { + // CHECK-LABEL: fn inner( + // CHECK: = {{.*}}[_0]; let buffer = &[true]; let index = index(); if buffer[index] { From 69d9369f0cffdbee26bda209dcb3beb441914405 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 20:29:47 +0000 Subject: [PATCH 20/21] FileCheck inline_shims. --- tests/mir-opt/inline/inline_shims.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/mir-opt/inline/inline_shims.rs b/tests/mir-opt/inline/inline_shims.rs index 37b0d8ed88b93..a223c2d2614b1 100644 --- a/tests/mir-opt/inline/inline_shims.rs +++ b/tests/mir-opt/inline/inline_shims.rs @@ -1,14 +1,17 @@ -// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] // EMIT_MIR inline_shims.clone.Inline.diff pub fn clone(f: fn(A, B)) -> fn(A, B) { + // CHECK-LABEL: fn clone( + // CHECK: (inlined ::clone - shim(fn(A, B))) f.clone() } // EMIT_MIR inline_shims.drop.Inline.diff pub fn drop(a: *mut Vec, b: *mut Option) { + // CHECK-LABEL: fn drop( + // CHECK: (inlined std::ptr::drop_in_place::> - shim(Some(Option))) unsafe { std::ptr::drop_in_place(a) } unsafe { std::ptr::drop_in_place(b) } } From 328192bff492d32b86004fd80f963296fb654278 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 16 Oct 2023 20:32:18 +0000 Subject: [PATCH 21/21] FileCheck transmute. --- tests/mir-opt/const_prop/transmute.rs | 23 ++++++++++++++++++- .../mir-opt/dataflow-const-prop/transmute.rs | 23 ++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs index 8f9d1e77ab4ff..99988d0599454 100644 --- a/tests/mir-opt/const_prop/transmute.rs +++ b/tests/mir-opt/const_prop/transmute.rs @@ -1,4 +1,3 @@ -// skip-filecheck // unit-test: ConstProp // compile-flags: -O --crate-type=lib // ignore-endian-big @@ -8,55 +7,77 @@ use std::mem::transmute; // EMIT_MIR transmute.less_as_i8.ConstProp.diff pub fn less_as_i8() -> i8 { + // CHECK-LABEL: fn less_as_i8( + // CHECK: _0 = const -1_i8; unsafe { transmute(std::cmp::Ordering::Less) } } // EMIT_MIR transmute.from_char.ConstProp.diff pub fn from_char() -> i32 { + // CHECK-LABEL: fn from_char( + // CHECK: _0 = const 82_i32; unsafe { transmute('R') } } // EMIT_MIR transmute.valid_char.ConstProp.diff pub fn valid_char() -> char { + // CHECK-LABEL: fn valid_char( + // CHECK: _0 = const 'R'; unsafe { transmute(0x52_u32) } } // EMIT_MIR transmute.invalid_char.ConstProp.diff pub unsafe fn invalid_char() -> char { + // CHECK-LABEL: fn invalid_char( + // CHECK: _0 = const {transmute(0x7fffffff): char}; unsafe { transmute(i32::MAX) } } // EMIT_MIR transmute.invalid_bool.ConstProp.diff pub unsafe fn invalid_bool() -> bool { + // CHECK-LABEL: fn invalid_bool( + // CHECK: _0 = const {transmute(0xff): bool}; unsafe { transmute(-1_i8) } } // EMIT_MIR transmute.undef_union_as_integer.ConstProp.diff pub unsafe fn undef_union_as_integer() -> u32 { + // CHECK-LABEL: fn undef_union_as_integer( + // CHECK: _1 = Union32 { + // CHECK: _0 = move _1 as u32 (Transmute); union Union32 { value: u32, unit: () } unsafe { transmute(Union32 { unit: () }) } } // EMIT_MIR transmute.unreachable_direct.ConstProp.diff pub unsafe fn unreachable_direct() -> ! { + // CHECK-LABEL: fn unreachable_direct( + // CHECK: [[unit:_.*]] = (); + // CHECK: move [[unit]] as Never (Transmute); let x: Never = unsafe { transmute(()) }; match x {} } // EMIT_MIR transmute.unreachable_ref.ConstProp.diff pub unsafe fn unreachable_ref() -> ! { + // CHECK-LABEL: fn unreachable_ref( + // CHECK: = const {0x1 as &Never}; let x: &Never = unsafe { transmute(1_usize) }; match *x {} } // EMIT_MIR transmute.unreachable_mut.ConstProp.diff pub unsafe fn unreachable_mut() -> ! { + // CHECK-LABEL: fn unreachable_mut( + // CHECK: = const {0x1 as &mut Never}; let x: &mut Never = unsafe { transmute(1_usize) }; match *x {} } // EMIT_MIR transmute.unreachable_box.ConstProp.diff pub unsafe fn unreachable_box() -> ! { + // CHECK-LABEL: fn unreachable_box( + // CHECK: = const Box::( let x: Box = unsafe { transmute(1_usize) }; match *x {} } diff --git a/tests/mir-opt/dataflow-const-prop/transmute.rs b/tests/mir-opt/dataflow-const-prop/transmute.rs index 16597b16083cb..02e4f1e501346 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.rs +++ b/tests/mir-opt/dataflow-const-prop/transmute.rs @@ -1,4 +1,3 @@ -// skip-filecheck // unit-test: DataflowConstProp // compile-flags: -O --crate-type=lib // ignore-endian-big @@ -8,55 +7,77 @@ use std::mem::transmute; // EMIT_MIR transmute.less_as_i8.DataflowConstProp.diff pub fn less_as_i8() -> i8 { + // CHECK-LABEL: fn less_as_i8( + // FIXME-CHECK: _0 = const -1_i8; unsafe { transmute(std::cmp::Ordering::Less) } } // EMIT_MIR transmute.from_char.DataflowConstProp.diff pub fn from_char() -> i32 { + // CHECK-LABEL: fn from_char( + // CHECK: _0 = const 82_i32; unsafe { transmute('R') } } // EMIT_MIR transmute.valid_char.DataflowConstProp.diff pub fn valid_char() -> char { + // CHECK-LABEL: fn valid_char( + // CHECK: _0 = const 'R'; unsafe { transmute(0x52_u32) } } // EMIT_MIR transmute.invalid_char.DataflowConstProp.diff pub unsafe fn invalid_char() -> char { + // CHECK-LABEL: fn invalid_char( + // CHECK: _0 = const {transmute(0x7fffffff): char}; unsafe { transmute(i32::MAX) } } // EMIT_MIR transmute.invalid_bool.DataflowConstProp.diff pub unsafe fn invalid_bool() -> bool { + // CHECK-LABEL: fn invalid_bool( + // CHECK: _0 = const {transmute(0xff): bool}; unsafe { transmute(-1_i8) } } // EMIT_MIR transmute.undef_union_as_integer.DataflowConstProp.diff pub unsafe fn undef_union_as_integer() -> u32 { + // CHECK-LABEL: fn undef_union_as_integer( + // CHECK: _1 = Union32 { + // CHECK: _0 = move _1 as u32 (Transmute); union Union32 { value: u32, unit: () } unsafe { transmute(Union32 { unit: () }) } } // EMIT_MIR transmute.unreachable_direct.DataflowConstProp.diff pub unsafe fn unreachable_direct() -> ! { + // CHECK-LABEL: fn unreachable_direct( + // CHECK: [[unit:_.*]] = (); + // CHECK: move [[unit]] as Never (Transmute); let x: Never = unsafe { transmute(()) }; match x {} } // EMIT_MIR transmute.unreachable_ref.DataflowConstProp.diff pub unsafe fn unreachable_ref() -> ! { + // CHECK-LABEL: fn unreachable_ref( + // CHECK: = const {0x1 as &Never}; let x: &Never = unsafe { transmute(1_usize) }; match *x {} } // EMIT_MIR transmute.unreachable_mut.DataflowConstProp.diff pub unsafe fn unreachable_mut() -> ! { + // CHECK-LABEL: fn unreachable_mut( + // CHECK: = const {0x1 as &mut Never}; let x: &mut Never = unsafe { transmute(1_usize) }; match *x {} } // EMIT_MIR transmute.unreachable_box.DataflowConstProp.diff pub unsafe fn unreachable_box() -> ! { + // CHECK-LABEL: fn unreachable_box( + // CHECK: = const Box::( let x: Box = unsafe { transmute(1_usize) }; match *x {} }