[PATCH] D53600: [GCOV] Function counters are wrong when on one line

calixte via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 11:43:48 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL345624: [GCOV] Function counters are wrong when on one line (authored by calixte, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D53600

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


Index: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -572,9 +572,8 @@
 
       // Add the function line number to the lines of the entry block
       // to have a counter for the function definition.
-      Func.getBlock(&EntryBlock)
-          .getFile(SP->getFilename())
-          .addLine(SP->getLine());
+      uint32_t Line = SP->getLine();
+      Func.getBlock(&EntryBlock).getFile(SP->getFilename()).addLine(Line);
 
       for (auto &BB : F) {
         GCOVBlock &Block = Func.getBlock(&BB);
@@ -587,7 +586,6 @@
           Block.addEdge(Func.getReturnBlock());
         }
 
-        uint32_t Line = 0;
         for (auto &I : BB) {
           // Debug intrinsic locations correspond to the location of the
           // declaration, not necessarily any statements or expressions.
@@ -609,6 +607,7 @@
           GCOVLines &Lines = Block.getFile(SP->getFilename());
           Lines.addLine(Loc.getLine());
         }
+        Line = 0;
       }
       EdgeDestinations += Func.getEdgeDestinations();
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53600.171745.patch
Type: text/x-patch
Size: 1228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/070ec854/attachment.bin>


More information about the llvm-commits mailing list