-
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
debuginfo: Simplify TypeMap used during LLVM debuginfo generation. #93644
debuginfo: Simplify TypeMap used during LLVM debuginfo generation. #93644
Conversation
2c3bdfb
to
334c5d7
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 334c5d7 with merge 5bd0fa171f55db4cf16549b05876f000099019b7... |
☀️ Try build successful - checks-actions |
Queued 5bd0fa171f55db4cf16549b05876f000099019b7 with parent 4e8fb74, future comparison URL. |
Finished benchmarking commit (5bd0fa171f55db4cf16549b05876f000099019b7): comparison url. Summary: This benchmark run did not return any relevant results. 20 results were found to be statistically significant but too small to be relevant. 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. @bors rollup=never |
334c5d7
to
7746f15
Compare
Let's see what performance looks like without the small-string optimization. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 7746f15 with merge 67817846bea0a55c9b9a3b46cb3c92d4a3b4239e... |
☀️ Try build successful - checks-actions |
Queued 67817846bea0a55c9b9a3b46cb3c92d4a3b4239e with parent 926e784, future comparison URL. |
Finished benchmarking commit (67817846bea0a55c9b9a3b46cb3c92d4a3b4239e): comparison url. Summary: This benchmark run did not return any relevant results. 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. @bors rollup=never |
Looks like the small-string optimization is not needed for keeping performance stable. Better to look into that separately. This should be ready to review now. r? rust-lang/compiler |
I think someone from @rust-lang/wg-llvm should probably look over it |
(assigned myself as a secondary reviewer so that it falls into my review queue) |
Maybe @wesleywiser can review this as part of rust-lang/compiler-team#482. |
7746f15
to
e72e639
Compare
81030fd
to
cd472b4
Compare
This comment has been minimized.
This comment has been minimized.
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.
r=me
r? @wesleywiser |
…address review comments.
cd472b4
to
bb2059f
Compare
Thanks for the review, @wesleywiser! @bors r=wesleywiser |
📌 Commit bb2059f has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (9b2a465): comparison url. Summary: This benchmark run shows 4 relevant improvements 🎉 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
…ctor, r=wesleywiser debuginfo: Refactor debuginfo generation for types This PR implements the refactoring of the `rustc_codegen_llvm::debuginfo::metadata` module as described in MCP rust-lang/compiler-team#482. In particular it - changes names to use `di_node` instead of `metadata` - uniformly names all functions that build new debuginfo nodes `build_xyz_di_node` - renames `CrateDebugContext` to `CodegenUnitDebugContext` (which is more accurate) - removes outdated parts from `compiler/rustc_codegen_llvm/src/debuginfo/doc.md` - moves `TypeMap` and functions that work directly work with it to a new `type_map` module - moves enum related builder functions to a new `enums` module - splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate - uses `SmallVec` instead of `Vec` in many places - removes the old infrastructure for dealing with recursion cycles (`create_and_register_recursive_type_forward_declaration()`, `RecursiveTypeDescription`, `set_members_of_composite_type()`, `MemberDescription`, `MemberDescriptionFactory`, `prepare_xyz_metadata()`, etc) - adds `type_map::build_type_with_children()` as a replacement for dealing with recursion cycles - adds many (doc-)comments explaining what's going on - changes cpp-like naming for C-Style enums so they don't get a `enum$<...>` name (because the NatVis visualizer does not apply to them) - fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields - changes cpp-like naming for generator enums so that NatVis works for them - changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it The following could be done in subsequent PRs: - add caching for `closure_saved_names_of_captured_variables` - add caching for `generator_layout_and_saved_local_names` - fix inconsistent handling of what is considered a C-style enum wrt to debuginfo - rename `metadata` module to `types` - move common generator fields to front instead of appending them This PR is based on rust-lang#93644 which is not merged yet. Right now, the changes are all done in one big commit. They could be split into smaller commits but hopefully the list of changes above makes it tractable to review them as a single commit too. For now: r? `@ghost` (let's see if this affects compile times)
This PR simplifies the TypeMap that is used in
rustc_codegen_llvm::debuginfo::metadata
. It was unnecessarily complicated because it was originally implemented when types were not yet normalized before codegen. So it did it's own normalization and kept track of multiple unnormalized types being mapped to a single unique id.This PR is based on #93503, which is not merged yet.
The PR also removes the arena used for allocating string ids and instead uses
InlinableString
from the inlinable_string crate. That might not be the best choice, since that crate does not seem to be very actively maintained. The flexible-string crate would be an alternative.r? @ghost