[llvm-dev] My experience using -DLLVM_BUILD_INSTRUMENTED_COVERAGE to generate coverage

Xinliang David Li via llvm-dev llvm-dev at lists.llvm.org
Sun Jun 18 22:07:43 PDT 2017


On Fri, Jun 16, 2017 at 6:08 PM, Friedman, Eli via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> I've started looking at the state of code coverage recently; we figured
> LLVM itself would be a good test to figure out how mature it is, so I gave
> it a shot.  My experience:
>
> 1. You have to specify -DLLVM_USE_LINKER=gold (or maybe lld works; I
> didn't try).  If you link with binutils ld, the program will generate
> broken profile information.  Apparently, the linked binary is missing the
> __llvm_prf_names section.  This took me half a day to figure out.  This
> issue isn't documented anywhere, and the only error message I got was
> "Assertion `!Key.empty()' failed." from llvm-cov.
>
>

I believe the gnu-ld bug is
https://sourceware.org/bugzilla/show_bug.cgi?id=19161 which is fixed in
version 2.26.



> 2. The generated binaries are big and slow.  Comparing to a build without
> coverage, llc becomes 8x larger overall (text section becomes roughly 2x
> larger).  And check-llvm-codegen-arm goes from 3 seconds to 250 seconds.
>

Over last couple of years, the instrumentation and coverage data overhead
has reduced greatly.  FE based instrumentation in general has larger
overhead than IR based instrumentation, but the coverage testing currently
only works with FE instrumentation.


>
> 3. The generated profile information takes up a lot of space: llc
> generates a 90MB profraw file.
>

This looks like in the normal range of raw profile size.


David


>
> 4. When prepare-code-coverage-artifact.py invokes llvm-profdata for the
> profiles generated by "make check", it takes 50GB of memory to process
> about 1.5GB of profiles.  Is it supposed to use that much?
>
> 5. Using prepare-code-coverage-artifact.py generates "warning: 229
> functions have mismatched data".  I'm not sure what's causing this... I
> guess it has something to do with merging the profile data for multiple
> binaries?  The error message is not very helpful.
>
> 5. The HTML output highlights the semicolon after a break or return
> statement in some switch statements in red.  (For example,
> LowerADDC_ADDE_SUBC_SUBE in ARMISelLowering.cpp.)  Not really important,
> but annoying.
>
> 6. On the bright side, when it works, the generated coverage information
> is precise and easy to read.
>
> -Eli
>
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170618/165636a8/attachment.html>


More information about the llvm-dev mailing list