1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

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
This commit is contained in:
Yuchen Wu 2013-11-22 23:07:45 +00:00
parent 7590fee969
commit 43df88959d

View File

@ -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);