Move registering the execution of a basic block to the beginning rather than the...
authorBill Wendling <isanbard@gmail.com>
Tue, 20 Aug 2013 23:52:00 +0000 (23:52 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 20 Aug 2013 23:52:00 +0000 (23:52 +0000)
commit707f601fa5a82a1d9e114469311672b012cc76fc
tree3375248824541095edf143c4213b3fd780a056eb
parent9a1fb6b9fc54710a4c46729346f0cab389123d8a
Move registering the execution of a basic block to the beginning rather than the end.

There are situations which can affect the correctness (or at least expectation)
of the gcov output. For instance, if a call to __gcov_flush() occurs within a
block before the execution count is registered and then the program aborts in
some way, then that block will not be marked as executed. This is not normally
what the user expects.

If we move the code that's registering when a block is executed to the
beginning, we can catch these types of situations.

PR16893

llvm-svn: 188849
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp