[PATCH] D81227: Correctly report modified status for GCOVProfiling
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 07:38:28 PDT 2020
serge-sans-paille updated this revision to Diff 269223.
serge-sans-paille added a comment.
Take review into account.
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
@@ -113,7 +113,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);
@@ -562,14 +562,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,
@@ -626,7 +627,7 @@
return false;
}
-void GCOVProfiler::AddFlushBeforeForkAndExec() {
+bool GCOVProfiler::AddFlushBeforeForkAndExec() {
SmallVector<CallInst *, 2> Forks;
SmallVector<CallInst *, 2> Execs;
for (auto &F : M->functions()) {
@@ -698,6 +699,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.269223.patch
Type: text/x-patch
Size: 1561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200608/f3365eb7/attachment.bin>
More information about the llvm-commits
mailing list