rust/compiler
Matthias Krüger ddbeda1302
Rollup merge of #96090 - JakobDegen:mir-tests, r=nagisa
Implement MIR opt unit tests

This implements rust-lang/compiler-team#502 .

There's not much to say here, this implementation does everything as proposed. I also added the flag to a bunch of existing tests (mostly those to which I could add it without causing huge diffs due to changes in line numbers). Summarizing the changes to test outputs:
 - Every time an `MirPatch` is created, it adds a cleanup block to the body if it did not exist already. If this block is unused (as is usually the case), it usually gets removed soon after by some pass calling `SimplifyCFG` for unrelated reasons (in many cases this cycle happens quite a few times for a single body). We now run `SimplifyCFG` less often, so those blocks end up in some of our outputs. I looked at changing `MirPatch` to not do this, but that seemed too complicated for this PR. I may still do that in a follow-up.
 - The `InstCombine` test had set `-C opt-level=0` in its flags and so there were no storage markers. I don't really see a good motivation for doing this, so bringing it back in line with what everything else does seems correct.
 - One of the `EarlyOtherwiseBranch` tests had `UnreachableProp` running on it. Preventing that kind of thing is the goal of this feature, so this seems fine.

For the remaining tests for which this feature might be useful, we can gradually migrate them as opportunities present themselves.

In terms of documentation, I plan on submitting a PR to the rustc dev guide in the near future documenting this and other recent changes to MIR. If there's any other places to update, do let me know

r? `@nagisa`
2022-04-25 00:10:59 +02:00
..
rustc Propagate parallel_compiler feature through rustc crates. Turned off feature gives change of builded crates: 238 -> 224. 2022-03-28 08:41:12 +03:00
rustc_apfloat Addressed comments by @compiler-errors and @bjorn3 2022-03-30 17:04:46 -04:00
rustc_arena mark FIXMES for all the places found that are probably offset_from 2022-03-29 20:18:28 -04:00
rustc_ast Auto merge of #96210 - nnethercote:speed-up-TokenCursor, r=petrochenkov 2022-04-21 15:42:50 +00:00
rustc_ast_lowering Drop vis in Item. 2022-04-23 09:59:24 +02:00
rustc_ast_passes Auto merge of #95779 - cjgillot:ast-lifetimes-undeclared, r=petrochenkov 2022-04-17 12:56:19 +00:00
rustc_ast_pretty Rollup merge of #94985 - dtolnay:constattr, r=pnkfelix 2022-04-16 19:42:00 +02:00
rustc_attr Rollup merge of #94948 - jhpratt:rustc_deprecated, r=Dylan-DPC 2022-03-20 09:14:59 +01:00
rustc_borrowck Rollup merge of #96352 - marmeladema:fix-nll-lifetime-bound-suggestions, r=jackh726 2022-04-24 18:00:27 +02:00
rustc_builtin_macros Auto merge of #94468 - Amanieu:global_asm_sym, r=nagisa 2022-04-16 04:46:01 +00:00
rustc_codegen_cranelift Merge commit 'f2cdd4a78d' into sync_cg_clif-2022-04-22 2022-04-22 21:11:38 +02:00
rustc_codegen_gcc Rollup merge of #95740 - Amanieu:kreg0, r=nagisa 2022-04-19 22:57:39 +02:00
rustc_codegen_llvm debuginfo: Emit ZST struct debuginfo for unit type when CPP-like debuginfo is enabled (instead of custom basic type). 2022-04-22 14:59:35 +02:00
rustc_codegen_ssa Auto merge of #95612 - davidtwco:split-debuginfo-in-bootstrap, r=Mark-Simulacrum 2022-04-21 05:24:48 +00:00
rustc_const_eval Relax restrictions for copy operands 2022-04-22 16:45:15 -04:00
rustc_data_structures incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it. 2022-04-19 10:43:20 +02:00
rustc_driver errors: lazily load fallback fluent bundle 2022-04-13 02:44:59 +01:00
rustc_error_codes rework error messages for incorrect inherent impls 2022-03-30 11:23:58 +02:00
rustc_error_messages Rollup merge of #96029 - IsakNyberg:error-messages-fix, r=Dylan-DPC 2022-04-19 22:57:41 +02:00
rustc_errors Auto merge of #96082 - michaelwoerister:less_impl_stable_hash_via_hash, r=compiler-errors 2022-04-20 03:51:09 +00:00
rustc_expand start tracking proc-macros expansion spans in the self-profiler 2022-04-22 18:35:31 +02:00
rustc_feature Rollup merge of #94457 - jhpratt:stabilize-derive_default_enum, r=davidtwco 2022-04-15 20:50:43 +02:00
rustc_fs_util Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_graphviz eplace usages of vec![].into_iter with [].into_iter 2022-01-09 14:09:25 +11:00
rustc_hir Drop vis in Item. 2022-04-23 09:59:24 +02:00
rustc_hir_pretty Stop pretty-printing HIR visibility. 2022-04-23 09:55:25 +02:00
rustc_incremental Rollup merge of #95434 - cjgillot:dump-dep-kind, r=oli-obk 2022-04-21 20:55:18 +02:00
rustc_index Spellchecking compiler comments 2022-03-30 15:14:15 -04:00
rustc_infer Improve span for consider adding an explicit lifetime bound suggestions under NLL 2022-04-24 09:34:50 +02:00
rustc_interface Rollup merge of #96090 - JakobDegen:mir-tests, r=nagisa 2022-04-25 00:10:59 +02:00
rustc_lexer Reduce max hash in raw strings from u16 to u8 2022-03-23 22:13:55 +01:00
rustc_lint Fix lints. 2022-04-23 23:01:19 +02:00
rustc_lint_defs Auto merge of #96082 - michaelwoerister:less_impl_stable_hash_via_hash, r=compiler-errors 2022-04-20 03:51:09 +00:00
rustc_llvm Add codegen for global_asm! sym operands 2022-04-15 14:36:30 +01:00
rustc_log Make rustc_log doc test runnable 2022-01-03 22:31:56 -08:00
rustc_macros macros: update doc comment for diagnostic derive 2022-04-21 04:22:18 +01:00
rustc_metadata Add support for nounused --extern flag 2022-04-23 23:31:54 -07:00
rustc_middle Auto merge of #93970 - cjgillot:novis, r=petrochenkov 2022-04-23 22:25:51 +00:00
rustc_mir_build Rollup merge of #93313 - tmiasko:uninhabited, r=tmandry 2022-04-20 18:26:01 +02:00
rustc_mir_dataflow Add new MutatatingUseContexts for deinit and SetDiscriminant 2022-04-11 09:26:26 -04:00
rustc_mir_transform Rollup merge of #96090 - JakobDegen:mir-tests, r=nagisa 2022-04-25 00:10:59 +02:00
rustc_monomorphize Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkov 2022-04-19 14:43:21 +02:00
rustc_parse Introduced Cursor::next_with_spacing_ref. 2022-04-21 13:49:40 +10:00
rustc_parse_format Spellchecking compiler comments 2022-03-30 15:14:15 -04:00
rustc_passes Fix lints. 2022-04-23 23:01:19 +02:00
rustc_plugin_impl replace dynamic library module with libloading 2021-12-06 12:03:47 -05:00
rustc_privacy Compute has_pub_restricted in the resolver. 2022-04-23 23:03:18 +02:00
rustc_query_impl Stop using CRATE_DEF_INDEX. 2022-04-17 12:14:42 +02:00
rustc_query_system Remove NodeIdHashingMode. 2022-04-12 19:59:32 +02:00
rustc_resolve Compute has_pub_restricted in the resolver. 2022-04-23 23:03:18 +02:00
rustc_save_analysis Drop vis in ImplItem. 2022-04-23 09:57:00 +02:00
rustc_serialize errors: implement fallback diagnostic translation 2022-04-05 07:01:02 +01:00
rustc_session Rollup merge of #96090 - JakobDegen:mir-tests, r=nagisa 2022-04-25 00:10:59 +02:00
rustc_span extend EventArgRecorder into span-aware SpannedEventArgRecorder 2022-04-22 18:06:21 +02:00
rustc_symbol_mangling Auto merge of #95655 - kckeiks:create-hir-crate-items-query, r=cjgillot 2022-04-17 08:06:53 +00:00
rustc_target Rollup merge of #95740 - Amanieu:kreg0, r=nagisa 2022-04-19 22:57:39 +02:00
rustc_trait_selection Rollup merge of #94493 - oribenshir:feature/ISSUE-78543_async_fn_in_foreign_crate_diag_2, r=davidtwco 2022-04-19 14:43:15 +02:00
rustc_traits Remove opaque type obligation and just register opaque types as they are encountered. 2022-03-28 16:57:45 +00:00
rustc_ty_utils Avoid accessing HIR from MIR queries. 2022-04-10 13:08:36 +02:00
rustc_type_ir Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk" 2022-03-28 16:27:14 +00:00
rustc_typeck Fix suggestion for _ on return type for fn in impl for Trait 2022-04-24 14:50:48 -07:00