[PATCH] D38224: Don't move llvm.localescape outside the entry block in the GCOV profiling pass
Marco Castelluccio via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 05:04:48 PDT 2017
marco-c created this revision.
This fixes https://bugs.llvm.org/show_bug.cgi?id=34714.
https://reviews.llvm.org/D38224
Files:
lib/Transforms/Instrumentation/GCOVProfiling.cpp
Index: lib/Transforms/Instrumentation/GCOVProfiling.cpp
===================================================================
--- lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -502,6 +502,16 @@
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 @@
// 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38224.116488.patch
Type: text/x-patch
Size: 1056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170925/b796ea68/attachment.bin>
More information about the llvm-commits
mailing list