[llvm] [llvm-cov] Option to ignore hash mismatches for non-emitted symbols (PR #97574)

Aleksa Marković via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 02:59:40 PDT 2024


ntnx-aleksa wrote:

All in all, I absolutely agree with @chapuni that solving this from the Clang side is better. I haven't had the time to look into any Clang code, but I'd like to investigate once I find the time.
A solution could be introducing a magic hash value for non-emitted functions that will call for a 'non-strict' name-only match. The problem is that we wouldn't have a guarantee if we correctly merged these functions in profdata files, as there could be different code behind them that was non-emitted. To make sure this mechanism works correctly by separating functions with the same name and different code, we still need to provide some sort of information about non-emitted functions. Some solutions that come to mind are:
- Hashing source code instead of LLVM IR, because it is already present. Unfortunately, changes in code that don't result in different IR will have different hashes.
- Not emitting coverage mapping and profile counters for non-emitted code. The problem here is that actual written code might never get counts if it's never instantiated, and so actually dead code might not show up in reports.

Thanks for looking into this.

https://github.com/llvm/llvm-project/pull/97574


More information about the llvm-commits mailing list