NO FUNCTIONAL CHANGE. Algorithmic complexity fix.
Our team at Facebook is currently constructing a compile backended by
LLVM. We sometimes have functions with large numbers of sibling basic
blocks (usually with an error path exit from each one). This was
triggering the qudratic behavior in this function - after visiting
each child llvm would re-scan the parent from the beginning again. We
modify the work stack to record the next index to be worked on
alongside the pointer. This avoids the need to linearly search for
the next unfinished child.
Note that I am not a committer at present, and will need the help of a committer to land this.
Test Plan:
cmake -G Ninja ...x86... -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;debuginfo-tests;lld;opt" ...
ninja check
Please fix/ensure the names of variables conform with the LLVM naming conventions (Upper case-starting camelcase)