[PATCH] D75436: [profile] Remove fork management from code coverage
calixte via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 00:43:29 PST 2020
calixte created this revision.
calixte added a reviewer: vsk.
Herald added subscribers: llvm-commits, Sanitizers, hiraditya.
Herald added projects: Sanitizers, LLVM.
In order to avoid crash when using fork in a multhreaded environment, just remove that stuff in waiting for a better proposal.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75436
Files:
compiler-rt/test/profile/Posix/instrprof-gcov-execlp.test
compiler-rt/test/profile/Posix/instrprof-gcov-execvp.test
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
@@ -117,8 +117,6 @@
insertCounterWriteout(ArrayRef<std::pair<GlobalVariable *, MDNode *>>);
Function *insertFlush(ArrayRef<std::pair<GlobalVariable *, MDNode *>>);
- void AddFlushBeforeForkAndExec();
-
enum class GCovFileType { GCNO, GCDA };
std::string mangleName(const DICompileUnit *CU, GCovFileType FileType);
@@ -566,8 +564,6 @@
this->GetTLI = std::move(GetTLI);
Ctx = &M.getContext();
- AddFlushBeforeForkAndExec();
-
FilterRe = createRegexesFromString(Options.Filter);
ExcludeRe = createRegexesFromString(Options.Exclude);
@@ -630,39 +626,6 @@
return false;
}
-void GCOVProfiler::AddFlushBeforeForkAndExec() {
- SmallVector<Instruction *, 2> ForkAndExecs;
- for (auto &F : M->functions()) {
- auto *TLI = &GetTLI(F);
- for (auto &I : instructions(F)) {
- if (CallInst *CI = dyn_cast<CallInst>(&I)) {
- if (Function *Callee = CI->getCalledFunction()) {
- LibFunc LF;
- if (TLI->getLibFunc(*Callee, LF) &&
- (LF == LibFunc_fork || LF == LibFunc_execl ||
- LF == LibFunc_execle || LF == LibFunc_execlp ||
- LF == LibFunc_execv || LF == LibFunc_execvp ||
- LF == LibFunc_execve || LF == LibFunc_execvpe ||
- LF == LibFunc_execvP)) {
- ForkAndExecs.push_back(&I);
- }
- }
- }
- }
- }
-
- // We need to split the block after the fork/exec call
- // because else the counters for the lines after will be
- // the same as before the call.
- for (auto I : ForkAndExecs) {
- IRBuilder<> Builder(I);
- FunctionType *FTy = FunctionType::get(Builder.getVoidTy(), {}, false);
- FunctionCallee GCOVFlush = M->getOrInsertFunction("__gcov_flush", FTy);
- Builder.CreateCall(GCOVFlush);
- I->getParent()->splitBasicBlock(I);
- }
-}
-
void GCOVProfiler::emitProfileNotes() {
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
if (!CU_Nodes) return;
Index: compiler-rt/test/profile/Posix/instrprof-gcov-execvp.test
===================================================================
--- compiler-rt/test/profile/Posix/instrprof-gcov-execvp.test
+++ compiler-rt/test/profile/Posix/instrprof-gcov-execvp.test
@@ -1,3 +1,5 @@
+UNSUPPORTED: true
+
RUN: mkdir -p %t.d
RUN: cd %t.d
Index: compiler-rt/test/profile/Posix/instrprof-gcov-execlp.test
===================================================================
--- compiler-rt/test/profile/Posix/instrprof-gcov-execlp.test
+++ compiler-rt/test/profile/Posix/instrprof-gcov-execlp.test
@@ -1,3 +1,5 @@
+UNSUPPORTED: true
+
RUN: mkdir -p %t.d
RUN: cd %t.d
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75436.247562.patch
Type: text/x-patch
Size: 2860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200302/8b345e9b/attachment.bin>
More information about the llvm-commits
mailing list