[PATCH] D49915: [IR] Add a boolean field in DILocation to know if a line must covered or not

Marco Castelluccio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 10:38:28 PDT 2018


marco-c added a comment.

In https://reviews.llvm.org/D49915#1180453, @vsk wrote:

> > Some lines have a hit counter where they should not have one.
> >  For example, in C++, some cleanup is adding at the end of a scope represented by a '}'.
> >  So such a line has a hit counter where a user expects to not have one.
>
> Could you share an example of this resulting in an incorrect coverage report?


There are some examples in the tests that are fixed here: https://reviews.llvm.org/D49917.

>> The goal of the patch is to add this information in DILocation which is used to get the covered lines in GCOVProfiling.cpp.
> 
> This requires adding an operand to DILocation, which is a fairly expensive thing to do. Have you considered any alternatives?

Both me and Calixte had reservations about adding more data to DILocation too, but we couldn't find an alternative. It's possible that there might be some alternative we can't figure out due to our lack of experience with LLVM.
One thing I tried is not assigning lines to instructions that are TerminatorInst and !ReturnInst, but I think this causes us to skip some lines that we don't want to skip (e.g. the break clause in a switch).


Repository:
  rL LLVM

https://reviews.llvm.org/D49915





More information about the llvm-commits mailing list