This is an archive of the discontinued LLVM Phabricator instance.

Fix ABI when calling llvm_gcov_... routines from instrumentation code
ClosedPublic

Authored by uweigand on Jul 10 2018, 7:20 AM.

Details

Summary

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:
https://reviews.llvm.org/D21736

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).

Diff Detail

Event Timeline

uweigand created this revision.Jul 10 2018, 7:20 AM
marco-c accepted this revision.Jul 10 2018, 8:01 AM

LGTM! I assume you caught all the affected function calls.

The affected platforms should be removed from XFAIL once this and https://reviews.llvm.org/D48538 are committed.

This revision is now accepted and ready to land.Jul 10 2018, 8:01 AM
This revision was automatically updated to reflect the committed changes.

LGTM! I assume you caught all the affected function calls.

Yes, the other functions are not affected (void, or pointer arguments),

The affected platforms should be removed from XFAIL once this and https://reviews.llvm.org/D48538 are committed.

I've removed the XFAILs for s390x now.