-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add local DSE optimization pass #94118
Conversation
…intation on single bbs.
The `coverage` test checks that all the desired optimizations are performed, while the remaining tests check that a variety of other cases are not optimized. Unfortunately, const prop makes the MIR slightly less clear than it could be, but all the intended checks are still intact.
Adding the DSE pass changed the emitted MIR for a bunch of other test. This commit blesses/fixes these changes. In some cases, this required adding some `black_box` calls to inhibit the DSE optimizations.
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
The job Click to see the possible cause of the failure (guessed by this bot)
|
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 7a30d3e with merge 60bf4a09dcb49ff672dce0a99473714e8a327a74... |
☀️ Try build successful - checks-actions |
Queued 60bf4a09dcb49ff672dce0a99473714e8a327a74 with parent b8c56fa, future comparison URL. |
Finished benchmarking commit (60bf4a09dcb49ff672dce0a99473714e8a327a74): comparison url. Summary: This benchmark run shows 2 relevant improvements 🎉 but 23 relevant regressions 😿 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
Yeah, this is probably just duplicating work that either simplify locals/LLVM are also trying to do, so the mild regression isn't terribly surprising. I'll let review take a look, and can bump this to |
I'm actually going to close this for now, I think I have a more promising idea than this. May re-open if that doesn't pan out |
This PR adds an optimization pass that eliminates stores that can be proven dead within the basic block in which they appear. The full behavior and arguments for correctness of the optimization are documented in the source.
Making this a pass of its own was almost an afterthought; I originally needed this functionality for another opt I was working. If it turns out that this is bad for perf or something, then the pass can definitely be disabled, and we can just leave the functionality in for other opts to use.
Marking as a draft because the
src/test/mir-opt/simplify-locals.rs
test is still broken under this. I could not find a way to modify that test in a way that cause simplify locals but not this optimization to fire. Does anyone have more creative ideas? Should the test just be removed? Does simplify locals need to be adjusted somehow?