[PATCH] D49134: Fix ABI when calling llvm_gcov_... routines from instrumentation code

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 07:21:01 PDT 2018


uweigand created this revision.
uweigand added reviewers: marco-c, syzaara, sfertile, davidxl.
Herald added a subscriber: llvm-commits.

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


Repository:
  rL LLVM

https://reviews.llvm.org/D49134

Files:
  lib/Transforms/Instrumentation/GCOVProfiling.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49134.154798.patch
Type: text/x-patch
Size: 6654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180710/b223f0cc/attachment.bin>


More information about the llvm-commits mailing list