Uh oh!
There was an error while loading. Please reload this page.
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.
rust-highfive
commented
Oct 8, 2020
r? @lcnr (rust_highfive has picked a reviewer for you, use r? to override) |
e34140d to
9de6df6Comparelcnr
commented
Oct 8, 2020
r? @oli-obk maybe, I personally don't know enough to tell if this is a good change |
wesleywiser
commented
Oct 8, 2020
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. |
tmiasko
commented
Oct 8, 2020
I was collecting statistics about various MIR optimizations. While building |
oli-obk
commented
Oct 9, 2020
This was indeed the groundwork for optimizing |
tmiasko
commented
Oct 9, 2020
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. |
oli-obk
commented
Oct 9, 2020
It was never intended to live on its own. It was always meant to be part of helping llvm understand |
wesleywiser
commented
Oct 9, 2020
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. |
tmiasko
commented
Oct 9, 2020
Hmm, it fires roughly 5% more times with SimplifyArmIdentity enabled. Could you run perf? |
wesleywiser
commented
Oct 9, 2020
Sure! @bors try @rust-timer queue |
rust-timer
commented
Oct 9, 2020
Awaiting bors try build completion |
bors
commented
Oct 9, 2020
⌛ Trying commit 9de6df6 with merge 2eb0ebec12f360fedd04678259e7c7d4a4fc7686... |
bors
commented
Oct 9, 2020
☀️ Try build successful - checks-actions, checks-azure |
rust-timer
commented
Oct 9, 2020
Queued 2eb0ebec12f360fedd04678259e7c7d4a4fc7686 with parent 5ddef54, future comparison URL. |
rust-timer
commented
Oct 10, 2020
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 |
tmiasko
commented
Oct 10, 2020
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.