diff options
author | Calixte Denizet <cdenizet@mozilla.com> | 2018-10-11 08:53:43 +0000 |
---|---|---|
committer | Calixte Denizet <cdenizet@mozilla.com> | 2018-10-11 08:53:43 +0000 |
commit | d2f290b0348a96704dd5a39d390ea3492448a0cb (patch) | |
tree | 58d23c314fed082c9a68546ceeee0771b85b476a /llvm/lib/Transforms | |
parent | 5dbeff3e1c57f60a391e54bbdda03997d5d8e67a (diff) | |
download | bcm5719-llvm-d2f290b0348a96704dd5a39d390ea3492448a0cb.tar.gz bcm5719-llvm-d2f290b0348a96704dd5a39d390ea3492448a0cb.zip |
[gcov] Display the hit counter for the line of a function definition
Summary:
Right now there is no hit counter on the line of function.
So the idea is add the line of the function to all the lines covered by the entry block.
Tests in compiler-rt/profile will be fixed in another patch: https://reviews.llvm.org/D49854
Reviewers: marco-c, davidxl
Reviewed By: marco-c
Subscribers: sylvestre.ledru, llvm-commits
Differential Revision: https://reviews.llvm.org/D49853
llvm-svn: 344228
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 625b354cc38..a060dd53513 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -570,6 +570,12 @@ void GCOVProfiler::emitProfileNotes() { Options.ExitBlockBeforeBody)); GCOVFunction &Func = *Funcs.back(); + // Add the function line number to the lines of the entry block + // to have a counter for the function definition. + Func.getBlock(&EntryBlock) + .getFile(SP->getFilename()) + .addLine(SP->getLine()); + for (auto &BB : F) { GCOVBlock &Block = Func.getBlock(&BB); TerminatorInst *TI = BB.getTerminator(); |