summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
diff options
context:
space:
mode:
authorYuchen Wu <yuchenericwu@hotmail.com>2013-11-22 23:07:45 +0000
committerYuchen Wu <yuchenericwu@hotmail.com>2013-11-22 23:07:45 +0000
commitc87ca32163377b30cb02f4e62c05e3c9cf8650e1 (patch)
treeec7534953599c32c5fedaf965ca3dcb777345377 /llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
parentef77f3cca73261c2c03d0b3586dba5bfeafb4920 (diff)
downloadbcm5719-llvm-c87ca32163377b30cb02f4e62c05e3c9cf8650e1.tar.gz
bcm5719-llvm-c87ca32163377b30cb02f4e62c05e3c9cf8650e1.zip
llvm-cov: Split entry blocks in GCNOProfiling.cpp.
gcov expects every function to contain an entry block that unconditionally branches into the next block. clang does not implement basic blocks in this manner, so gcov did not output correct branch info if the entry block branched to multiple blocks. This change splits every function's entry block into an empty block and a block with the rest of the instructions. The instrumentation code will take care of the rest. llvm-svn: 195513
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 13472f038d5..fb5bee2ede2 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -467,6 +467,9 @@ void GCOVProfiler::emitProfileNotes() {
Function *F = SP.getFunction();
if (!F) continue;
+ BasicBlock &EntryBlock = F->getEntryBlock();
+ EntryBlock.splitBasicBlock(EntryBlock.begin());
+
GCOVFunction *Func =
new GCOVFunction(SP, &out, i, Options.UseCfgChecksum);
Funcs.push_back(Func);
OpenPOWER on IntegriCloud