[DWARF] Avoid reprocessing types repeated in every compilation unit - #8406
Open
bdash wants to merge 4 commits into
Open
[DWARF] Avoid reprocessing types repeated in every compilation unit#8406bdash wants to merge 4 commits into
bdash wants to merge 4 commits into
Conversation
Every anonymous subroutine type produces the same placeholder regardless of its return type, because a named type reference takes only its class, width and alignment from its target, and function types set neither.
A placeholder is fully determined by its name plus the class, structure variant, width and alignment of its target, which are the only things `InitNamedType` reads from it.
The name was recorded after the branches that commit it, so it was also recorded on the two paths that log an error and commit nothing. That dated from when there was a single commit path and the two were the same event. A name left behind by a failed commit made a later type of that name get deconflicted against something that was never stored.
negasora
requested changes
Aug 12, 2026
…ration Debug info describes a type in every compilation unit that includes its header. Committing each occurrence made the core walk the whole member tree and re-resolve every named reference in it. Only the first occurrence is committed now, and later ones describing the same definition are skipped. A typedef's own type is the self-referential placeholder that stands in for it while its children are built, so the comparison uses the target that gets committed instead.
bdash
force-pushed
the
test_dwarf_type_dedup
branch
from
August 12, 2026 21:48
b10ca94 to
30df27f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Placeholders are built once per type rather than per declaration, and a definition already committed under its name is not committed again.
This decreases the number of types that the DWARF processor attempts to define on the view by two orders of magnitudes in some cases. Previously the duplicates were discarded by core within
DefineTypes, but not before expensive work had been performed on each submitted type.