Skip to content

Remove the dummy PreCodegen mir-opt pass, and use runtime-optimized instead#156524

Open
Zalathar wants to merge 3 commits into
rust-lang:mainfrom
Zalathar:no-pre-codegen
Open

Remove the dummy PreCodegen mir-opt pass, and use runtime-optimized instead#156524
Zalathar wants to merge 3 commits into
rust-lang:mainfrom
Zalathar:no-pre-codegen

Conversation

@Zalathar
Copy link
Copy Markdown
Member

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, #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)

This function doesn't have an obvious home, but there's little reason for it to
be in mir-transform, and having it in `rustc_driver_impl::pretty` at least puts
it near other callers of `write_mir_pretty`.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 13, 2026

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 13, 2026
@rust-log-analyzer

This comment has been minimized.

Zalathar added 2 commits May 13, 2026 15:40
MIR dumped before/after the dummy `PreCodegen` pass should be identical to MIR
dumped after the phase transition to `runtime-optimized`.
This dummy pass is not needed, because the `runtime-optimized` phase transition
can be used to dump the final pre-codegen MIR.
Copy link
Copy Markdown
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with ci happy

View changes since this review

@Zalathar
Copy link
Copy Markdown
Member Author

PR CI is green.

@bors r=oli-obk

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 13, 2026

📌 Commit 281ccf8 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 13, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 13, 2026
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)
rust-bors Bot pushed a commit that referenced this pull request May 13, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #156472 (Add support for Zprint-codegen-stats-json)
 - #156504 (bootstrap: remap windows-style OUT_DIR paths)
 - #156513 (miri subtree update)
 - #156524 (Remove the dummy `PreCodegen` mir-opt pass, and use `runtime-optimized` instead)
 - #156325 (Don't treat const param default as projection)
rust-bors Bot pushed a commit that referenced this pull request May 13, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #156472 (Add support for Zprint-codegen-stats-json)
 - #156504 (bootstrap: remap windows-style OUT_DIR paths)
 - #156513 (miri subtree update)
 - #156524 (Remove the dummy `PreCodegen` mir-opt pass, and use `runtime-optimized` instead)
 - #156325 (Don't treat const param default as projection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants