[llvm] [NFC][Coverage] Do not use recursion for GCOV propagateCounts. (PR #68455)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 00:28:37 PDT 2023


MaskRay wrote:

Perhaps your environment has a smaller default stack size?

I have a simplified iterative algorithm: https://github.com/maskray/llvm-project/tree/gcov/propagateCounts 

    [llvm-cov gcov] Make recursive propagateCounts iterative. NFC

    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). For smaller stack size, the limit will be
    more tangible.

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



https://github.com/llvm/llvm-project/pull/68455


More information about the llvm-commits mailing list