diff options
Diffstat (limited to 'polly/lib/Analysis')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 12 | ||||
| -rw-r--r-- | polly/lib/Analysis/ScopDetectionDiagnostic.cpp | 26 |
2 files changed, 38 insertions, 0 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index bd68ef5c817..4c5c95af6e6 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -1297,6 +1297,18 @@ bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const { if (!hasExitingBlocks(L)) return invalid<ReportLoopHasNoExit>(Context, /*Assert=*/true, L); + // The algorithm for domain construction assumes that loops has only a single + // exit block (and hence corresponds to a subregion). Note that we cannot use + // L->getExitBlock() because it does not check whether all exiting edges point + // to the same BB. + SmallVector<BasicBlock *, 4> ExitBlocks; + L->getExitBlocks(ExitBlocks); + BasicBlock *TheExitBlock = ExitBlocks[0]; + for (BasicBlock *ExitBB : ExitBlocks) { + if (TheExitBlock != ExitBB) + return invalid<ReportLoopHasMultipleExits>(Context, /*Assert=*/true, L); + } + if (canUseISLTripCount(L, Context)) return true; diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp index ac1e751e32d..a0c371237c4 100644 --- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp +++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp @@ -71,6 +71,7 @@ Statistic RejectStatistics[] = { SCOP_STAT(LastAffFunc, ""), SCOP_STAT(LoopBound, "Uncomputable loop bounds"), SCOP_STAT(LoopHasNoExit, "Loop without exit"), + SCOP_STAT(LoopHasMultipleExits, "Loop with multiple exits"), SCOP_STAT(LoopOnlySomeLatches, "Not all loop latches in scop"), SCOP_STAT(FuncCall, "Function call with side effects"), SCOP_STAT(NonSimpleMemoryAccess, @@ -496,6 +497,31 @@ std::string ReportLoopHasNoExit::getEndUserMessage() const { } //===----------------------------------------------------------------------===// +// ReportLoopHasMultipleExits. + +std::string ReportLoopHasMultipleExits::getRemarkName() const { + return "ReportLoopHasMultipleExits"; +} + +const Value *ReportLoopHasMultipleExits::getRemarkBB() const { + return L->getHeader(); +} + +std::string ReportLoopHasMultipleExits::getMessage() const { + return "Loop " + L->getHeader()->getName() + " has multiple exits."; +} + +bool ReportLoopHasMultipleExits::classof(const RejectReason *RR) { + return RR->getKind() == RejectReasonKind::LoopHasMultipleExits; +} + +const DebugLoc &ReportLoopHasMultipleExits::getDebugLoc() const { return Loc; } + +std::string ReportLoopHasMultipleExits::getEndUserMessage() const { + return "Loop cannot be handled because it has multiple exits."; +} + +//===----------------------------------------------------------------------===// // ReportLoopOnlySomeLatches std::string ReportLoopOnlySomeLatches::getRemarkName() const { |

