Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make validate_mir ensure the final MIR for all bodies #128612

Closed

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Aug 3, 2024

A lot of the crashes tests use -Zpolymorphize or -Zdump-mir for their side effect of computing the optimized_mir for all bodies, which will uncover bugs with late MIR passes like the inliner. I don't like having all these tests depend on -Zpolymorphize (or other hacky ways) for no reason, so this PR extends the -Zvalidate-mir flag to ensure optimized_mir/mir_for_ctfe for all body owners during the analysis phase.

Two thoughts:

  1. This could be moved later in the compilation pipeline I guess? I don't really think it matters, though.
  2. This could alternatively be expressed using a new flag, though I don't necessarily see much value in separating these.

For example, #128171 could have used this flag, in the tests/ui/polymorphization/inline-incorrect-early-bound.rs.

r? mir

@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 Aug 3, 2024
@compiler-errors
Copy link
Member Author

hi @rust-lang/wg-mir-opt anyone got strong feelings abt this?

@compiler-errors
Copy link
Member Author

For the record, I have a fix for #128601 but want to put up better test that doesn't need the polymorphize flag to trigger it.

@compiler-errors
Copy link
Member Author

Ah, let me just use the instance mir instead of opt mir, since we have some const body owners.

@rust-log-analyzer

This comment has been minimized.

@matthiaskrgr
Copy link
Member

this is like -Clink-dead-code but unused/unrechable mir?

@compiler-errors compiler-errors force-pushed the validate-mir-opt-mir branch 2 times, most recently from 74dace7 to 470ada2 Compare August 3, 2024 19:18
@compiler-errors compiler-errors changed the title Make validate_mir ensure optimized MIR for all bodies Make validate_mir ensure the final MIR for all bodies Aug 3, 2024
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

LGTM, r=me unless you want to wait for others to chime in with an opinion

@compiler-errors
Copy link
Member Author

@bors r=davidtwco rollup

@bors
Copy link
Contributor

bors commented Aug 8, 2024

📌 Commit 470ada2 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors 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 Aug 8, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 8, 2024
…ir, r=davidtwco

Make `validate_mir` ensure the final MIR for all bodies

A lot of the crashes tests use `-Zpolymorphize` or `-Zdump-mir` for their side effect of computing the `optimized_mir` for all bodies, which will uncover bugs with late MIR passes like the inliner. I don't like having all these tests depend on `-Zpolymorphize` (or other hacky ways) for no reason, so this PR extends the `-Zvalidate-mir` flag to ensure `optimized_mir`/`mir_for_ctfe` for all body owners during the analysis phase.

Two thoughts:
1. This could be moved later in the compilation pipeline I guess? I don't really think it matters, though.
1. This could alternatively be expressed using a new flag, though I don't necessarily see much value in separating these.

For example, rust-lang#128171 could have used this flag, in the `tests/ui/polymorphization/inline-incorrect-early-bound.rs`.

r? mir
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 8, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#128306 (Update NonNull::align_offset quarantees)
 - rust-lang#128612 (Make `validate_mir` ensure the final MIR for all bodies)
 - rust-lang#128648 (Add regression test)
 - rust-lang#128791 (Don't implement `AsyncFn` for `FnDef`/`FnPtr` that wouldnt implement `Fn`)
 - rust-lang#128795 (Update E0517 message to reflect RFC 2195.)
 - rust-lang#128825 (rm `declared_features` field in resolver)
 - rust-lang#128826 (Only suggest `#[allow]` for `--warn` and `--deny` lint level flags)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 8, 2024
…ir, r=davidtwco

Make `validate_mir` ensure the final MIR for all bodies

A lot of the crashes tests use `-Zpolymorphize` or `-Zdump-mir` for their side effect of computing the `optimized_mir` for all bodies, which will uncover bugs with late MIR passes like the inliner. I don't like having all these tests depend on `-Zpolymorphize` (or other hacky ways) for no reason, so this PR extends the `-Zvalidate-mir` flag to ensure `optimized_mir`/`mir_for_ctfe` for all body owners during the analysis phase.

Two thoughts:
1. This could be moved later in the compilation pipeline I guess? I don't really think it matters, though.
1. This could alternatively be expressed using a new flag, though I don't necessarily see much value in separating these.

For example, rust-lang#128171 could have used this flag, in the `tests/ui/polymorphization/inline-incorrect-early-bound.rs`.

r? mir
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 8, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#128306 (Update NonNull::align_offset quarantees)
 - rust-lang#128612 (Make `validate_mir` ensure the final MIR for all bodies)
 - rust-lang#128648 (Add regression test)
 - rust-lang#128749 (Mark `{f32,f64}::{next_up,next_down,midpoint}` inline)
 - rust-lang#128795 (Update E0517 message to reflect RFC 2195.)
 - rust-lang#128825 (rm `declared_features` field in resolver)
 - rust-lang#128826 (Only suggest `#[allow]` for `--warn` and `--deny` lint level flags)

r? `@ghost`
`@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 8, 2024
Rollup merge of rust-lang#128612 - compiler-errors:validate-mir-opt-mir, r=davidtwco

Make `validate_mir` ensure the final MIR for all bodies

A lot of the crashes tests use `-Zpolymorphize` or `-Zdump-mir` for their side effect of computing the `optimized_mir` for all bodies, which will uncover bugs with late MIR passes like the inliner. I don't like having all these tests depend on `-Zpolymorphize` (or other hacky ways) for no reason, so this PR extends the `-Zvalidate-mir` flag to ensure `optimized_mir`/`mir_for_ctfe` for all body owners during the analysis phase.

Two thoughts:
1. This could be moved later in the compilation pipeline I guess? I don't really think it matters, though.
1. This could alternatively be expressed using a new flag, though I don't necessarily see much value in separating these.

For example, rust-lang#128171 could have used this flag, in the `tests/ui/polymorphization/inline-incorrect-early-bound.rs`.

r? mir
@matthiaskrgr
Copy link
Member

somehow github does not recognize this as merged, closing manually..

@compiler-errors
Copy link
Member Author

compiler-errors commented Aug 8, 2024

@matthiaskrgr: it's because bors merged an old version :(

Since you merge a lot of PRs and are likely to catch this: When you close PRs that GH doesn't mention, can you check that the version that is pushed is the one that shows up in the bors approval? #128612 (comment)

@compiler-errors compiler-errors deleted the validate-mir-opt-mir branch August 8, 2024 21:57
@matthiaskrgr
Copy link
Member

oh wut? :O

usually it would show the commits being added after the rollup being mentioned in the pr history?

@matthiaskrgr
Copy link
Member

oh I see, there are some comments in this pr that were not in the rollup...

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 8, 2024
…ir, r=matthiaskrgr

Add comment that bors did not see pushed before it merged

In rust-lang#128612, bors merged 470ada2 instead of 1e07c19.

This means it dropped a useful comment I added, and a stage rename that is more descriptive.
@bors
Copy link
Contributor

bors commented Aug 8, 2024

☔ The latest upstream changes (presumably #128835) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 9, 2024
Rollup merge of rust-lang#128851 - compiler-errors:validate-mir-opt-mir, r=matthiaskrgr

Add comment that bors did not see pushed before it merged

In rust-lang#128612, bors merged 470ada2 instead of 1e07c19.

This means it dropped a useful comment I added, and a stage rename that is more descriptive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

6 participants