[PATCH] D53593: [GCOV] Flush counters before forking to avoid counting the execution before fork twice

calixte via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 10:16:41 PDT 2018


calixte added inline comments.


================
Comment at: lib/Transforms/Instrumentation/GCOVProfiling.cpp:556
+    Builder.CreateCall(GCOVFlush);
+    I->getParent()->splitBasicBlock(I);
+  }
----------------
vsk wrote:
> Why is this needed?
The line after the fork is executed 2 times: 1 time with the parent and 1 time with the child. So if we don't split the block the counter for this line (and the next ones in the same block as the fork) is only 1. So in putting a new block here and so a new counter in it we can reflect that the lines after the fork are executed two times. 


Repository:
  rL LLVM

https://reviews.llvm.org/D53593





More information about the llvm-commits mailing list