From 84e2423d341f6fb27b257cc19cf5db5db66d9aa9 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 18 Apr 2014 20:30:27 +0000 Subject: [PATCH] [DWARF parser] Respect address ranges specified in compile unit DIE. When address ranges for compile unit are specified in compile unit DIE itself, there is no need to collect ranges from children subprogram DIEs. This change speeds up llvm-symbolizer on Clang-produced binaries with full debug info. For instance, symbolizing a first address in a 1Gb binary is now 2x faster (1s vs. 2s). llvm-svn: 206641 --- llvm/lib/DebugInfo/DWARFUnit.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/llvm/lib/DebugInfo/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARFUnit.cpp index 6b8d97c..7aba46c 100644 --- a/llvm/lib/DebugInfo/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARFUnit.cpp @@ -299,6 +299,13 @@ void DWARFUnit::clearDIEs(bool KeepCUDie) { } void DWARFUnit::collectAddressRanges(DWARFAddressRangesVector &CURanges) { + // First, check if CU DIE describes address ranges for the unit. + const auto &CUDIERanges = getCompileUnitDIE()->getAddressRanges(this); + if (!CUDIERanges.empty()) { + CURanges.insert(CURanges.end(), CUDIERanges.begin(), CUDIERanges.end()); + return; + } + // This function is usually called if there in no .debug_aranges section // in order to produce a compile unit level set of address ranges that // is accurate. If the DIEs weren't parsed, then we don't want all dies for -- 2.7.4