summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'polly/lib/Analysis')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp16
-rw-r--r--polly/lib/Analysis/ScopDetectionDiagnostic.cpp20
2 files changed, 33 insertions, 3 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index c56d2cc4adb..27dfc930db8 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -1402,9 +1402,19 @@ bool ScopDetection::allBlocksValid(DetectionContext &Context) const {
for (const BasicBlock *BB : CurRegion.blocks()) {
Loop *L = LI.getLoopFor(BB);
- if (L && L->getHeader() == BB && CurRegion.contains(L) &&
- (!isValidLoop(L, Context) && !KeepGoing))
- return false;
+ if (L && L->getHeader() == BB) {
+ if (CurRegion.contains(L)) {
+ if (!isValidLoop(L, Context) && !KeepGoing)
+ return false;
+ } else {
+ SmallVector<BasicBlock *, 1> Latches;
+ L->getLoopLatches(Latches);
+ for (BasicBlock *Latch : Latches)
+ if (CurRegion.contains(Latch))
+ return invalid<ReportLoopOnlySomeLatches>(Context, /*Assert=*/true,
+ L);
+ }
+ }
}
for (BasicBlock *BB : CurRegion.blocks()) {
diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
index ca70018e8fb..ffc259f991a 100644
--- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
+++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
@@ -60,6 +60,7 @@ llvm::Statistic RejectStatistics[] = {
SCOP_STAT(LastAffFunc, ""),
SCOP_STAT(LoopBound, "Uncomputable loop bounds"),
SCOP_STAT(LoopHasNoExit, "Loop without exit"),
+ SCOP_STAT(LoopOnlySomeLatches, "Not all loop latches in scop"),
SCOP_STAT(FuncCall, "Function call with side effects"),
SCOP_STAT(NonSimpleMemoryAccess,
"Compilated access semantics (volatile or atomic)"),
@@ -393,6 +394,25 @@ std::string ReportLoopHasNoExit::getEndUserMessage() const {
}
//===----------------------------------------------------------------------===//
+// ReportLoopOnlySomeLatches
+
+std::string ReportLoopOnlySomeLatches::getMessage() const {
+ return "Not all latches of loop " + L->getHeader()->getName() +
+ " part of scop.";
+}
+
+bool ReportLoopOnlySomeLatches::classof(const RejectReason *RR) {
+ return RR->getKind() == RejectReasonKind::LoopHasNoExit;
+}
+
+const DebugLoc &ReportLoopOnlySomeLatches::getDebugLoc() const { return Loc; }
+
+std::string ReportLoopOnlySomeLatches::getEndUserMessage() const {
+ return "Loop cannot be handled because not all latches are part of loop "
+ "region.";
+}
+
+//===----------------------------------------------------------------------===//
// ReportFuncCall.
ReportFuncCall::ReportFuncCall(Instruction *Inst)
OpenPOWER on IntegriCloud