[PATCH] D67283: [GCOV] Skip artificial functions from being emitted

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 11:17:12 PST 2019


aganea updated this revision to Diff 227748.
aganea marked 3 inline comments as done.
aganea added a comment.
Herald added a subscriber: hiraditya.

As suggested by @rnk


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67283/new/

https://reviews.llvm.org/D67283

Files:
  llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp


Index: llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -713,7 +713,10 @@
       // to have a counter for the function definition.
       uint32_t Line = SP->getLine();
       auto Filename = getFilename(SP);
-      Func.getBlock(&EntryBlock).getFile(Filename).addLine(Line);
+
+      // Artificial functions such as global initializers
+      if (Line > 0)
+        Func.getBlock(&EntryBlock).getFile(Filename).addLine(Line);
 
       for (auto &BB : F) {
         GCOVBlock &Block = Func.getBlock(&BB);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67283.227748.patch
Type: text/x-patch
Size: 697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191104/ee173352/attachment.bin>


More information about the llvm-commits mailing list