-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove SimplifyBranchSame MIR optimization #77706
Conversation
This optimization never had any positive impact on compile or runtime performance. It is relatively complex and used to have bugs in the past. Its implementation contains significantly more lines of code than the number of blocks it happens to optimize out during rustc build process (including all dependencies and the standard library). Remove it.
r? @lcnr (rust_highfive has picked a reviewer for you, use r? to override) |
e34140d
to
9de6df6
Compare
r? @oli-obk maybe, I personally don't know enough to tell if this is a good change |
I don't think we should remove this pass at this time. This pass is a pretty important part of the set of passes which try to optimize out no-op matches. Eventually, that will be used to remove the costs currently associated with the I'm eager to hear what @oli-obk thinks though. |
I was collecting statistics about various MIR optimizations. While building |
This was indeed the groundwork for optimizing |
I find it really concerning that the criterion for introducing and enabling MIR optimizations is having no performance impact, without having to demonstrate a positive impact (performance or otherwise). I was able to identify and minimize the rustls miscompilation introduced by SimplifyBranchSame in less than 15 minutes by examining every single mir that was changed by it (in a crate with all its dependencies). That is how rarely it applies. |
It was never intended to live on its own. It was always meant to be part of helping llvm understand |
We do have policy in this regard: rust-lang/compiler-team#319. Per that, to be enabled at The
Yes, I agree. In particular, I would like to see us draft some policy around how optimizations are taken from experimental/unsound status to run by default. |
Hmm, it fires roughly 5% more times with SimplifyArmIdentity enabled. Could you run perf? |
Sure! @bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 9de6df6 with merge 2eb0ebec12f360fedd04678259e7c7d4a4fc7686... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 2eb0ebec12f360fedd04678259e7c7d4a4fc7686 with parent 5ddef54, future comparison URL. |
Finished benchmarking try commit (2eb0ebec12f360fedd04678259e7c7d4a4fc7686): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Looking at perf results, this pass does not improve the performance, and should be disabled by default. Since you have some long term vision that includes this pass, I am closing this PR. |
This optimization never had any positive impact on compile or runtime
performance. It is relatively complex and used to have bugs in the past.
Its implementation contains significantly more lines of code than the
number of blocks it happens to optimize out during rustc build process
(including all dependencies and the standard library).
Remove it.