diff options
author | David Blaikie <dblaikie@gmail.com> | 2017-07-30 08:12:07 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2017-07-30 08:12:07 +0000 |
commit | ebac0b9c62a26fcfc91f448f1ab36db6215feb57 (patch) | |
tree | 5a33a72ea2e61aeef2983c5e52577d120f5b1f9d /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | |
parent | 4b4c47c406eb3ef3500240b6347c32ebb1c45e36 (diff) | |
download | bcm5719-llvm-ebac0b9c62a26fcfc91f448f1ab36db6215feb57.tar.gz bcm5719-llvm-ebac0b9c62a26fcfc91f448f1ab36db6215feb57.zip |
DebugInfo: Use DWP cu_index to speed up symbolizing (as intended)
I was a bit lazy when I first implemented this & skipped the index
lookup - obviously for large files this becomes pretty crucial, so here
we go, do the index lookup. Speeds up large DWP symbolizing by... lots.
(20m -> 20s, actually, maybe more in a release build (that was a release
build without index lookup, compared to a debug/non-release build with
the index usage))
llvm-svn: 309507
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index aeb1dea2bca..d8121912a30 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -400,8 +400,17 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) { } DWARFCompileUnit *DWARFContext::getDWOCompileUnitForHash(uint64_t Hash) { - // FIXME: Improve this for the case where this DWO file is really a DWP file - // with an index - use the index for lookup instead of a linear search. + if (const auto &CUI = getCUIndex()) { + if (const auto *R = CUI.getFromHash(Hash)) + if (auto CUOff = R->getOffset(DW_SECT_INFO)) + return CUs.getUnitForOffset(CUOff->Offset); + return nullptr; + } + + // If there's no index, just search through the CUs in the DWO - there's + // probably only one unless this is something like LTO - though an in-process + // built/cached lookup table could be used in that case to improve repeated + // lookups of different CUs in the DWO. for (const auto &DWOCU : dwo_compile_units()) if (DWOCU->getDWOId() == Hash) return DWOCU.get(); |