The llvm_gcov_... routines in compiler-rt are regular C functions that need to be called using the proper C ABI for the target. The current code simply calls them using plain LLVM IR types. Since the type are mostly simple, this happens to just work on certain targets. But other targets still need special handling; in particular, it may be necessary to sign- or zero-extended sub-word values to comply with the ABI. This caused gcov failures on SystemZ in particular.
Now the very same problem was already fixed for the llvm_profile_ calls here:
This patch uses the same method to fix the llvm_gcov_ calls, in particular calls to llvm_gcda_start_file, llvm_gcda_emit_function, and llvm_gcda_emit_arcs.
This patch (together with https://reviews.llvm.org/D49132) fixes the failures that were introduced on SystemZ by the additional test cases here: https://reviews.llvm.org/D48538).