mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
Don't move llvm.localescape outside the entry block in the GCOV profiling pass
Summary: This fixes https://bugs.llvm.org/show_bug.cgi?id=34714. Patch by Marco Castelluccio Reviewers: rnk Reviewed By: rnk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38224 llvm-svn: 314201
This commit is contained in:
parent
1560b4082a
commit
76a8248dbb
@ -502,6 +502,16 @@ static bool functionHasLines(Function &F) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool shouldKeepInEntry(BasicBlock::iterator It) {
|
||||||
|
if (isa<AllocaInst>(*It)) return true;
|
||||||
|
if (isa<DbgInfoIntrinsic>(*It)) return true;
|
||||||
|
if (auto *II = dyn_cast<IntrinsicInst>(It)) {
|
||||||
|
if (II->getIntrinsicID() == llvm::Intrinsic::localescape) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void GCOVProfiler::emitProfileNotes() {
|
void GCOVProfiler::emitProfileNotes() {
|
||||||
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
|
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
|
||||||
if (!CU_Nodes) return;
|
if (!CU_Nodes) return;
|
||||||
@ -537,7 +547,7 @@ void GCOVProfiler::emitProfileNotes() {
|
|||||||
// single successor, so split the entry block to make sure of that.
|
// single successor, so split the entry block to make sure of that.
|
||||||
BasicBlock &EntryBlock = F.getEntryBlock();
|
BasicBlock &EntryBlock = F.getEntryBlock();
|
||||||
BasicBlock::iterator It = EntryBlock.begin();
|
BasicBlock::iterator It = EntryBlock.begin();
|
||||||
while (isa<AllocaInst>(*It) || isa<DbgInfoIntrinsic>(*It))
|
while (shouldKeepInEntry(It))
|
||||||
++It;
|
++It;
|
||||||
EntryBlock.splitBasicBlock(It);
|
EntryBlock.splitBasicBlock(It);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user