[dsymutil] Remove recursion from lookForChildDIEsToKeep (1/2) (NFC)
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. This was tested by running dsymutil on clang built in debug (both with and without modules) and comparing the MD5 hash of the generated dSYM companion file. Differential revision: https://reviews.llvm.org/D70990
Loading
Please register or sign in to comment