<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56730>56730</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [LLVM-COV] Support more granular branch coverage data
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          igalakhov
      </td>
    </tr>
</table>

<pre>
    One of the features `llvm-cov` provides is branch coverage, which lets the user know how many times a given branch was taken in a program. While this is a useful feature for rearranging certain branches, it would be far more useful to provide an option to view more granular data. As an example, consider the following snippets:
```cpp
for(int i = 0; i < 1000000; ++i){
    if(rand() % 2){
        // branch 1
    } else {
       // branch 2
   }
}
```
```cpp
for(int i = 0; i < 1000000; ++i){
    if(i > 500000){
        // branch 1
    } else {
       // branch 2
   }
}
```
In both cases, the branch is about 500000 True and 500000 False (so the output by `llvm-cov` will be identical), but the former is much worse for the branch predictor than the latter. So, it would be useful to see more specific information about the branches (like say what order they were True/False in). It seems like there is already capability to do that, given that it can count the amount of True/False already.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVE2PozgQ_TVwKTUiJgRy4NAf21JLvZrDrGbPBThQ28ZGtkk2_37LJkxP5z5aRBTb9arqVfHKremvzTctwZzAjxJOEv1ipYPkkCt1nh46c-YlzNacqedzctBa1N0IbJEWB5mIZ7iMxCdKehejLE5a-NDmAiP_JtRX8DSxN8JAZ6m3EBdkPH7wAWm2cZLB4pTB3yMpyZEo5sMQ77SojRycjAUr0XKQgfQAnbQeaYsqXWBEHi5mUT20jEcLk7Fyi-PNVg-gBjN7MjocnkleViDT0Ititx49ZvDoAlD-i9OsYr2d0Y7d7dozo5S5BCJO0zxzE5LiMclfkvyRW7e-3TyvJ8w9ETVpDwRJ8QJ5UjzF5TPs8viEg0Q88UuJOCbV0-oI_NCJfZlaz39sY1gJ4h4UnkS88ru1efdpTKoXkMpJuHf56iF-2tjhVsrPxVbT7ysxgP-AcsX-v-W9sayMZ7WjW4UVvvgtTNBmaxZ_Ywp_2SUoqt_2rxipiNqZ6MbQmdHt9X66LqRUECpLSnvqUIWiOVfL6FVhdmKxcb5pCWNjrFun4Bcys5U9dT4esliDRaH30mbw3dxPxOcgOClXybtZdnSijkcxpMM4FGt5n1nCxSBqRR-MxyuPPXow9jYIvJccKHSBe70WT5pLyeDNh0STg-jKWMaF7ike4_7KzZ2xJUX-Gij1oVvoA-f1tgi7QL_jujqz6JURTnHJF9eXjLeYWSqb3aGs631x3FVp3xT9sThi6skr2STl0_v7jz8fnr_9SMoX-L7Ms7H-bvbv7rl4F6SLVc3o_RxnPIpqID8ubdaZiTfhq97-HviO-Ud2XMcrObcE9byWh6rI07E5lPm-KHqUbXvciwpF1YtdVxZdVcrdKa9ThS3rOPBkfik1Ihcir8RhV5R1cchOuci7vEKZV8d6Xx-SfS4nJJWFxJmxQ2qbyKFdBsdGRc67TyM6R4OWcouPix-NbWhAhR-jOaeRcBPZ_geWw-O4">