summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'polly/lib/Analysis')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp8
-rw-r--r--polly/lib/Analysis/ScopDetectionDiagnostic.cpp19
2 files changed, 26 insertions, 1 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index a637afa5a41..690655201a1 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -1428,6 +1428,13 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const {
return false;
}
+ DebugLoc DbgLoc;
+ if (isa<UnreachableInst>(CurRegion.getExit()->getTerminator())) {
+ DEBUG(dbgs() << "Unreachable in exit\n");
+ return invalid<ReportUnreachableInExit>(Context, /*Assert=*/true,
+ CurRegion.getExit(), DbgLoc);
+ }
+
if (!CurRegion.getEntry()->getName().count(OnlyRegion)) {
DEBUG({
dbgs() << "Region entry does not match -polly-region-only";
@@ -1445,7 +1452,6 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const {
if (!allBlocksValid(Context))
return false;
- DebugLoc DbgLoc;
if (!isReducibleRegion(CurRegion, DbgLoc))
return invalid<ReportIrreducibleRegion>(Context, /*Assert=*/true,
&CurRegion, DbgLoc);
diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
index b2b566bdffd..ca70018e8fb 100644
--- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
+++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
@@ -44,6 +44,7 @@ using namespace llvm;
llvm::Statistic RejectStatistics[] = {
SCOP_STAT(CFG, ""),
SCOP_STAT(InvalidTerminator, "Unsupported terminator instruction"),
+ SCOP_STAT(UnreachableInExit, "Unreachable in exit block"),
SCOP_STAT(IrreducibleRegion, "Irreducible loops"),
SCOP_STAT(LastCFG, ""),
SCOP_STAT(AffFunc, ""),
@@ -190,6 +191,24 @@ bool ReportInvalidTerminator::classof(const RejectReason *RR) {
}
//===----------------------------------------------------------------------===//
+// UnreachableInExit.
+
+std::string ReportUnreachableInExit::getMessage() const {
+ std::string BBName = BB->getName();
+ return "Unreachable in exit block" + BBName;
+}
+
+const DebugLoc &ReportUnreachableInExit::getDebugLoc() const { return DbgLoc; }
+
+std::string ReportUnreachableInExit::getEndUserMessage() const {
+ return "Unreachable in exit block.";
+}
+
+bool ReportUnreachableInExit::classof(const RejectReason *RR) {
+ return RR->getKind() == RejectReasonKind::UnreachableInExit;
+}
+
+//===----------------------------------------------------------------------===//
// ReportIrreducibleRegion.
std::string ReportIrreducibleRegion::getMessage() const {
OpenPOWER on IntegriCloud