[llvm] r349333 - DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 00:27:19 PST 2018


Author: dblaikie
Date: Mon Dec 17 00:27:19 2018
New Revision: 349333

URL: http://llvm.org/viewvc/llvm-project?rev=349333&view=rev
Log:
DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)

GCC emitted these unconditionally on/before 4.4/March 2012
Clang emitted these unconditionally on/before 3.5/March 2014

This improves performance when parsing CUs (especially those using split
DWARF) that contain no code ranges (such as the mini CUs that may be
created by ThinLTO importing - though generally they should be/are
avoided, especially for Split DWARF because it produces a lot of very
small CUs, which don't scale well in a bunch of other ways too
(including size)).

Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
    llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64
    llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64.debuglink
    llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-test.elf-x86-64
    llvm/trunk/test/DebugInfo/Inputs/test-inline.o
    llvm/trunk/test/DebugInfo/Inputs/test-parameters.o
    llvm/trunk/test/DebugInfo/debuglineinfo.test
    llvm/trunk/test/DebugInfo/llvm-symbolizer-split-dwarf-no-skel-address.test
    llvm/trunk/test/DebugInfo/llvm-symbolizer.test

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp Mon Dec 17 00:27:19 2018
@@ -581,27 +581,6 @@ void DWARFUnit::collectAddressRanges(DWA
   } else
     WithColor::error() << "decoding address ranges: "
                        << toString(CUDIERangesOrError.takeError()) << '\n';
-
-  // 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
-  // all compile units to stay loaded when they weren't needed. So we can end
-  // up parsing the DWARF and then throwing them all away to keep memory usage
-  // down.
-  const bool ClearDIEs = extractDIEsIfNeeded(false) > 1;
-  getUnitDIE().collectChildrenAddressRanges(CURanges);
-
-  // Collect address ranges from DIEs in .dwo if necessary.
-  bool DWOCreated = parseDWO();
-  if (DWO)
-    DWO->collectAddressRanges(CURanges);
-  if (DWOCreated)
-    DWO.reset();
-
-  // Keep memory down by clearing DIEs if this generate function
-  // caused them to be parsed.
-  if (ClearDIEs)
-    clearDIEs(true);
 }
 
 void DWARFUnit::updateAddressDieMap(DWARFDie Die) {

Modified: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
Binary files - no diff available.

Modified: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64.debuglink
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64.debuglink?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
Binary files - no diff available.

Modified: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-test.elf-x86-64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-test.elf-x86-64?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
Binary files - no diff available.

Modified: llvm/trunk/test/DebugInfo/Inputs/test-inline.o
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/test-inline.o?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
Binary files - no diff available.

Modified: llvm/trunk/test/DebugInfo/Inputs/test-parameters.o
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/test-parameters.o?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
Binary files - no diff available.

Modified: llvm/trunk/test/DebugInfo/debuglineinfo.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/debuglineinfo.test?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/debuglineinfo.test (original)
+++ llvm/trunk/test/DebugInfo/debuglineinfo.test Mon Dec 17 00:27:19 2018
@@ -1,50 +1,19 @@
 RUN: llvm-rtdyld -printline %p/Inputs/test-inline.o \
-RUN:   | FileCheck %s -check-prefix TEST_INLINE
+RUN:   | FileCheck %s
 RUN: llvm-rtdyld -printdebugline %p/Inputs/test-inline.o \
-RUN:   | FileCheck %s -check-prefix TEST_INLINE
+RUN:   | FileCheck %s
 RUN: llvm-rtdyld -printline %p/Inputs/test-parameters.o \
-RUN:   | FileCheck %s -check-prefix TEST_PARAMETERS
+RUN:   | FileCheck %s
 RUN: llvm-rtdyld -printdebugline %p/Inputs/test-parameters.o \
-RUN:   | FileCheck %s -check-prefix TEST_PARAMETERS
+RUN:   | FileCheck %s
 
 ; This test verifies that relocations are correctly applied to the
 ; .debug_line section and exercises DIContext::getLineInfoForAddressRange().
-; If relocations are not applied the first two functions will be reported as
-; both starting at address zero in the; line number table.
-TEST_INLINE:      Function: _Z15test_parametersPfPA2_dR11char_structPPitm, Size = 170
-TEST_INLINE-NEXT: Line info @ 0: test-inline.cpp, line:33
-TEST_INLINE-NEXT: Line info @ 35: test-inline.cpp, line:34
-TEST_INLINE-NEXT: Line info @ 165: test-inline.cpp, line:35
-TEST_INLINE-NEXT: Function: _Z3foov, Size = 3
-TEST_INLINE-NEXT: Line info @ 0: test-inline.cpp, line:28
-TEST_INLINE-NEXT: Line info @ 2: test-inline.cpp, line:29
-TEST_INLINE-NEXT: Function: main, Size = 146
-TEST_INLINE-NEXT: Line info @ 0: test-inline.cpp, line:39
-TEST_INLINE-NEXT: Line info @ 21: test-inline.cpp, line:41
-TEST_INLINE-NEXT: Line info @ 39: test-inline.cpp, line:42
-TEST_INLINE-NEXT: Line info @ 60: test-inline.cpp, line:44
-TEST_INLINE-NEXT: Line info @ 80: test-inline.cpp, line:48
-TEST_INLINE-NEXT: Line info @ 90: test-inline.cpp, line:45
-TEST_INLINE-NEXT: Line info @ 95: test-inline.cpp, line:46
-TEST_INLINE-NEXT: Line info @ 114: test-inline.cpp, line:48 
-TEST_INLINE-NEXT: Line info @ 141: test-inline.cpp, line:49
-
-; This test checks the case where all code is in a single section.
-TEST_PARAMETERS:      Function: _Z15test_parametersPfPA2_dR11char_structPPitm, Size = 170
-TEST_PARAMETERS-NEXT: Line info @ 0: test-parameters.cpp, line:33
-TEST_PARAMETERS-NEXT: Line info @ 35: test-parameters.cpp, line:34
-TEST_PARAMETERS-NEXT: Line info @ 165: test-parameters.cpp, line:35
-TEST_PARAMETERS-NEXT: Function: _Z3foov, Size = 3
-TEST_PARAMETERS-NEXT: Line info @ 0: test-parameters.cpp, line:28
-TEST_PARAMETERS-NEXT: Line info @ 2: test-parameters.cpp, line:29
-TEST_PARAMETERS-NEXT: Function: main, Size = 146
-TEST_PARAMETERS-NEXT: Line info @ 0: test-parameters.cpp, line:39
-TEST_PARAMETERS-NEXT: Line info @ 21: test-parameters.cpp, line:41
-TEST_PARAMETERS-NEXT: Line info @ 39: test-parameters.cpp, line:42
-TEST_PARAMETERS-NEXT: Line info @ 60: test-parameters.cpp, line:44
-TEST_PARAMETERS-NEXT: Line info @ 80: test-parameters.cpp, line:48
-TEST_PARAMETERS-NEXT: Line info @ 90: test-parameters.cpp, line:45
-TEST_PARAMETERS-NEXT: Line info @ 95: test-parameters.cpp, line:46
-TEST_PARAMETERS-NEXT: Line info @ 114: test-parameters.cpp, line:48 
-TEST_PARAMETERS-NEXT: Line info @ 141: test-parameters.cpp, line:49
 
+CHECK:      Function: _Z2f1v, Size = 6
+CHECK-NEXT:   Line info @ 0: test-inline.cpp, line:1
+CHECK-NEXT:   Line info @ 4: test-inline.cpp, line:1
+CHECK-NEXT: Function: _Z2f2v, Size = 11
+CHECK-NEXT:   Line info @ 0: test-inline.cpp, line:2
+CHECK-NEXT:   Line info @ 4: test-inline.cpp, line:2
+CHECK-NEXT:   Line info @ 9: test-inline.cpp, line:2

Modified: llvm/trunk/test/DebugInfo/llvm-symbolizer-split-dwarf-no-skel-address.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer-split-dwarf-no-skel-address.test?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/llvm-symbolizer-split-dwarf-no-skel-address.test (original)
+++ llvm/trunk/test/DebugInfo/llvm-symbolizer-split-dwarf-no-skel-address.test Mon Dec 17 00:27:19 2018
@@ -15,5 +15,8 @@ Compiled to assembly with clang, modifie
 high/low pc (& update the CU length field and abbrev to match) & then
 compile/objcopy to make the .o and .dwo.
 
-CHECK: _Z2f2v
-CHECK: test.cpp:2:51
+Ensure that the f2 inlined frame is not included - it's inefficient to have to
+go and load all the debug info and search for the address ranges, so assume
+that a lack of ranges on the CU means the CU covers no addresses.
+
+CHECK-NOT: _Z2f2v

Modified: llvm/trunk/test/DebugInfo/llvm-symbolizer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer.test?rev=349333&r1=349332&r2=349333&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/llvm-symbolizer.test (original)
+++ llvm/trunk/test/DebugInfo/llvm-symbolizer.test Mon Dec 17 00:27:19 2018
@@ -1,10 +1,10 @@
 RUN: rm -rf %t
 RUN: mkdir -p %t
-RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400559" > %t.input
-RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x400559" >> %t.input
-RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400436" >> %t.input
-RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400528" >> %t.input
-RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400586" >> %t.input
+RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x40113f" > %t.input
+RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x40113f" >> %t.input
+RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x401020" >> %t.input
+RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x40110e" >> %t.input
+RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x401160" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004e8" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004f4" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" >> %t.input
@@ -181,8 +181,8 @@ UNKNOWN-ARCH-NOT: main
 UNKNOWN-ARCH: ??
 UNKNOWN-ARCH-NOT: main
 
-RUN: echo "0x400559" > %t.input4
-RUN: echo "0x400436" >> %t.input4
+RUN: echo "0x40113f" > %t.input4
+RUN: echo "0x401020" >> %t.input4
 RUN: llvm-symbolizer --obj %p/Inputs/dwarfdump-test.elf-x86-64 < %t.input4 \
 RUN:   | FileCheck %s --check-prefix=BINARY
 
@@ -190,9 +190,9 @@ BINARY:       main
 BINARY-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
 BINARY:      _start
 
-RUN: echo "0x400720" > %t.input5
-RUN: echo "0x4004a0" >> %t.input5
-RUN: echo "0x4006f0" >> %t.input5
+RUN: echo "0x401140" > %t.input5
+RUN: echo "0x401020" >> %t.input5
+RUN: echo "0x401120" >> %t.input5
 RUN: llvm-symbolizer --obj %p/Inputs/llvm-symbolizer-test.elf-x86-64 < %t.input5 \
 RUN:   | FileCheck %s --check-prefix=BINARY_C
 




More information about the llvm-commits mailing list