[llvm-cov gcov] Make recursive propagateCounts iterative. NFC
propagateCounts computes unmeasured arc counts (see commit b9d08669). In a x86-64 build using -O3 -fno-omit-frame-pointer, propagateCounts uses 80 bytes per stack frame. If a function contains 1e5 basic blocks on a tree path (Kirchoff's circuit law optimization), the used stack space will be 8MB (default ulimit -s in many configurations). (In a -O0 build, a stack frame costs 224 bytes.) 1e5 is ample for most configurations. However, for library users using threads (e.g. in RPC handlers), a remaining thread stack of 64KiB allows just 819 stack frames, which is too limited. Switch to an iterative form to avoid stack overflow issues. Iterative forms match other iterative form functions in this file (https://reviews.llvm.org/D93073). Alternative to #68455
Loading
Please sign in to comment