[llvm] ef1a7f2 - Update pass status for GCOVProfiling
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 05:23:41 PDT 2020
Author: serge-sans-paille
Date: 2020-06-09T14:23:30+02:00
New Revision: ef1a7f2f01dbd15b1a6cb16141ae0ced2f7b6603
URL: https://github.com/llvm/llvm-project/commit/ef1a7f2f01dbd15b1a6cb16141ae0ced2f7b6603
DIFF: https://github.com/llvm/llvm-project/commit/ef1a7f2f01dbd15b1a6cb16141ae0ced2f7b6603.diff
LOG: Update pass status for GCOVProfiling
Take fork/exec instrumentation into account.
Differential Revision: https://reviews.llvm.org/D81227
Added:
Modified:
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 8c4ba2bb4edf..3a9409601120 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -132,7 +132,7 @@ class GCOVProfiler {
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 @@ bool GCOVProfiler::runOnModule(
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 @@ static bool shouldKeepInEntry(BasicBlock::iterator It) {
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 @@ void GCOVProfiler::AddFlushBeforeForkAndExec() {
Parent->splitBasicBlock(NextInst);
Parent->back().setDebugLoc(Loc);
}
+
+ return !Forks.empty() || !Execs.empty();
}
void GCOVProfiler::emitProfileNotes() {
More information about the llvm-commits
mailing list