[PATCH] D70990: [dsymutil] Remove penultimate recursive call in lookForChildDIEsToKeep (NFC)

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 15:33:10 PST 2019


JDevlieghere created this revision.
JDevlieghere added reviewers: friss, aprantl, avl.
Herald added a project: LLVM.

The functions lookForDIEsToKeep and keepDIEAndDependencies are mutually
recursive and can cause a stackoverflow for large projects. While this has
always been the case, it became a bigger issue when we parallelized dsymutil,
because threads get only a fraction of the stack space.

In an attempt to tackle this issue, we removed part of the recursion in r338536
by introducing a worklist. Processing of child DIEs was no longer recursive.
However, we still received bug reports where we'd run out of stack space.

This patch removes another recursive call from lookForDIEsToKeep. The call was
used to look at DIEs that reference the current DIE. To make this possible, we
inlined keepDIEAndDependencies and added this work to the existing worklist.
Because the function is not tail recursive, we needed to add two more types of
worklist entries to perform the subsequent work.

Although one more recursive call remains, this was sufficient to address the
stack space issue for our current reports.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70990

Files:
  llvm/tools/dsymutil/DwarfLinker.cpp
  llvm/tools/dsymutil/DwarfLinker.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70990.232001.patch
Type: text/x-patch
Size: 20793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191203/3db13034/attachment.bin>


More information about the llvm-commits mailing list