summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp6
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();
OpenPOWER on IntegriCloud