[PATCH] D38223: Make sure the basic block has an insertion point before dereferencing it
Marco Castelluccio via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 5 12:23:00 PDT 2017
marco-c updated this revision to Diff 117865.
marco-c added a comment.
Disabled instrumentation for functions using funclet-based EH.
https://reviews.llvm.org/D38223
Files:
lib/Transforms/Instrumentation/GCOVProfiling.cpp
Index: lib/Transforms/Instrumentation/GCOVProfiling.cpp
===================================================================
--- lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -21,6 +21,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/UniqueVector.h"
+#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/IRBuilder.h"
@@ -502,6 +503,13 @@
return false;
}
+static bool isUsingFuncletBasedEH(Function &F) {
+ if (!F.hasPersonalityFn()) return false;
+
+ EHPersonality Personality = classifyEHPersonality(F.getPersonalityFn());
+ return isFuncletEHPersonality(Personality);
+}
+
static bool shouldKeepInEntry(BasicBlock::iterator It) {
if (isa<AllocaInst>(*It)) return true;
if (isa<DbgInfoIntrinsic>(*It)) return true;
@@ -542,6 +550,8 @@
DISubprogram *SP = F.getSubprogram();
if (!SP) continue;
if (!functionHasLines(F)) continue;
+ // TODO: Functions using funclet-based EH are currently not supported.
+ if (isUsingFuncletBasedEH(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.
@@ -620,6 +630,9 @@
if (!SP) continue;
if (!functionHasLines(F)) continue;
if (!Result) Result = true;
+ // TODO: Functions using funclet-based EH are currently not supported.
+ if (isUsingFuncletBasedEH(F)) continue;
+
unsigned Edges = 0;
for (auto &BB : F) {
TerminatorInst *TI = BB.getTerminator();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38223.117865.patch
Type: text/x-patch
Size: 1675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171005/46b9ff1c/attachment.bin>
More information about the llvm-commits
mailing list