llvm-cov: Added call to update run/program counts.
authorYuchen Wu <yuchenericwu@hotmail.com>
Tue, 12 Nov 2013 04:59:08 +0000 (04:59 +0000)
committerYuchen Wu <yuchenericwu@hotmail.com>
Tue, 12 Nov 2013 04:59:08 +0000 (04:59 +0000)
Also updated test files that were generated from this change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194453 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/GCOVProfiling.cpp
test/tools/llvm-cov/Inputs/test.gcda
test/tools/llvm-cov/Inputs/test.gcno

index 4e9afeed4300444bbf4a7c3ad9f2554bb3e96ee3..206bffbb274e1f04e3dfb570d9f28d3adbaac3ad 100644 (file)
@@ -102,6 +102,7 @@ namespace {
     Constant *getIncrementIndirectCounterFunc();
     Constant *getEmitFunctionFunc();
     Constant *getEmitArcsFunc();
+    Constant *getSummaryInfoFunc();
     Constant *getDeleteWriteoutFunctionListFunc();
     Constant *getDeleteFlushFunctionListFunc();
     Constant *getEndFileFunc();
@@ -700,6 +701,11 @@ Constant *GCOVProfiler::getEmitArcsFunc() {
   return M->getOrInsertFunction("llvm_gcda_emit_arcs", FTy);
 }
 
+Constant *GCOVProfiler::getSummaryInfoFunc() {
+  FunctionType *FTy = FunctionType::get(Type::getVoidTy(*Ctx), false);
+  return M->getOrInsertFunction("llvm_gcda_summary_info", FTy);
+}
+
 Constant *GCOVProfiler::getDeleteWriteoutFunctionListFunc() {
   FunctionType *FTy = FunctionType::get(Type::getVoidTy(*Ctx), false);
   return M->getOrInsertFunction("llvm_delete_writeout_function_list", FTy);
@@ -746,6 +752,7 @@ Function *GCOVProfiler::insertCounterWriteout(
   Constant *StartFile = getStartFileFunc();
   Constant *EmitFunction = getEmitFunctionFunc();
   Constant *EmitArcs = getEmitArcsFunc();
+  Constant *SummaryInfo = getSummaryInfoFunc();
   Constant *EndFile = getEndFileFunc();
 
   NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
@@ -772,6 +779,7 @@ Function *GCOVProfiler::insertCounterWriteout(
                             Builder.getInt32(Arcs),
                             Builder.CreateConstGEP2_64(GV, 0, 0));
       }
+      Builder.CreateCall(SummaryInfo);
       Builder.CreateCall(EndFile);
     }
   }
index 16fff43acc9e59b4452e27fea7223d30215b648c..23d03bdd1fd2e4da1ed7ea957db0477b88c0eeda 100644 (file)
Binary files a/test/tools/llvm-cov/Inputs/test.gcda and b/test/tools/llvm-cov/Inputs/test.gcda differ
index 9db4f59dc78818edad0c202389603850b7b9c6da..6162604e7449ce85feb8bb6cd6438556c21ab1ee 100644 (file)
Binary files a/test/tools/llvm-cov/Inputs/test.gcno and b/test/tools/llvm-cov/Inputs/test.gcno differ