[all-commits] [llvm/llvm-project] 776e45: [llvm-cov gcov] Make recursive propagateCounts ite...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Oct 11 11:22:27 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 776e456dd883f92c9753e34d8ea403088f06de30
      https://github.com/llvm/llvm-project/commit/776e456dd883f92c9753e34d8ea403088f06de30
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-10-11 (Wed, 11 Oct 2023)

  Changed paths:
    M llvm/include/llvm/ProfileData/GCOV.h
    M llvm/lib/ProfileData/GCOV.cpp

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

propagateCounts computes unmeasured arc counts (see
commit b9d086693b5baebc477793af0d86a447bae01b6f).

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




More information about the All-commits mailing list