rust/compiler/rustc_mir_transform/src
bors bdaa901049 Auto merge of #91475 - ecstatic-morse:mir-pass-manager3, r=oli-obk
Add a MIR pass manager (Taylor's Version)

The final draft of #91386 and #77665.

While the compile-time constraints in #91386 are cool, I decided on a more minimal approach for now. I want to explore phase constraints and maybe relative-ordering constraints in the future, though. This should preserve existing behavior **exactly** (please let me know if it doesn't) while making the following changes to the way we organize things today:

- Each `MirPhase` now corresponds to a single MIR pass. `run_passes` is not responsible for listing the correct MIR phase.
- `run_passes` no longer silently skips passes if the declared MIR phase is greater than or equal to the body's. This has bitten me multiple times. If you want this behavior, you can always branch on `body.phase` yourself.
- If your pass is solely to emit errors, you can use the `MirLint` interface instead, which gets a shared reference to `Body` instead of a mutable one. By differentiating the two, I hope to make it clearer in the short term where lints belong in the pipeline. In the long term perhaps we could enforce this at compile-time?
- MIR is no longer dumped for passes that aren't enabled, or for lints.

I tried to check that `-Zvalidate` still works correctly, since the MIR phase is now updated as soon as the associated pass is done, instead of at the end of all the passes in `run_passes`. However, it looks like `-Zvalidate` is broken with current nightlies anyways 😢 (it spits out a bunch of errors).

cc `@oli-obk` `@wesleywiser`

r? rust-lang/wg-mir-opt
2021-12-05 03:41:18 +00:00
..
coverage Update passes with new interface 2021-12-02 17:31:38 -08:00
inline Move rustc_mir::transform to rustc_mir_transform. 2021-09-07 00:43:14 +02:00
abort_unwinding_calls.rs Treat drop_in_place as nounwind with -Z panic-in-drop=abort 2021-09-10 14:18:15 +01:00
add_call_guards.rs Move rustc_mir::transform to rustc_mir_transform. 2021-09-07 00:43:14 +02:00
add_moves_for_packed_drops.rs Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
add_retag.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
check_const_item_mutation.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
check_packed_ref.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
check_unsafety.rs Add initial AST and MIR support for unwinding from inline assembly 2021-12-03 23:51:46 +01:00
cleanup_post_borrowck.rs Move rustc_mir::transform to rustc_mir_transform. 2021-09-07 00:43:14 +02:00
const_debuginfo.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
const_goto.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
const_prop.rs Auto merge of #91475 - ecstatic-morse:mir-pass-manager3, r=oli-obk 2021-12-05 03:41:18 +00:00
deaggregator.rs Move rustc_mir::transform to rustc_mir_transform. 2021-09-07 00:43:14 +02:00
deduplicate_blocks.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
dest_prop.rs Auto merge of #91475 - ecstatic-morse:mir-pass-manager3, r=oli-obk 2021-12-05 03:41:18 +00:00
dump_mir.rs Inline on_mir_pass and add inline to dump_mir 2021-10-14 15:26:59 -05:00
early_otherwise_branch.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
elaborate_drops.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
function_item_references.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
generator.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
inline.rs Auto merge of #91475 - ecstatic-morse:mir-pass-manager3, r=oli-obk 2021-12-05 03:41:18 +00:00
instcombine.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
lib.rs Don't "simplify" during optimizations if optimizations are disabled 2021-12-02 17:31:38 -08:00
lower_intrinsics.rs Introduce NullOp::AlignOf 2021-09-13 00:08:35 +01:00
lower_slice_len.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
marker.rs Add pass for simple phase change 2021-12-02 17:31:38 -08:00
match_branches.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
multiple_return_terminators.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
normalize_array_len.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
nrvo.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
pass_manager.rs Don't "simplify" during optimizations if optimizations are disabled 2021-12-02 17:31:38 -08:00
remove_false_edges.rs Separate RemoveFalseEdges from SimplifyBranches 2021-11-30 17:14:48 -08:00
remove_noop_landing_pads.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
remove_storage_markers.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
remove_uninit_drops.rs Add RemoveUninitDrops MIR pass 2021-11-30 17:25:30 -08:00
remove_unneeded_drops.rs Add rationale for RemoveUnneededDrops 2021-11-30 17:25:30 -08:00
remove_zsts.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
required_consts.rs Move rustc_mir::transform to rustc_mir_transform. 2021-09-07 00:43:14 +02:00
reveal_all.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
separate_const_switch.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
shim.rs Skip shim passes if they've already been run 2021-12-02 17:31:38 -08:00
simplify.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
simplify_branches.rs Separate RemoveFalseEdges from SimplifyBranches 2021-11-30 17:14:48 -08:00
simplify_comparison_integral.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
simplify_try.rs Disable SimplifyBranchSame optimization for now 2021-10-03 22:58:24 +02:00
uninhabited_enum_branching.rs Update passes with new interface 2021-12-02 17:31:38 -08:00
unreachable_prop.rs Update passes with new interface 2021-12-02 17:31:38 -08:00