summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2017-09-26 11:56:43 +0000
committerSylvestre Ledru <sylvestre@debian.org>2017-09-26 11:56:43 +0000
commite7d4cd639bcd21aebd0d5f9866d9e9ca717297b1 (patch)
treeb1f39e2312c8e624da46868953f7fb1c74db2e99 /llvm/lib
parent5a14bc84e189d3319e863cfc8777b16369d0b22c (diff)
downloadbcm5719-llvm-e7d4cd639bcd21aebd0d5f9866d9e9ca717297b1.tar.gz
bcm5719-llvm-e7d4cd639bcd21aebd0d5f9866d9e9ca717297b1.zip
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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index b2033536ac8..3154c1939ea 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -502,6 +502,16 @@ static bool functionHasLines(Function &F) {
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() {
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
if (!CU_Nodes) return;
@@ -537,7 +547,7 @@ void GCOVProfiler::emitProfileNotes() {
// single successor, so split the entry block to make sure of that.
BasicBlock &EntryBlock = F.getEntryBlock();
BasicBlock::iterator It = EntryBlock.begin();
- while (isa<AllocaInst>(*It) || isa<DbgInfoIntrinsic>(*It))
+ while (shouldKeepInEntry(It))
++It;
EntryBlock.splitBasicBlock(It);
OpenPOWER on IntegriCloud