[llvm] r206671 - Check whether functions have any lines associated before emitting coverage info for them. This isn't just a size/time saving, gcov may crash on these.

Nick Lewycky nlewycky at google.com
Wed Jun 4 21:39:47 PDT 2014


On 1 June 2014 22:50, David Blaikie <dblaikie at gmail.com> wrote:

> On Fri, Apr 18, 2014 at 4:32 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
> > Author: nicholas
> > Date: Fri Apr 18 18:32:28 2014
> > New Revision: 206671
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=206671&view=rev
> > Log:
> > Check whether functions have any lines associated before emitting
> coverage info for them. This isn't just a size/time saving, gcov may crash
> on these.
>
> :( lack of test coverage.
>
> >
> > Modified:
> >     llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
> >
> > Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=206671&r1=206670&r2=206671&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
> (original)
> > +++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Fri Apr
> 18 18:32:28 2014
> > @@ -449,6 +449,21 @@ bool GCOVProfiler::runOnModule(Module &M
> >    return false;
> >  }
> >
> > +static bool functionHasLines(Function *F) {
> > +  // Check whether this function actually has any source lines. Not only
> > +  // do these waste space, they also can crash gcov.
> > +  for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
> {
> > +    for (BasicBlock::iterator I = BB->begin(), IE = BB->end();
> > +         I != IE; ++I) {
> > +      const DebugLoc &Loc = I->getDebugLoc();
> > +      if (Loc.isUnknown()) continue;
> > +      if (Loc.getLine() != 0)
>
> Well, at least this condition isn't covered - asserting that
> Loc.getLine() != 0 just before the condition never asserts in make
> check-llvm...
>

Fixed in r210239. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140604/5c4b8b38/attachment.html>


More information about the llvm-commits mailing list