diff options
| author | Justin Bogner <mail@justinbogner.com> | 2014-11-06 06:55:02 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2014-11-06 06:55:02 +0000 |
| commit | 58e41344f95725a5b3b12c3c9f5987abdc367494 (patch) | |
| tree | 0f5807adf5810db868837c46b7c1f2825028cd43 /llvm/lib/Transforms | |
| parent | e4f47f08a389a11348bb60b3b3e744f6ea55ffcc (diff) | |
| download | bcm5719-llvm-58e41344f95725a5b3b12c3c9f5987abdc367494.tar.gz bcm5719-llvm-58e41344f95725a5b3b12c3c9f5987abdc367494.zip | |
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
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 72b49a6cce3..0c666ffea6a 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -485,6 +485,7 @@ void GCOVProfiler::emitProfileNotes() { std::string EdgeDestinations; DIArray SPs = CU.getSubprograms(); + unsigned FunctionIdent = 0; for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) { DISubprogram SP(SPs.getElement(i)); assert((!SP || SP.isSubprogram()) && @@ -504,8 +505,8 @@ void GCOVProfiler::emitProfileNotes() { ++It; EntryBlock.splitBasicBlock(It); - Funcs.push_back( - make_unique<GCOVFunction>(SP, &out, i, Options.UseCfgChecksum)); + Funcs.push_back(make_unique<GCOVFunction>(SP, &out, FunctionIdent++, + Options.UseCfgChecksum)); GCOVFunction &Func = *Funcs.back(); for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { |

