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

    <tr>
        <th>Summary</th>
        <td>
            Coverage on Multiple Architectures Fails
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    `    1|       |#include <stdio.h>
    2|      2|int main(){
    3|       |#if defined(__hexagon__)
    4|       |    puts("hexagon path");
    5|       |#else
    6|      2|    puts("generic path");
    7|      2|#endif
    8|      2|    return 0;
    9|      2|}
`

The code coverage report above is a result of generating two .profraw files, one on hexagon and another on x86, then using llvm-profdata to merge the two results together then displaying the results using llvm-cov. Below is the workflow used to generate this report.

The coverage report should report the following:

`    1|       |#include <stdio.h>
    2|      2|int main(){
    3|      1|#if defined(__hexagon__)
    4|      1|    puts("hexagon path");
    5|      1|#else
    6|      1|    puts("generic path");
    7|      2|#endif
    8|      2|    return 0;
    9|      2|}
`

>From what I understand, this issue is happening because each of the binaries are only creating one counter region so the “#else puts(“generic path”)” section will not get mapped to a counter that differentiates it from the counter of the main function. Additionally, the hexagon counters are not showing up at all because when llvm-cov processes the binaries for each of these files, it will first process the x86 binary, but when it processes the hexagon binary, it will detect that the main function has already been accounted for and skip it. are there any viable ways of fixing this merging across multiple architectures?


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVcuO6zYM_RplQzRw5DwXXuTO3ABddNf9gLZoW72KZIhyPPn7gn5kJneKAu2izcJP8pDn-JBBZtt4okLtvqnd6wr71IZY4EAYDflVGcy9UPsMAGCjDi8w_dThRenc-sr1hkDlL5yMDetW5d9VdpYI_QiWK-sTXNF6pY9Kn9Th2xyVf4GswVBtPRmlj29vLb1jE_zbm2RNKdunFDl1feIRWM_h0GFqldaSlC-ldj-XIsc0v9s_N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