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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 13:52:56 PDT 2017


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).

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")

On Mon, Apr 10, 2017 at 1:46 PM Brian Cain via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170410/ec0c01d3/attachment.html>


More information about the llvm-commits mailing list