[PATCH] D82742: Correctly track gcov update

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 02:07:02 PDT 2020


serge-sans-paille created this revision.
serge-sans-paille added a reviewer: calixte.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Adding a new function automatically leads to changed IR.


https://reviews.llvm.org/D82742

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
@@ -844,7 +844,6 @@
         continue;
       // TODO: Functions using scope-based EH are currently not supported.
       if (isUsingScopeBasedEH(F)) continue;
-      if (!Result) Result = true;
 
       DenseMap<std::pair<BasicBlock *, BasicBlock *>, unsigned> EdgeToCounter;
       unsigned Edges = 0;
@@ -868,6 +867,8 @@
                            "__llvm_gcov_ctr");
       CountersBySP.push_back(std::make_pair(Counters, SP));
 
+      Result = true;
+
       // If a BB has several predecessors, use a PHINode to select
       // the correct counter.
       for (auto &BB : F) {
@@ -939,6 +940,7 @@
     Builder.CreateRetVoid();
 
     appendToGlobalCtors(*M, F, 0);
+    Result = true;
   }
 
   return Result;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82742.274013.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200629/d9e8d33f/attachment-0001.bin>


More information about the llvm-commits mailing list