Uh oh!
There was an error while loading. Please reload this page.
Clarify the role of the PreCodegen dummy pass - #156358
Conversation
rustbot
commented
May 9, 2026
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
rustbot
commented
May 9, 2026
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
mati865
commented
May 11, 2026
I'm not familiar with that area, so the changes look neutral to me. Perhaps somebody familiar with the area should review it? @bors r? rust-lang/wg-mir-opt |
Unknown command "r?". Run |
rustbot
commented
May 11, 2026
Error: Parsing assign command in comment failed: ...'commands. Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip. |
This comment has been minimized.
This comment has been minimized.
This function doesn't have an obvious home, but there's little reason for it to be in `rustc_mir_transform`, and having it in `rustc_driver_impl::pretty` at least puts it near other callers of `write_mir_pretty`.
rustbot
commented
May 11, 2026
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| &dump_mir::Marker("PreCodegen"), | ||
| // Dummy pass to allow dumping the final pre-codegen MIR for testing/debugging. | ||
| // This must be the final pass! | ||
| &marker::PreCodegen, |
There was a problem hiding this comment.
I think the name should still include somewhere that this pass just dumps
cjgillot
commented
May 11, 2026
Is this pass still useful ? We now dump a file called |
Zalathar
commented
May 12, 2026
We have a bunch of mir-opt tests that currently mention PreCodegen, but if those can all be converted to use runtime-optimized then we should potentially be able to just remove PreCodegen. |
Zalathar
commented
May 13, 2026
Based on #156358 (comment) I have filed #156524 as an alternative to this PR. That PR migrates from PreCodegen to runtime-optimized, and then removes PreCodegen entirely. |
Remove the dummy `PreCodegen` mir-opt pass, and use `runtime-optimized` instead - Alternative to rust-lang#156358. The `PreCodegen` pass doesn't do anything on its own; it was only serving as a marker to allow `-Zdump-mir` and mir-opt tests to easily dump the final MIR just before codegen. However, rust-lang#156358 (comment) pointed out that the `runtime-optimized` phase transition should dump the same MIR, so there shouldn't be any need for a separate *PreCodegen* pass. --- r? oli-obk (or compiler)
Remove the dummy `PreCodegen` mir-opt pass, and use `runtime-optimized` instead - Alternative to rust-lang/rust#156358. The `PreCodegen` pass doesn't do anything on its own; it was only serving as a marker to allow `-Zdump-mir` and mir-opt tests to easily dump the final MIR just before codegen. However, rust-lang/rust#156358 (comment) pointed out that the `runtime-optimized` phase transition should dump the same MIR, so there shouldn't be any need for a separate *PreCodegen* pass. --- r? oli-obk (or compiler)
The existing comments for this pass are somewhat confusing.
The
PreCodegenpass does nothing by itself. It exists so that-Zdump-mir(and mir-opt tests) can easily dump the final pre-codegen MIR, by dumping the input or output of PreCodegen, which happens to be run after all other passes are finished.