[AutoFDO][llvm-profgen] Report zero count for unexecuted part of function code
authorwlei <wlei@fb.com>
Fri, 24 Sep 2021 05:53:12 +0000 (22:53 -0700)
committerwlei <wlei@fb.com>
Fri, 24 Sep 2021 21:15:05 +0000 (14:15 -0700)
commit28277e9b48601dee7027ba6ed50554db821ba09b
tree8e812754d23bdd4c93c11d103a39df1d0418fcc5
parentb45476c94ce8ea94e2ad4d93ceda00eb4078e682
[AutoFDO][llvm-profgen] Report zero count for unexecuted part of function code

In order to be consistent with compiler that interprets zero count as unexecuted(cold), this change reports zero-value count for unexecuted part of function code. For the implementation, it leverages the range counter, initializes all the executed function range with the zero-value. After all ranges are merged and converted into disjoint ranges, the remaining zero count will indicates the unexecuted(cold) part of the function.

This change also extends the current `findDisjointRanges` method which now can support adding zero-value range.

Reviewed By: hoy, wenlei

Differential Revision: https://reviews.llvm.org/D109713
llvm/test/tools/llvm-profgen/inline-noprobe.test
llvm/test/tools/llvm-profgen/inline-noprobe2.test
llvm/tools/llvm-profgen/ProfileGenerator.cpp
llvm/tools/llvm-profgen/ProfileGenerator.h
llvm/tools/llvm-profgen/ProfiledBinary.cpp
llvm/tools/llvm-profgen/ProfiledBinary.h