[PATCH] D31905: Exit early from start line search for FunctionNameKind::None

Brian Cain via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 13:46:54 PDT 2017


bcain created this revision.

https://reviews.llvm.org/rL294231 introduced a regression -- memory consumption for llvm-objdump during disassembly of ~500MB hexagon elf file was ~1.5GiB higher after that commit.

This change restores the previous behavior -- exit the search early for FunctionNameKind::None, saving some memory allocation.


Repository:
  rL LLVM

https://reviews.llvm.org/D31905

Files:
  lib/DebugInfo/DWARF/DWARFContext.cpp


Index: lib/DebugInfo/DWARF/DWARFContext.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFContext.cpp
+++ lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -466,6 +466,9 @@
                                                   FunctionNameKind Kind,
                                                   std::string &FunctionName,
                                                   uint32_t &StartLine) {
+  if (Kind == FunctionNameKind::None)
+    return false;
+
   // The address may correspond to instruction in some inlined function,
   // so we have to build the chain of inlined functions and take the
   // name of the topmost function in it.
@@ -477,7 +480,7 @@
   const DWARFDie &DIE = InlinedChain[0];
   bool FoundResult = false;
   const char *Name = nullptr;
-  if (Kind != FunctionNameKind::None && (Name = DIE.getSubroutineName(Kind))) {
+  if ((Name = DIE.getSubroutineName(Kind))) {
     FunctionName = Name;
     FoundResult = true;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31905.94732.patch
Type: text/x-patch
Size: 992 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170410/5422d38c/attachment.bin>


More information about the llvm-commits mailing list