<div dir="ltr">I would guess this would then cause the line to not be retrieved when it might be desired? But I haven't thought about it too hard (hopefully Simon can chime in).<br><br>If that's the case & the existing functionality needs to be preserved, then maybe two functions will be needed or some other way to communicate "actually I don't need the line" (pass it by pointer instead of reference - null pointer indicates "not needed")</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Apr 10, 2017 at 1:46 PM Brian Cain via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">bcain created this revision.<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/rL294231" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/rL294231</a> introduced a regression -- memory consumption for llvm-objdump during disassembly of ~500MB hexagon elf file was ~1.5GiB higher after that commit.<br class="gmail_msg">
<br class="gmail_msg">
This change restores the previous behavior -- exit the search early for FunctionNameKind::None, saving some memory allocation.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Repository:<br class="gmail_msg">
rL LLVM<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D31905" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D31905</a><br class="gmail_msg">
<br class="gmail_msg">
Files:<br class="gmail_msg">
lib/DebugInfo/DWARF/DWARFContext.cpp<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Index: lib/DebugInfo/DWARF/DWARFContext.cpp<br class="gmail_msg">
===================================================================<br class="gmail_msg">
--- lib/DebugInfo/DWARF/DWARFContext.cpp<br class="gmail_msg">
+++ lib/DebugInfo/DWARF/DWARFContext.cpp<br class="gmail_msg">
@@ -466,6 +466,9 @@<br class="gmail_msg">
FunctionNameKind Kind,<br class="gmail_msg">
std::string &FunctionName,<br class="gmail_msg">
uint32_t &StartLine) {<br class="gmail_msg">
+ if (Kind == FunctionNameKind::None)<br class="gmail_msg">
+ return false;<br class="gmail_msg">
+<br class="gmail_msg">
// The address may correspond to instruction in some inlined function,<br class="gmail_msg">
// so we have to build the chain of inlined functions and take the<br class="gmail_msg">
// name of the topmost function in it.<br class="gmail_msg">
@@ -477,7 +480,7 @@<br class="gmail_msg">
const DWARFDie &DIE = InlinedChain[0];<br class="gmail_msg">
bool FoundResult = false;<br class="gmail_msg">
const char *Name = nullptr;<br class="gmail_msg">
- if (Kind != FunctionNameKind::None && (Name = DIE.getSubroutineName(Kind))) {<br class="gmail_msg">
+ if ((Name = DIE.getSubroutineName(Kind))) {<br class="gmail_msg">
FunctionName = Name;<br class="gmail_msg">
FoundResult = true;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>