compiler: Don't mark SingleUseConsts MIR pass as "required for soundness"#152729
Open
Enselic wants to merge 1 commit intorust-lang:mainfrom
Open
compiler: Don't mark SingleUseConsts MIR pass as "required for soundness"#152729Enselic wants to merge 1 commit intorust-lang:mainfrom
SingleUseConsts MIR pass as "required for soundness"#152729Enselic wants to merge 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Collaborator
|
rustbot has assigned @dingxiangfei2009. Use Why was this reviewer chosen?The reviewer was selected based on:
|
2 tasks
This comment has been minimized.
This comment has been minimized.
…dness" Because: * Something like it did not exist before PR 107404 * That it is not run our mir-opt-level 0 indicates that it is not required for soundness * Its `MirPass::can_be_overridden()` is unchanged and thus returns true, indicating that it is not a required MIR pass. * No test fails in PR 151426 that stops enabling by default in non-optimized builds As can be seen from the updated test `tests/mir-opt/optimize_none.rs`, this means that `#[optimize(none)]` functions become even less optimized. As expected and as desired.
ef294be to
52b19f7
Compare
Contributor
|
@bors r+ |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I don't think this MIR pass is required for soundness. The reasons are:
SingleUseConsts(see AddSingleUseConstsmir-opt pass #125910 for the switch).#[optimize(none)]#128657 (comment) we can conclude it is not required for soundness since it has only ever run on MIR opt level > 0.MirPass::can_be_overridden()is unchanged and thus returnstrue, indicating that it is not a required MIR pass.mir_opt_level > 1forSingleUseConstsMIR pass #151426 which stops enabling it by default in non-optimized builds.As shown in the updated test
tests/mir-opt/optimize_none.rs,#[optimize(none)]functions become even less optimized, as expected and desired.Unblocks #151426.