Uh oh!
There was an error while loading. Please reload this page.
Add an intermediate representation to exhaustiveness checking - #88950
Conversation
3fc15cc to
1b0cd5fCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
camelid
commented
Sep 15, 2021
Interesting, |
Nadrieril
commented
Sep 15, 2021
It's weird though, because patterns used to be lowered already via a |
1b0cd5f to
288be0cCompareNadrieril
commented
Sep 17, 2021
Ok, some progress. My local measurements differ quite a bit from perf here, so I want to see what it says now. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
288be0c to
180204fCompareNadrieril
commented
Sep 17, 2021
Huh ok I found the main issue; commit @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Nadrieril
commented
Sep 25, 2021
Ohh I can trivialize the terrible mess that was @bors try @rust-timer queue |
rust-timer
commented
Sep 25, 2021
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
bors
commented
Sep 25, 2021
⌛ Trying commit b7e358e with merge 86bbc6573b2248ce60968ba6b29dd56dc4ac80c8... |
Nadrieril
commented
Sep 25, 2021
@varkor remember the mess I introduced to solve #80632? It's all in this cute function now https://github.com/Nadrieril/rust/blob/b7e358ee17a5794603b2324858de078c4586acfc/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1577-L1586 ! 7 lines of this do the job of about 250 lines of convoluted |
bors
commented
Sep 26, 2021
☀️ Try build successful - checks-actions |
rust-timer
commented
Sep 26, 2021
Queued 86bbc6573b2248ce60968ba6b29dd56dc4ac80c8 with parent addb4da, future comparison URL. |
rust-timer
commented
Sep 26, 2021
Finished benchmarking commit (86bbc6573b2248ce60968ba6b29dd56dc4ac80c8): comparison url. Summary: This change led to large relevant mixed results 🤷 in compiler performance.
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 |
oli-obk
commented
Sep 28, 2021
😆 I'm getting to it right now |
oli-obk
commented
Sep 28, 2021
r=me unless you want to keep investigating the stress test perf regression |
Nadrieril
commented
Sep 28, 2021
Yay thanks! Most (1%) of the regression comes from the last commit, presumably the part where we retraverse all the patterns. Since that didn't affect the more realistic benchmarks, and no real match has 8000 arms, I believe that retraversing the patterns takes negligible time in real cases. So I'll ignore that 1%. @bors r=oli-obk |
bors
commented
Sep 28, 2021
📌 Commit b7e358e has been approved by |
bors
commented
Sep 29, 2021
DevinR528
commented
Sep 29, 2021
Just want to second how much more readable the code is without |
This comment has been minimized.
This comment has been minimized.
bors
commented
Sep 29, 2021
☀️ Test successful - checks-actions |
rust-timer
commented
Sep 29, 2021
Finished benchmarking commit (6df1d82): comparison url. Summary: This change led to very large relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
The exhaustiveness checking algorithm keeps deconstructing patterns into a
Constructorand someFields, but does so a bit all over the place. This PR introduces a new representation for patterns that already has that information, so we only compute it once at the start.I find this makes code easier to follow. In particular
DeconstructedPat::specializeis a lot simpler than what happened before, and more closely matches the description of the algorithm. I'm also hoping this could help for the project of librarifying exhaustiveness for rust_analyzer since it decouples the algorithm fromrustc_middle::Pat.