GCOV: Make sure that function idents in the .gcda and .gcno match
authorJustin Bogner <mail@justinbogner.com>
Thu, 6 Nov 2014 06:55:02 +0000 (06:55 +0000)
committerJustin Bogner <mail@justinbogner.com>
Thu, 6 Nov 2014 06:55:02 +0000 (06:55 +0000)
commit03e3dfd20a1837f6b2d6c07cff5b41cbdcfa80ce
tree49359373eb535cd4f56efb0d5400946f1c471389
parent58de7099c737681002f1ca6674a086c5232bb09b
GCOV: Make sure that function idents in the .gcda and .gcno match

When generating gcov compatible profiling, we sometimes skip emitting
data for functions for one reason or another. However, this was
emitting different function IDs in the .gcno and .gcda files, because
the .gcno case was using the loop index before skipping functions and
the .gcda the array index after. This resulted in completely invalid
gcov data.

This fixes the problem by making the .gcno loop track the ID
separately from the loop index.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221441 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/GCOV.cpp
lib/Transforms/Instrumentation/GCOVProfiling.cpp
test/Transforms/GCOVProfiling/function-numbering.ll [new file with mode: 0644]