mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Fix a bug in gcov instrumentation introduced by r195513. <rdar://15930350>
The entry block of a function starts with all the static allocas. The change in r195513 splits the block before those allocas, which has the effect of turning them into dynamic allocas. That breaks all sorts of things. Change to split after the initial allocas, and also add a comment explaining why the block is split. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200515 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9026e07000
commit
8498c08404
@ -27,6 +27,7 @@
|
||||
#include "llvm/DebugInfo.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
@ -478,8 +479,14 @@ void GCOVProfiler::emitProfileNotes() {
|
||||
|
||||
Function *F = SP.getFunction();
|
||||
if (!F) continue;
|
||||
|
||||
// gcov expects every function to start with an entry block that has a
|
||||
// single successor, so split the entry block to make sure of that.
|
||||
BasicBlock &EntryBlock = F->getEntryBlock();
|
||||
EntryBlock.splitBasicBlock(EntryBlock.begin());
|
||||
BasicBlock::iterator It = EntryBlock.begin();
|
||||
while (isa<AllocaInst>(*It) || isa<DbgInfoIntrinsic>(*It))
|
||||
++It;
|
||||
EntryBlock.splitBasicBlock(It);
|
||||
|
||||
GCOVFunction *Func =
|
||||
new GCOVFunction(SP, &out, i, Options.UseCfgChecksum);
|
||||
|
Loading…
Reference in New Issue
Block a user