[llvm] r258406 - [GCOV] Avoid emitting profile arcs for module and skeleton CUs

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 12:01:49 PST 2016


This is more in Adrian's territory (he reviewed it & it's the modules debug
info stuff which he's worked on that this is a fix for), but yes - the
change seems reasonable enough & the bug seems problematic/annoying enough
that it'd be worth taking for 3.8

On Mon, Jan 25, 2016 at 11:55 AM, Hans Wennborg via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> I'm not sure who's the code owner here, and I'm not qualified to
> review it myself because I don't know what arc and note files are :-)
>
> Just for a second opinion; David, does this look reasonable to you?
>
> On Mon, Jan 25, 2016 at 10:14 AM, Vedant Kumar <vsk at apple.com> wrote:
> > Hi,
> >
> > I'd like to propose taking this commit for the 3.8 branch.
> >
> > It stops the compiler from writing out gcov-style arc and note files for
> module CU's.
> >
> > thanks
> > vedant
> >
> >> On Jan 21, 2016, at 9:04 AM, Vedant Kumar via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >>
> >> Author: vedantk
> >> Date: Thu Jan 21 11:04:42 2016
> >> New Revision: 258406
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=258406&view=rev
> >> Log:
> >> [GCOV] Avoid emitting profile arcs for module and skeleton CUs
> >>
> >> Do not emit profile arc files and note files for module and skeleton
> >> CU's.
> >>
> >> Our users report seeing unexpected *.gcda and *.gcno files in their
> >> projects when using gcov-style profiling with modules or frameworks.
> >> The unwanted files come from these modules. This is not very helpful
> >> for end-users. Further, we've seen reports of instrumented programs
> >> crashing while writing these files out (due to I/O failures).
> >
> > ^ We've also seen crashes because the gcda is not meant to be
> backwards-compatible. This results in "cannot merge previous GCDA" errors.
> >
> >>
> >> rdar://problem/22838296
> >>
> >> Reviewed-by: aprantl
> >>
> >> Differential Revision: http://reviews.llvm.org/D15997
> >>
> >> Added:
> >>    llvm/trunk/test/Transforms/GCOVProfiling/modules.ll
> >> 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=258406&r1=258405&r2=258406&view=diff
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
> (original)
> >> +++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Thu Jan
> 21 11:04:42 2016
> >> @@ -494,6 +494,11 @@ void GCOVProfiler::emitProfileNotes() {
> >>     // LTO, we'll generate the same .gcno files.
> >>
> >>     auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
> >> +
> >> +    // Skip module skeleton (and module) CUs.
> >> +    if (CU->getDWOId())
> >> +      continue;
> >> +
> >>     std::error_code EC;
> >>     raw_fd_ostream out(mangleName(CU, "gcno"), EC, sys::fs::F_None);
> >>     std::string EdgeDestinations;
> >> @@ -853,6 +858,11 @@ Function *GCOVProfiler::insertCounterWri
> >>   if (CU_Nodes) {
> >>     for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
> >>       auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
> >> +
> >> +      // Skip module skeleton (and module) CUs.
> >> +      if (CU->getDWOId())
> >> +        continue;
> >> +
> >>       std::string FilenameGcda = mangleName(CU, "gcda");
> >>       uint32_t CfgChecksum = FileChecksums.empty() ? 0 :
> FileChecksums[i];
> >>       Builder.CreateCall(StartFile,
> >>
> >> Added: llvm/trunk/test/Transforms/GCOVProfiling/modules.ll
> >> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GCOVProfiling/modules.ll?rev=258406&view=auto
> >>
> ==============================================================================
> >> --- llvm/trunk/test/Transforms/GCOVProfiling/modules.ll (added)
> >> +++ llvm/trunk/test/Transforms/GCOVProfiling/modules.ll Thu Jan 21
> 11:04:42 2016
> >> @@ -0,0 +1,12 @@
> >> +; RUN: opt -insert-gcov-profiling -o - < %s | llvm-dis | FileCheck
> -check-prefix=EMIT-ARCS %s
> >> +
> >> +; EMIT-ARCS-NOT: call void @llvm_gcda_start_file
> >> +
> >> +!llvm.dbg.cu = !{!0}
> >> +!llvm.module.flags = !{!3, !4}
> >> +
> >> +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1,
> producer: "LLVM", isOptimized: false, runtimeVersion: 2,
> splitDebugFilename: "my.dwo", emissionKind: 1, enums: !2, retainedTypes:
> !2, subprograms: !2, globals: !2, imports: !2, dwoId: 43981)
> >> +!1 = !DIFile(filename: "<stdin>", directory: "/")
> >> +!2 = !{}
> >> +!3 = !{i32 2, !"Dwarf Version", i32 4}
> >> +!4 = !{i32 2, !"Debug Info Version", i32 3}
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160125/1cefb738/attachment.html>


More information about the llvm-commits mailing list