-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Disable SimplifyToExp in MatchBranchSimplification #124156
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
This one is easy to review. :) |
tests/mir-opt/switch_to_self.rs
Outdated
@@ -1,3 +1,4 @@ | |||
//@ unit-test: MatchBranchSimplification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay to change it for unit testing since the MIR output is the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised the test didn't already have this declaration, if it was meant to test a particular pass.
But also, unit-test
is a very non-self-explaining name for "please run only and specifically this pass".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the default compiler flag is -O
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I know it doesn't need the declaration to test default-on opts. But when a test tests a specific opt, wouldn't it be good to add that declaration even if it is not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are probably similar test cases in the repository. ;) Perhaps there was no support for unit testing in the past?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For fixing the miscompilation, I hope to make as few changes as possible. This can go into a separate PR now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah sure this was more of a general comment. Sorry for being unclear.
tests/mir-opt/issues/issue_75439.rs
Outdated
@@ -1,9 +1,10 @@ | |||
//@ unit-test: MatchBranchSimplification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as tests/mir-opt/switch_to_self.rs
.
@@ -1,4 +1,5 @@ | |||
//@ unit-test: InstSimplify | |||
//@ should-fail Broken due to https://github.com/rust-lang/rust/issues/124150. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this affect this test, when #120614 did not change this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already accomplished by the existing SimplifyToIf
. I just did a refactor in #120614.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so this is not equivalent to reverting #120614, it disables more than that.
In that case, hard for me to say whether it's appropriate to disable the entire pass.
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Disable MatchBranchSimplification Due to the miscompilation mentioned in rust-lang#124150, We need to disable MatchBranchSimplification temporarily. To fully resolve this issue, my plan is: 1. Disable MatchBranchSimplification (this PR). 2. Remove all potentially unclear transforms in rust-lang#124122. 3. Gradually add back the removed transforms (possibly multiple PRs). r? `@Nilstrieb` or `@oli-obk`
This comment has been minimized.
This comment has been minimized.
2d3178b
to
ca30ce6
Compare
Some changes occurred in coverage tests. cc @Zalathar |
If the perf result is unacceptable, I would consider revert the PR or just disable SimplifyToExp. |
If there's an easy way to disable just the affected part of this pass, then let's just do that? |
This comment has been minimized.
This comment has been minimized.
I can write the following code: if tcx.sess.opts.unstable_opts.unsound_mir_opts
&& SimplifyToExp::default().simplify(tcx, body, bb_idx, param_env).is_some()
{
should_cleanup = true;
continue;
} But I've never seen code like this before. Edit: The code below works fine for me. if false && SimplifyToExp::default().simplify(tcx, body, bb_idx, param_env).is_some()
{
should_cleanup = true;
continue;
} |
ca30ce6
to
86a51cd
Compare
This comment has been minimized.
This comment has been minimized.
86a51cd
to
e2f8ec6
Compare
Why not use |
e2f8ec6
to
b52be28
Compare
I'm just worried it might be a bit weird because I've never seen this kind of code before. |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a61b14d): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 670.395s -> 670.71s (0.05%) |
Due to the miscompilation mentioned in #124150, We need to disable MatchBranchSimplification temporarily.
To fully resolve this issue, my plan is:
r? @Nilstrieb or @oli-obk