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)
commit58e41344f95725a5b3b12c3c9f5987abdc367494
tree0f5807adf5810db868837c46b7c1f2825028cd43
parente4f47f08a389a11348bb60b3b3e744f6ea55ffcc
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.

llvm-svn: 221441
llvm/lib/IR/GCOV.cpp
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/test/Transforms/GCOVProfiling/function-numbering.ll [new file with mode: 0644]