[PATCH] D81227: Correctly report modified status for GCOVProfiling

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 05:27:25 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGef1a7f2f01db: Update pass status for GCOVProfiling (authored by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81227

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
@@ -132,7 +132,7 @@
   Function *insertReset(ArrayRef<std::pair<GlobalVariable *, MDNode *>>);
   Function *insertFlush(Function *ResetF);
 
-  void AddFlushBeforeForkAndExec();
+  bool AddFlushBeforeForkAndExec();
 
   enum class GCovFileType { GCNO, GCDA };
   std::string mangleName(const DICompileUnit *CU, GCovFileType FileType);
@@ -554,14 +554,15 @@
   this->GetTLI = std::move(GetTLI);
   Ctx = &M.getContext();
 
-  AddFlushBeforeForkAndExec();
+  bool Modified = AddFlushBeforeForkAndExec();
 
   FilterRe = createRegexesFromString(Options.Filter);
   ExcludeRe = createRegexesFromString(Options.Exclude);
 
   if (Options.EmitNotes) emitProfileNotes();
-  if (Options.EmitData) return emitProfileArcs();
-  return false;
+  if (Options.EmitData)
+    Modified |= emitProfileArcs();
+  return Modified;
 }
 
 PreservedAnalyses GCOVProfilerPass::run(Module &M,
@@ -620,7 +621,7 @@
 	return false;
 }
 
-void GCOVProfiler::AddFlushBeforeForkAndExec() {
+bool GCOVProfiler::AddFlushBeforeForkAndExec() {
   SmallVector<CallInst *, 2> Forks;
   SmallVector<CallInst *, 2> Execs;
   for (auto &F : M->functions()) {
@@ -692,6 +693,8 @@
     Parent->splitBasicBlock(NextInst);
     Parent->back().setDebugLoc(Loc);
   }
+
+  return !Forks.empty() || !Execs.empty();
 }
 
 void GCOVProfiler::emitProfileNotes() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81227.269502.patch
Type: text/x-patch
Size: 1561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200609/2274a52d/attachment.bin>


More information about the llvm-commits mailing list