[llvm-cov][gcov] Optimize the cycle counting algorithm by skipping zero count cycles
authorXinhao Yuan <xinhaoyuan@gmail.com>
Thu, 10 Dec 2020 23:22:29 +0000 (15:22 -0800)
committerFangrui Song <i@maskray.me>
Thu, 10 Dec 2020 23:22:29 +0000 (15:22 -0800)
commit97260ab4786f87211b8553b56fd0600016b1d6fa
tree63a44ea6cba498c487a6b3e8c9b1d0eb12b070f9
parent4564553b8d8ab81dc21431a35275581cb42329c8
[llvm-cov][gcov] Optimize the cycle counting algorithm by skipping zero count cycles

This change is similar to http://gcc.gnu.org/PR90380

This reduces the complexity from exponential to polynomial of the arcs.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D93036
compiler-rt/test/profile/gcov-complex-line.c [new file with mode: 0644]
llvm/include/llvm/ProfileData/GCOV.h
llvm/lib/ProfileData/GCOV.cpp