diff options
author | jeffreytan81 <jeffreytan@meta.com> | 2024-10-09 16:29:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-09 16:29:39 -0700 |
commit | 61a46780d10c8f4e12c9b5496f5ca3f2cc7fba66 (patch) | |
tree | b24e481bdab3058f460c6416537ce933043b45f4 /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | a31d0b2e2bcc8c0c8907721896506c7ffd3e9502 (diff) | |
download | llvm-61a46780d10c8f4e12c9b5496f5ca3f2cc7fba66.zip llvm-61a46780d10c8f4e12c9b5496f5ca3f2cc7fba66.tar.gz llvm-61a46780d10c8f4e12c9b5496f5ca3f2cc7fba66.tar.bz2 |
Improve type lookup using .debug_names parent chain (#108907)
## Summary
This PR improves `SymbolFileDWARF::FindTypes()` by utilizing the newly
added parent chain `DW_IDX_parent` in `.debug_names`. The proposal was
originally discussed in [this
RFC](https://discourse.llvm.org/t/rfc-improve-dwarf-5-debug-names-type-lookup-parsing-speed/74151).
## Implementation
To leverage the parent chain for `SymbolFileDWARF::FindTypes()`, this PR
adds a new API: `GetTypesWithQuery` in `DWARFIndex` base class. The API
performs the same function as `GetTypes` with additional filtering using
`TypeQuery`. Since this only introduces filtering, the callback
mechanisms at all call sites remain unchanged. A default implementation
is given in `DWARFIndex` class which parses debug info and performs the
matching. In the `DebugNameDWARFIndex` override, the parent_contexts in
the `TypeQuery` is cross checked with parent chain in `.debug_names` for
for much faster filtering before fallback to base implementation for
final filtering.
Unlike the `GetFullyQualifiedType` API, which fully consumes the
`DW_IDX_parent` parent chain for exact matching, these new APIs perform
partial subset matching for type/namespace queries. This is necessary to
support queries involving anonymous or inline namespaces. For instance,
a user might request `NS1::NS2::NS3::Foo`, while the index table's
parent chain might contain `NS1::inline_NS2::NS3::Foo`, which would fail
exact matching.
## Performance Results
In one of our internal target using `.debug_names` + split dwarf.
Expanding a "this" pointer in locals view in VSCode:
94s => 48s. (Not sure why I got 94s this time instead of 70s last week).
---------
Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
0 files changed, 0 insertions, 0 deletions